Class cc.Image

Class Summary
Constructor Attributes Constructor Name and Description
 
Image

Method Summary

Class Detail

cc.Image()
Image

Method Detail

  • {Boolean} initWithImageData(data, dataLen, eFmt, width, height, bitsPerComponent)
    Load image from stream buffer.
    Parameters:
    {Array} data
    stream buffer that hold the image data
    {Number} dataLen
    the length of data(managed in byte)
    {Number} eFmt
    {Number} width
    {Number} height
    {Number} bitsPerComponent
    Returns:
    {Boolean} true if load correctly
  • {Boolean} initWithImageFile(strPath, imageType)
    Load the image from the specified path.
    Parameters:
    {String} strPath
    the absolute file path
    {Number} imageType
    the type of image, now only support tow types.
    Returns:
    {Boolean} true if load correctly
  • {Boolean} initWithImageFileThreadSafe(fullpath, imageType)
    The same meaning as initWithImageFile, but it is thread safe. It is casued by loadImage() in cc.TextureCache.
    Parameters:
    {String} fullpath
    full path of the file
    {Number} imageType
    the type of image, now only support tow types.
    Returns:
    {Boolean} true if load correctly
  • {Boolean} initWithString(text, width, height, eAlignMask, fontName, size)
    Create image with specified string.
    Parameters:
    {String} text
    the text which the image show, nil cause init fail
    {Number} width
    the image width, if 0, the width match the text's width
    {Number} height
    the image height, if 0, the height match the text's height
    {Number} eAlignMask
    the test Alignment
    {String} fontName
    the name of the font which use to draw the text. If nil, use the default system font.
    {Number} size
    the font size, if 0, use the system default size.
    Returns:
    {Boolean}
  • {Boolean} saveToFile(filePath, isToRGB)
    Save the CCImage data to specified file with specified format.
    Parameters:
    {String} filePath
    the file's absolute path, including file subfix
    {Boolean} isToRGB
    if the image is saved as RGB format
    Returns:
    {Boolean}