bitmapdata

ByteArray to BitmapData AS3

て烟熏妆下的殇ゞ 提交于 2019-11-27 07:49:54
问题 I'm using com.adobe.images.PNGEncoder to encode bitmapData to a byteArray. Is there a way to convert the byteArray back to bitmapData NOT using a Loader? thanks. EDIT: the reason i don't want to use a Loader is it being Asynchronous, and I don't want to implement eventlisteners. 回答1: The following is using the loader class but is synchronous. var loader:Loader = new Loader(); loader.loadBytes(byteArray); bmpData.draw(loader); Edit : Nevermind the loadBytes is asynchronous too, the

What is the best way to resize a BitmapData object?

本小妞迷上赌 提交于 2019-11-27 00:27:27
问题 Say I have a BitmapData of 600x600 and I want to scale it down to 100x100. 回答1: This works: var scale:Number = 1.0/6.0; var matrix:Matrix = new Matrix(); matrix.scale(scale, scale); var smallBMD:BitmapData = new BitmapData(bigBMD.width * scale, bigBMD.height * scale, true, 0x000000); smallBMD.draw(bigBMD, matrix, null, null, null, true); var bitmap:Bitmap = new Bitmap(smallBMD, PixelSnapping.NEVER, true); 回答2: public function drawScaled(obj:IBitmapDrawable, thumbWidth:Number, thumbHeight

Create Bitmap from a byte array of pixel data

元气小坏坏 提交于 2019-11-26 17:28:35
This question is about how to read/write, allocate and manage the pixel data of a Bitmap. Here is an example of how to allocate a byte array (managed memory) for pixel data and creating a Bitmap using it: Size size = new Size(800, 600); PixelFormat pxFormat = PixelFormat.Format8bppIndexed; //Get the stride, in this case it will have the same length of the width. //Because the image Pixel format is 1 Byte/pixel. //Usually stride = "ByterPerPixel"*Width //But it is not always true. More info at bobpowell . int stride = GetStride(size.Width, pxFormat); byte[] data = new byte[stride * size.Height]

How many ways to convert bitmap to string and vice-versa?

别来无恙 提交于 2019-11-26 13:49:04
问题 In my application i want to send bitmap image to the server in the form of string, i want to know how many ways are available to convert a bitmap to string. now i am using Base64 format for encoding and decoding, it takes little bit more memory. is there any other possibilities to do the same thing in different ways which takes less memory cosumptions. Now i am using this code. Resources r = ShowFullImage.this.getResources(); Bitmap bm = BitmapFactory.decodeResource(r, R.drawable.col);

Create Bitmap from a byte array of pixel data

偶尔善良 提交于 2019-11-26 04:20:50
问题 This question is about how to read/write, allocate and manage the pixel data of a Bitmap. Here is an example of how to allocate a byte array (managed memory) for pixel data and creating a Bitmap using it: Size size = new Size(800, 600); PixelFormat pxFormat = PixelFormat.Format8bppIndexed; //Get the stride, in this case it will have the same length of the width. //Because the image Pixel format is 1 Byte/pixel. //Usually stride = \"ByterPerPixel\"*Width //But it is not always true. More info