viernes, septiembre 05, 2008

Flash Bitmap Caching Basics

Por ahi encontré este basic acerca de cuando tenemos muchos movieClips, sprites etc dando vueltas rendereandolos todo el tiempo en el stage y rápidamente vemos que sin activar esta opción, claramente cómo nuestra flash app ralentiza no ya su funcionalidad en si misma, sino también, el uso del sistema operativo en casos donde se abusa de este mismo feature.
A tener en cuenta a tope obiWan:

Cualquier abuso pa´cualquier lado, hace mal.

Ok, aquí algo re cope:

"...a bitmap is made up of pixels. It can be thought of as a grid of color values, which designate a particular color for each and every pixel. Each pixel is a cell in the grid. A 100 x 100 pixel bitmap can be described by a grid of 10,000 color values, one for each pixel.

Each color value in a bitmap is a binary number. A binary number is made up of bits, whose values can be either 0 or 1. This binary number will differ in length, depending upon the color depth of the bitmap. The color depth of a bitmap determines the range of possible color values that can be used in each pixel. For example, each pixel in a 24-bit image can be one of roughly 16.8 million colors. Those colors are formed by mixing together varying quantities of three primary colors: red, green, and blue. The three main colors are called channels. It follows that:

  • Each channel can have 256 possible values (0­255).
  • 256 * 256 * 256 = 16.8 million
  • 256 decimal is 11111111 in binary.
  • This binary number is 8 bits long. 8 bits is 1 byte.
Therefore each channel in a color uses 1 byte. The bitmaps that are created by Flash Player when it converts a movie clip into a surface have a 32-bit color depth. 32-bit images have four channels: red, green, blue, and an additional alpha channel.

Therefore the color value for each pixel in a surface created by Flash Player is 32 bits long, or 4 bytes.

4 * 8 = 32 bit

The bitmap that is created by Flash Player to represent the visual state of a movie clip when you turn bitmap caching on will have the same dimensions (width and height) as the movie clip.

A cached movie clip that is 100 x 100 pixels has 10,000 pixels.

100 * 100 = 10,000 pixels

Each of those pixels will be 32 bits or 4 bytes. Therefore the movie clip will use an extra 40,000 bytes of memory.

10,000 * 4 = 40,000 bytes

There are 1024 bytes in 1 kilobyte (K). So, 40,000 bytes can also be said to be roughly 40 kilobytes (40K).

..."

__________________________
Fuente>>