Question

i have an question about the game asset i found in several games.

enter image description here

as you can see, those games use the resouce like that

+is BMP format
+is pink or another colour background.

why do they use the image like this way?

i use Starling( Actionscript3 ) engine, normaly i use PNG or JPG file as the texture.

i know eventually no matter PNG,JPG,BMP always unfold to BitmapData, then upload to GPU,

but if i need to use some asset like those, i need loop each pixel and copy the pixel to another BitmapData (detect if the piexl not the background colour).

i don't think that is the right way to do this.

so why use asset like that way and how to use it?

thanks

Was it helpful?

Solution

There's no right way to do it. There are common ways people work (using png spritesheet), and using bmp, for me, is like a suicide. It's huge in size, and it gives you nothing more. So if you're asking if this is the 'right way to do it' - no. It's up to you to decide.

Having specific background is commonly used when using the blitting technique, which basically updates the BitmapData of one Bitmap object which is on stage. Copying pixels is somehow fast in flash, so you can achieve the effect of actual moving objects simply by copying pixels to specific location of the bitmap.

You can remove the background by many ways - threshold, blending, or simply copy specific pixels.

I guess BMP file doesn't need decompression, thus it's going to be processed somehow faster, but it's file size is increased. As the decompression (especially on small images) isn't that of a problem (GPU upload is slower) - the common way is to use PNG or at least JPEG.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top