cocos2d-x 3.0
- 首页 - 相关页面 - 模块 - 命名空间 - - 文件 -
Public 类型 - 图1 Public 类型 - 图2)
- 类列表 - 类索引 - 类继承关系 - 类成员

全部)) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义)))

Public 类型 | Public 成员函数 | Protected 类型 | Protected 成员函数 | Protected 属性 | 静态 Protected 属性 | 友元 | 所有成员列表

Image类 参考 Platform Adaptor

#include

类 Image 继承关系图:

Public 类型 - 图3 Ref

## Public 类型
enum Format { JPG, PNG, TIFF, WEBP, PVR, ETC, S3TC, ATITC, TGA, RAW_DATA, UNKOWN }
支持的图片格式 更多…
## Public 成员函数
Image ()
ctor 更多…
virtual ~Image ()
NA NA 更多…
bool initWithImageFile (const std::string &path)
从指定的路径加载图片 更多…
bool initWithImageData (const unsigned char data, ssize_t dataLen)
从流缓冲区加载图片 更多…
bool initWithRawData (const unsigned char data, ssize_t dataLen, int width, int height, int bitsPerComponent, bool preMulti=false)
unsigned char getData ()
ssize_t getDataLen ()
Format getFileType ()
Texture2D::PixelFormat getRenderFormat ()
int getWidth ()
int getHeight ()
bool isPremultipliedAlpha ()
int getNumberOfMipmaps ()
MipmapInfo getMipmaps ()
bool hasPremultipliedAlpha ()
int getBitPerPixel ()
bool hasAlpha ()
bool isCompressed ()
bool saveToFile (const std::string &filename, bool isToRGB=true)
以指定的格式把图片数据保存到指定的文件中 更多…
- Public 成员函数 继承自 Ref
void retain ()
保留所有权. 更多…
void release ()
立即释放所有权. 更多…
Ref * autorelease ()
自动释放所有权在不久的将来. 更多…
unsigned int getReferenceCount () const
返回Ref对象当前的引用计数. 更多…
virtual ~Ref ()
NA NA 更多…
## Protected 类型
typedef struct sImageTGA tImageTGA
## Protected 成员函数
bool initWithJpgData (const unsigned char data, ssize_t dataLen)
bool initWithPngData (const unsigned char data, ssize_t dataLen)
bool initWithTiffData (const unsigned char data, ssize_t dataLen)
bool initWithWebpData (const unsigned char data, ssize_t dataLen)
bool initWithPVRData (const unsigned char data, ssize_t dataLen)
bool initWithPVRv2Data (const unsigned char data, ssize_t dataLen)
bool initWithPVRv3Data (const unsigned char data, ssize_t dataLen)
bool initWithETCData (const unsigned char data, ssize_t dataLen)
bool initWithS3TCData (const unsigned char data, ssize_t dataLen)
bool initWithATITCData (const unsigned char data, ssize_t dataLen)
bool initWithTGAData (tImageTGA tgaData)
bool saveImageToPNG (const std::string &filePath, bool isToRGB=true)
bool saveImageToJPG (const std::string &filePath)
Image (const Image &rImg)
Image & operator= (const Image &)
bool initWithImageFileThreadSafe (const std::string &fullpath)
Format detectFormat (const unsigned char data, ssize_t dataLen)
bool isPng (const unsigned char data, ssize_t dataLen)
bool isJpg (const unsigned char data, ssize_t dataLen)
bool isTiff (const unsigned char data, ssize_t dataLen)
bool isWebp (const unsigned char data, ssize_t dataLen)
bool isPvr (const unsigned char data, ssize_t dataLen)
bool isEtc (const unsigned char data, ssize_t dataLen)
bool isS3TC (const unsigned char data, ssize_t dataLen)
bool isATITC (const unsigned char data, ssize_t dataLen)
- Protected 成员函数 继承自 Ref
Ref ()
构造函数 更多…
## Protected 属性
unsigned char * _data
ssize_t _dataLen
int _width
int _height
Format _fileType
Texture2D::PixelFormat _renderFormat
bool _preMulti
MipmapInfo _mipmaps [MIPMAP_MAX]
int _numberOfMipmaps
bool _hasPremultipliedAlpha
std::string _filePath
- Protected 属性 继承自 Ref
unsigned int _referenceCount
引用计数 更多…
## 静态 Protected 属性
static const int MIPMAP_MAX = 16
决定mipmap允许的最大数量 这个和使用define是一样的,只不过它遵守命名空间的规则 更多…
## 友元
class TextureCache

成员类型定义说明

typedef struct sImageTGA tImageTGA

protected

成员枚举类型说明

enum Format

strong

支持的图片格式

