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

Images

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

Loading an image

Using display.newImage(filename [, baseDirectory] [, left, top]), an image object is returned. The image data is loaded from a filename you specified for your image and looks in 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. The.png files have better quality than the .jpg files and are used to display transparent images. The .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 limitations and known issues are as follows:

  • 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 2048 x 2048 px (iPad) and bigger for the newer, faster devices.
  • If you reload the same image multiple times, the subsequent calls to display.newImage ignore the isFullResolution parameter and take 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 reusing 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 Corona's website at http://coronalabs.com.

主站蜘蛛池模板: 浮山县| 广丰县| 五莲县| 肇州县| 郸城县| 通山县| 临桂县| 武威市| 多伦县| 怀安县| 紫云| 灵寿县| 尚志市| 灵寿县| 柞水县| 商城县| 奉新县| 滁州市| 苏尼特左旗| 团风县| 上杭县| 延长县| 沂水县| 香格里拉县| 防城港市| 封丘县| 历史| 佛坪县| 壶关县| 泸溪县| 诏安县| 海丰县| 年辖:市辖区| 兴宁市| 大田县| 华池县| 依兰县| 仙游县| 河源市| 格尔木市| 汉沽区|