flambe
flambe copied to clipboard
[feature request] get the original bitmapdata from assetsLoader.
get the original bitmapdata from assetsLoader. some times I want to get the original bitmapdata instead the bitmapdata resize by Stage3DTexture because: 1:flambe have no setPixel /get pixels, but setPixel32... 2:after resize,the width or height was change..
By the time you get a Texture object, the BitmapData has been uploaded to the GPU and freed from CPU memory. This is a good thing.
It's possible that we want an API to be able to intercept the BitmapData during asset pack loading before it gets uploaded, but readPixels should be good enough for now.
but I don't want that bitmapdata as texuture.only for some other use It's possible that we want an API to be able to intercept the BitmapData during asset pack loading before it gets uploaded, yes ,this idea is googd.
I'd also like an API to access the BitmapData before upload... would be useful.
I recently had to work around an issue I was having with readPixels where it would only ever return r:0 g:0 b:0 a:255 for pixels of a transparent (png) texture (I wasn't sure if I was doing something wrong at the time, but it seems like it could be a bug..)
I made a Starling sprite-sheet parser, and I'm reading from the texture data to create nape bodies for individual sprites. The sprite display is aligned to the nape body, contained in an entity, and it's pretty much automatic.
Nape has MarchingSquares and polygon decomposition built in - http://napephys.com/samples.html#haxe-PerlinSquares - I feed it data about the outlines of the sprite shapes (read from the texture (alpha) data) and it does the rest. To work around the alpha-texture issue I made a flat 2-colour copy of the spritesheet texture and extracted with readPixels to find the shape outlines.
I'd like to clean up and release the nape-sprite utils at some time, but the work-around seems a bit hacky at the moment. If you think it's a useful feature for Flambe I'd be happy to contribute / make a pull request once it's done.
Flambe is great by the way! I'm new to it, but it already feels pretty comfortable.
~~Hmm, switching to use the git/dev version of Flambe sorted out the readPixels issue mentioned above.~~
After that little diversion, it turns out to be a FlashPlayer bug in context3D.drawToBitmapData when reading textures with alpha... happening in all current player versions, except the one in Chrome.
Seems like others have noticed this too; https://github.com/away3d/away3d-core-fp11/issues/397