枚举值
JPG JPEG.
PNG PNG.
TIFF TIFF.
WEBP WebP.
PVR PVR.
ETC ETC.
S3TC S3TC.
ATITC ATITC.
TGA TGA.
RAW_DATA 原始数据
UNKOWN 未知格式

构造及析构函数说明

Image ( )

ctor

virtual ~Image ( )

virtual

NA NA

Image ( const Image & rImg)

protected

成员函数说明

Format detectFormat ( const unsigned char * data,
ssize_t dataLen
)

protected

int getBitPerPixel ( )

unsigned char* getData ( )

inline

ssize_t getDataLen ( )

inline

Format getFileType ( )

inline

int getHeight ( )

inline

MipmapInfo* getMipmaps ( )

inline

int getNumberOfMipmaps ( )

inline

Texture2D::PixelFormat getRenderFormat ( )

inline

int getWidth ( )

inline

bool hasAlpha ( )

bool hasPremultipliedAlpha ( )

inline

bool initWithATITCData ( const unsigned char * data,
ssize_t dataLen
)

protected

bool initWithETCData ( const unsigned char * data,
ssize_t dataLen
)

protected

bool initWithImageData ( const unsigned char * data,
ssize_t dataLen
)

从流缓冲区加载图片

  • 参数
  • data存放图片数据的流缓冲区 dataLen数据的字节数

  • 返回
  • true if loaded correctly.如果正确加载则返回true NA NA

bool initWithImageFile ( const std::string & path)

从指定的路径加载图片

  • 参数
  • path文件的绝对路径

  • 返回
  • 如果正确加载则返回true

bool initWithImageFileThreadSafe ( const std::string & fullpath)

protected

bool initWithJpgData ( const unsigned char * data,
ssize_t dataLen
)

protected

bool initWithPngData ( const unsigned char * data,
ssize_t dataLen
)

protected

bool initWithPVRData ( const unsigned char * data,
ssize_t dataLen
)

protected

bool initWithPVRv2Data ( const unsigned char * data,
ssize_t dataLen
)

protected

bool initWithPVRv3Data ( const unsigned char * data,
ssize_t dataLen
)

protected

bool initWithRawData ( const unsigned char * data,
ssize_t dataLen,
int width,
int height,
int bitsPerComponent,
bool preMulti = false
)

bool initWithS3TCData ( const unsigned char * data,
ssize_t dataLen
)

protected

bool initWithTGAData ( tImageTGA * tgaData)

protected

bool initWithTiffData ( const unsigned char * data,
ssize_t dataLen
)

protected

bool initWithWebpData ( const unsigned char * data,
ssize_t dataLen
)

protected

bool isATITC ( const unsigned char * data,
ssize_t dataLen
)

protected

bool isCompressed ( )

bool isEtc ( const unsigned char * data,
ssize_t dataLen
)

protected

bool isJpg ( const unsigned char * data,
ssize_t dataLen
)

protected

bool isPng ( const unsigned char * data,
ssize_t dataLen
)

protected

bool isPremultipliedAlpha ( )

inline

bool isPvr ( const unsigned char * data,
ssize_t dataLen
)

protected

bool isS3TC ( const unsigned char * data,
ssize_t dataLen
)

protected

bool isTiff ( const unsigned char * data,
ssize_t dataLen
)

protected

bool isWebp ( const unsigned char * data,
ssize_t dataLen
)

protected

Image& operator= ( const Image & )

protected

bool saveImageToJPG ( const std::string & filePath)

protected

bool saveImageToPNG ( const std::string & filePath,
bool isToRGB = true
)

protected

bool saveToFile ( const std::string & filename,
bool isToRGB = true
)

以指定的格式把图片数据保存到指定的文件中

  • 参数
  • filePath包括文件后缀的绝对路径 isToRGB图片是否以RGB格式保存

友元及相关函数文档

friend class TextureCache

friend

类成员变量说明

unsigned char* _data

protected

ssize_t _dataLen

protected

std::string _filePath

protected

Format _fileType

protected

bool _hasPremultipliedAlpha

protected

int _height

protected

MipmapInfo _mipmaps[MIPMAP_MAX]

protected

int _numberOfMipmaps

protected

bool _preMulti

protected

Texture2D::PixelFormat _renderFormat

protected

int _width

protected

const int MIPMAP_MAX = 16

staticprotected

决定mipmap允许的最大数量 这个和使用define是一样的,只不过它遵守命名空间的规则


该类的文档由以下文件生成:

  • /Users/zeroyang/Documents/github/cocos2d-x/cocos/2d/platform/CCImage.h
  • cocos2d
  • Image
  • 生成于 2014年 五月 29日 星期四 09:41:46 , 为 cocos2d-x使用 doxygen 1.8.6