
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
@pixi-essentials/texture-allocator
Advanced tools
Dynamic texture allocator based on @pixi-essentials/area-allocator
This package implements a slab-based texture allocator. It aims to help improve texture batching efficiency by generating atlases on-the-fly. You can allocate and free texture space on demand. The following implementations are provided:
texSubImage2D call.texture.baseTexture.resource.source.getContext('2d')) to draw each texture.npm install @pixi-essentials/texture-allocator
import { AtlasAllocator } from '@pixi-essentials/texture-allocator';
// Create an atlas allocator
const allocator = new AtlasAllocator();
// Create an image-source
const image = document.createElement('img');
// Load the image
image.src = "example.com/example.jpg";
// After the image loads, create the texture. You must do this *after* the image is loaded so you know the
// width and height needed. Also, the atlas resource requires the image to be loaded; otherwise, it will
// forget to re-upload once it does load.
image.onload = function() {
// Find the dimensions of the texture. Make sure this is less than 2048x2048, otherwise the allocator
// will fail to issue a texture.
const { naturalWidth, naturalHeight } = image;
// Allocate the texture. Edge padding is included by default.
const texture = allocator.allocate(naturalWidth, naturalHeight);
// Use the texture as you'd like. It's yours now!
// Free the texture once you're done with it!
allocate.free(texture);
}
import { CanvasTextureAllocator } from '@pixi-essentials/texture-allocator';
import type { BaseImageResource, Texture } from '@pixi/core';
// Create a canvas-texture allocator
const allocator = new CanvasTextureAllocator();
// Allocate a texture
const texture = allocator.allocate(256, 256);
// This will draw our geometry into a texture
function cacheGeometry(texture: Texture) {
const baseTexture = texture.baseTexture;
const canvas = (baseTexture.resource as BaseImageResource).source as HTMLCanvasElement;
const context = canvas.getContext('2d');
const frame = texture.frame;
// Our geometry is just a rectangle, nothing silly :P
context.fillStyle = 'green';
context.fillRect(frame.left, frame.top, frame.width, frame.height);
}
// Draw stuff into the texture
cacheGeometry(texture);
// Do stuff with the texture, i.e. add a sprite to your scene
import { Graphics } from '@pixi/graphics';
import { RenderTextureAllocator } from '@pixi-essentials/texture-allocator';
// Create a render-texture allocator
const allocator = new RenderTextureAllocator();
// Create something complicated. NOTE: This example is not complicated and is not recommended for caching
// into a texture.
const complexGraphics = new Graphics()
.beginFill(0xff)
.drawCircle(150, 150, 100, 100)
.endFill();
// Allocate the texture
const texture = allocator.allocate(0, 0, 250, 250);
// Cache the graphics into this texture
renderer.render(complexGraphics, texture);
// Use the texture instead of the graphics, i.e. add a sprite to your scene
FAQs
Dynamic texture allocator based on @pixi-essentials/area-allocator
We found that @pixi-essentials/texture-allocator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.