Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi-essentials/area-allocator

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi-essentials/area-allocator

Efficient texture area allocator for on-demand atlases

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
974
increased by14.19%
Maintainers
0
Weekly downloads
 
Created
Source

@pixi-essentials/area-allocator

This package implements an area allocator that can be used to issue texture space. It provides the following implementations:

  • GuilloteneAllocator: This maintains a tree of rectangular area nodes that are divided either horizontally or vertically in a flip-flop fashion. The allocated area is picked from the tightest fit, after which the original area is sliced. Sibling areas are merged when both are freed. This implementation was inspired the guillotiere crate.

Installation :package:

npm install @pixi-essentials/area-allocator

Usage :page_facing_up:

import { GuilloteneAllocator } from '@pixi-essentials/area-allocator';

import type { AreaAllocator } from '@pixi-essentials/area-allocator';

// A guillotene allocator that can manage 2D space
const spatialAllocator: AreaAllocator = new GuilloteneAllocator(1024, 1024);

// Rectange-area allocated by the allocator. The returned object has a __mem_area property that
// points to a area node that is required to free this area.
const space = spatialAllocator.allocate(128, 256);

// Free the 2D space after using. NOTE: This must be the same rectangle passed by "allocate", or you
// must also copy the __mem_area property.
spatialAllocator.free(space);

Keywords

FAQs

Package last updated on 08 Oct 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc