Haxe flash build raw bitmap data in bytearray EOF error -
i have xml , raw bitmap data bitmap font. want take raw data , set pixels in bitmapdata can make font.
using haxe flash libraries.
whenever run code keep getting error: error: error #2030: end of file encountered. @ flash.display::bitmapdata/setpixels()
i trying use technique in haxe fails: https://github.com/primaryfeather/starling-framework/blob/master/starling/src/starling/text/minibitmapfont.as
i don't know issue is. didn't include of bitmap data below because big there 310 entries.
import flash.display.bitmapdata; import flash.geom.rectangle; import flash.utils.bytearray; ...
private var bitmap_width : int = 128; private var bitmap_height : int = 64; private var bitmap_data : array<float> = [ 2027613533, 3413039936, 202148514, 2266925598, 4206886452, 4286853117, 2034947, 3202703399, 352977282, 2957757964, 3113652880, 2158068882, 1468709156, 2268063717, 2779310143, 2101025806, 3416509055, 4215794539, 3602168838, 1038056207, 1932393374 ]; ...
public function get_texture() : bitmapfont { var bmpdata : bitmapdata = new bitmapdata( bitmap_width, bitmap_height ); var bmpbytes : bytearray = new bytearray(); var numbytes : int = bitmap_data.length; bmpbytes.position = 0; ( in 0...numbytes ) { bmpbytes.writeunsignedint( std.int( bitmap_data[i] ) ); } bmpbytes.position = 0; //bmpbytes.uncompress(); bmpdata.setpixels( new rectangle( 0, 0, bitmap_width, bitmap_height ), bmpbytes ); return new bitmapfont().loadangelcode( bmpdata, xml_data ); }
are saying bitmap_data has 310 elements? need have
bitmap_width * bitmap_height = 8192 your code raises other questions (why bitmap_data vector of floats, instead of array of ints? why not embed image?), seems source of underflow.
Comments
Post a Comment