Sunday, October 27, 2013

Method 1: Merge multiple photos into one image png anhDay is the most basic way and effective way t


Image is one of the factors that directly impact on the game making it more attractive and vivid. In J2ME game development, due to limited capacity and double the memory, the image is very limited use. In this environment, eggette dealing with the use of the image becomes more important. In this paper, two aspects of memory capacity and to talk about the basic methods of image processing J2ME game
Method 1: Merge multiple photos into one image png anhDay is the most basic way and effective way to reduce the size of jpeg images. For example, you have 10 png images, each 10 15, now you can put it into a 100 15 or 10 150 or X X of the image. large image rate of 10 images of much smaller size. This is because the removal of 9 title picture, end of file data blocks, etc, and match the color scheme (palette images only if the 10 is the same, eliminating the need for the table Image 9 of pictures! This is not a small number)
Option 2: Reduce the number of color photographs can be considered as a method to reduce the color? When I say cut, who will be cut. If the game is completed that exceed capacity, this time in the use of tools to optimize color reduction, which can reduce the image size, image quality, but can not make you happy . So the U.S. chart at number of colors needed to determine, mobile games using pixel maps, that is, a pixel from an image pixel, eggette thus the of the predefined palettes can be done. However, the final use optimization tools are useful, sometimes a difference of one or two colors, but the effect is not significant difference in size but may become smaller. colors can really be considered as a method to reduce the size.
Method 4: Use technology and custom color table for the image format if the first two methods can not meet your requirements for size, and your game just happens to use a monsters of different colors, you can try changing technology palette. J2ME specification least phone support png image formats, each with a color palette png all data, if two additional images for others in different colors (including number of colors) are identical, as long as a picture and other images stored table, this stage is to save the image to save a lot of size. This method is very troublesome, however, you must understand the png file format, and then make a tool to extract data palettes and palette data block offset in png file. Save the image in memory is still used images, if you want to change the color scheme, then save the png file into a byte array, the offset in the block table in png with a new color scheme to replace the original data materials palette, and then create a byte array with the color change after images. Perhaps you think that saving the png size and n is a waste of table data. Save at least 1 more color palette eggette data ah! If you extract the image data directly in the palette with n copies of the data, which is saving more than the image size. But using the above method, we can also use drawImage rendering. If the image format to define, but you just have to write a drawing function, which can only be given pixel rate is very slow on some machines. png format or structure of their data, then use the pictures if you actually decide to do, I have a small request, do not compress the image data, zip compression than most of the time you wrote a good compression algorithm (see note J2ME Game Development. - compressed or uncompressed). Forum, a friend said that instead of using the png format, bmp images per smaller size, is also a reason.
Calculation of shared memory anhhinh 1 png image does not correspond with the memory capacity of the image. The computation of the memory image is: ** width height bpp. bpp is the bit of color is built into the system. for example: nokia 6600 565 pixel format is 16 bits. So, a 100 * 100 * 100 * 100 shooting (16/8) = 20,000 bytes, which is about 19.5k memory. Fixed pixel format does not change, just reduce the image width and height to reduce eggette memory consumption.
2 to reduce the number of image objects can save a lot of memory by Pictures not to reduce the number of objects to reduce the number of images. that is, with an integrated map is stored in an object image, the method SetClip Image selected objects from the image you need to do. However, this approach sacrifices a little speed, cut from each frame of image maps integrated cutting speed not less cut up pictures later. But for a small number, such as instructions, no matter dd

No comments:

Post a Comment