官术网_书友最值得收藏!

Images

Many art assets used in Corona applications are sets of images. You will notice that bitmap image objects are types of display objects.

Loading an image

By using display.newImage( filename [, baseDirectory] [, left, top] ), an image object is returned. The image data is loaded from a filename you specified to your image and looks in the system.ResourceDirectory for that file. The acceptable types of image files that are supported are .png (PNG-24 or higher only) and .jpg files. Avoid high .jpg compression as it may take longer to load on a device. .png files have better quality over .jpg files and are used to display transparent images. .jpg files do not save transparent images.

Image autoscaling

The default behavior of display.newImage() is to autoscale large images. This is to conserve texture memory. However, there are times when you do not want to have images autoscaled and there is an optional Boolean flag in the parameter list to control this manually.

To override autoscaling and show the image at its full resolution, use the optional isFullResolution parameter. By default, it is false, but if you specify true, then the new image is loaded at its full resolution:

display.newImage( [parentGroup,] filename [, baseDirectory] [, x, y] [,isFullResolution] )

The following are the limitations and known issues:

  • Indexed PNG image files are not supported.
  • Grayscale images are currently not supported; images must be RGB.
  • Images will still be autoscaled if they are larger than the maximum possible texture dimensions of the device. This is usually 1024x1024 (iPhone 3G) or 2048x2048 (iPhone 3GS and iPad).
  • If you reload the same image multiple times, the subsequent calls to display.newImage ignores the isFullResolution parameter and takes on the value passed the first time. In other words, the way you load an image file the first time affects the autoscaling setting the next time you load that same file. This is because Corona conserves texture memory by automatically re-using a texture that has already been loaded. As a result, you can use the same images as many times as you want without consuming additional texture memory.

More information on Corona SDK's documentation is located on Ansca's website: http://www.anscamobile.com.

主站蜘蛛池模板: 江华| 合山市| 登封市| 武平县| 兴城市| 当涂县| 洛隆县| 射洪县| 凤凰县| 阳泉市| 繁昌县| 永春县| 遂昌县| 江油市| 灵璧县| 布尔津县| 杂多县| 辉南县| 望江县| 绍兴市| 香河县| 扶风县| 邹平县| 枣阳市| 南汇区| 巴楚县| 永川市| 县级市| 政和县| 浑源县| 黑水县| 保靖县| 满城县| 林州市| 将乐县| 绥芬河市| 类乌齐县| 疏附县| 永丰县| 政和县| 阿合奇县|