
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
devkit-spriter
Advanced tools
The devkit-spriter package provides three functions for the devkit build process:
To load images, use the loadImages(filenames : String[]) : Promise<ImageInfo[]>
function:
var spriter = require('devkit-spriter');
spriter.loadImages(['image1.png', 'image2.png'])
.then(function (images) {
// images is an array of ImageInfo objects
});
An ImageInfo
object is a representation of an image that the spriter can use
to create spritesheets. It has the following properites:
x : int
the location of the image in a spritesheety : int
the location of the image in a spritesheetfilename : string
the full path to the image on diskhash : string
an md5 hash of the image bitmapbuffer : ImageBuffer
the pixels of the image wrapped in a Jimp object
(see https://github.com/oliver-moran/jimp). An ImageBuffer extends the Jimp
base class with a drawImage
call (based on the HTML5 canvas drawImage
call and promisifies getBuffer
and write
.width : int
the original image widthheight : int
the original image heightarea : int
the image's areadata : Buffer
the raw data in a node Buffer
, alias for buffer.bitmap.data
depth : int
the number of channels for the image, e.g. 4 for rgbahasAlphaChannel : boolean
true if the depth is 4margin : {top : int, right : int, bottom : int, left : int}
the size of
the margins around the image (transparent regions in original image)contentWidth : int
the width minus the marginscontentHeight : int
the height minus the marginscontentArea : int
the content area, the number of pixels this image will
occupy on a spritesheet (excluding spritesheet padding)To sprite images, first load them into ImageInfo objects. Then call
layout(ImageInfo[], opts) : Spritesheet[]
:
var spritesheets = spriter.layout(images);
Note that this is a synchronous call since no IO is performed. This call maybe expensive, depending on how many images you provide.
opts
can include:
padding : int
number of pixels on each side of an image to pad out the
image. Padding works by extending the border of the image. Defaults to
2
, which prevents most texture artifacts in OpenGL.maxSize : int
the largest dimension of a spritesheet. Spritesheets
cannot exceed this value in either width or height. Defaults to 1024
.powerOfTwoSheets : boolean
whether sheets should round their dimensions
up to the nearest power of two. Defaults to true
.name : string
a prefix for spritesheet namesext : string
a postfix for all spritesheet namesThe spriter provides utility functions for reading and writing to a disk
cache. It verifies the integrity of the disk cache before returning cached
results. Call loadCache(cacheFile : string, outputDirectory : string) : Promise<DiskCache>
to load a disk cache file:
var group = 'group1';
var filenames = ['image1.png', 'image2.png'];
spriter.loadCache('.my-cache-file', 'build/spritesheets/')
.get(group, filenames)
.then(function () {
// cached
})
.catch(Spriter.NotCachedError, function () {
// should resprite
});
The spriter is commonly used with groups of spritesheets, since a common use case is to sprite images that will probably be used together into the same spritesheet(s). For example, all sprites in a common animation should be placed in a single group. Compression is another example of grouping: images compressed as jpgs should be sprited separately from images compressed as pngs so that the resulting spritesheets can be compressed correctly.
Calling get
on DiskCache
verifies the following:
FAQs
a 2D spriter for the DevKit game engine
We found that devkit-spriter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.