Just a collection of BitmapData utility methods. Just for cross-platform stuff, since not all methods are implemented across all targets.
staticaddSpacesAndBorders(bitmapData:BitmapData, ?frameSize:FlxPoint, ?spacing:FlxPoint, ?border:FlxPoint, ?region:FlxRect):BitmapData
Gets image without spaces between tiles and generates new one with spaces and adds borders around them.
original image without spaces between tiles.
the size of tile in spritesheet.
spaces between tiles to add.
how many times to copy border of tiles.
region of image to use as a source graphics for spritesheet. Default value is null, which means that whole image will be used.
Image for spritesheet with inserted spaces between tiles.
Compares two BitmapData objects.
The source BitmapData object to compare with.
The BitmapData object to compare with the source BitmapData object.
If the two BitmapData objects have the same dimensions (width and height), the method returns a new BitmapData object that has the difference between the two objects. If the BitmapData objects are equivalent, the method returns the number 0. If the widths of the BitmapData objects are not equal, the method returns the number -3. If the heights of the BitmapData objects are not equal, the method returns the number -4.
staticcopyBorderPixels(bitmapData:BitmapData, frameWidth:Int, frameHeight:Int, spaceX:Int, spaceY:Int, borderX:Int, borderY:Int, horizontalFrames:Int, verticalFrames:Int):BitmapData
Helper method for copying border pixels around tiles. It modifies provided image, and assumes that there are spaces between tile images already.
image with spaces between tiles to fill with border pixels
horizontal spacing between tiles
vertical spacing between tiles
how many times to copy border of tiles on horizontal axis.
how many times to copy border of tiles on vertical axis.
how many columns of tiles on provided image.
how many rows of tiles on provided image.
Modified spritesheet with copied pixels around tile images.
staticgenerateRotations(brush:BitmapData, rotations:Int = 16, antiAliasing:Bool = false, autoBuffer:Bool = false):BitmapData
Generates BitmapData with prerotated brush stamped on it
The image you want to rotate and stamp.
The number of rotation frames the final sprite should have. For small sprites this can be quite a large number (360 even) without any problems.
Whether to use high quality rotations when creating the graphic. Default is false.
Whether to automatically increase the image size to accommodate rotated corners. Default is false. Will create frames that are 150% larger on each axis than the original frame or graphic.
Created BitmapData with stamped prerotations on it.
Returns the amount of bytes a bitmapData occupies in memory.
staticmerge(sourceBitmapData:BitmapData, sourceRect:Rectangle, destBitmapData:BitmapData, destPoint:Point, redMultiplier:Int, greenMultiplier:Int, blueMultiplier:Int, alphaMultiplier:Int):Void
Performs per-channel blending from a source image to a destination image.
The input bitmap image to use. The source image can be a different BitmapData object, or it can refer to the current BitmapData object.
A rectangle that defines the area of the source image to use as input.
The output bitmap image to use.
The point within the destination image (the current BitmapData instance) that corresponds to the upper-left corner of the source rectangle.
A hexadecimal uint value by which to multiply the red channel value.
A hexadecimal uint value by which to multiply the green channel value.
A hexadecimal uint value by which to multiply the blue channel value.
A hexadecimal uint value by which to multiply the alpha transparency value.
staticreplaceColor(bitmapData:BitmapData, color:FlxColor, newColor:FlxColor, fetchPositions:Bool = false, ?rect:FlxRect):Array<FlxPoint>
Replaces all BitmapData's pixels with specified color with newColor pixels. WARNING: very expensive (especially on big graphics) as it iterates over every single pixel.
BitmapData to change
Color to replace
Whether we need to store positions of pixels which colors were replaced
area to apply color replacement. Optional, uses whole image area if the rect is null
Array replaced pixels positions