本篇接下来介绍离屏服务内容。
该服务主要提供处理离屏的功能。结构体定义如下:
- typedef struct _TriglavPlugInOffscreenService {
- TriglavPlugInOffscreenCreatePlaneProc createPlaneProc;
- TriglavPlugInOffscreenRetainProc retainProc;
- TriglavPlugInOffscreenReleaseProc releaseProc;
- TriglavPlugInOffscreenGetWidthProc getWidthProc;
- TriglavPlugInOffscreenGetHeightProc getHeightProc;
- TriglavPlugInOffscreenGetRectProc getRectProc;
- TriglavPlugInOffscreenGetExtentRectProc getExtentRectProc;
- TriglavPlugInOffscreenGetChannelOrderProc getChannelOrderProc;
- TriglavPlugInOffscreenGetRGBChannelIndexProc getRGBChannelIndexProc;
- TriglavPlugInOffscreenGetCMYKChannelIndexProc getCMYKChannelIndexProc;
- TriglavPlugInOffscreenGetBlockRectCountProc getBlockRectCountProc;
- TriglavPlugInOffscreenGetBlockRectProc getBlockRectProc;
- TriglavPlugInOffscreenGetBlockImageProc getBlockImageProc;
- TriglavPlugInOffscreenGetBlockAlphaProc getBlockAlphaProc;
- TriglavPlugInOffscreenGetBlockSelectAreaProc getBlockSelectAreaProc;
- TriglavPlugInOffscreenGetBlockPlaneProc getBlockPlaneProc;
- TriglavPlugInOffscreenGetTileWidthProc getTileWidthProc;
- TriglavPlugInOffscreenGetTileHeightProc getTileHeightProc;
- TriglavPlugInOffscreenGetBitmapProc getBitmapProc;
- TriglavPlugInOffscreenSetBitmapProc setBitmapProc;
- } TriglavPlugInOffscreenService;
1. 为指定的离屏对象创建一个空的离屏,不需要时需手动调用函数 releaceProc() 销毁。
- /**
- * offscreenObject: 离屏对象
- * width: 宽度(像素)
- * height: 高度(像素)
- * depth: 颜色深度(字节)
- **/
- TRIGLAV_PLUGIN_API *createPlaneProc(
- TriglavPlugInOffscreenObject* offscreenObject,
- const TriglavPlugInInt width,
- const TriglavPlugInInt height,
- const TriglavPlugInInt depth );
2. 销毁指定的离屏对象
- /**
- * offscreenObject: 离屏对象
- **/
- TRIGLAV_PLUGIN_API *releaseProc(
- TriglavPlugInOffscreenObject offscreenObject );
3. 获取指定离屏对象的宽度
- /**
- * offscreenObject: 离屏对象
- * width: 宽度(像素)
- **/
- TRIGLAV_PLUGIN_API *getWidthProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInInt* width );
4. 获取指定离屏对象的高度
- /**
- * offscreenObject: 离屏对象
- * height: 高度(像素)
- **/
- TRIGLAV_PLUGIN_API *getHeightProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInInt* height );
5. 获取指定离屏对象的大小
- /**
- * offscreenObject: 离屏对象
- * rect: 离屏尺寸(像素)
- **/
- TRIGLAV_PLUGIN_API *getRectProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInRect* rect );
6. 获取指定离屏对象的绘制区域的外接矩形
- /**
- * offscreenObject: 离屏对象
- * rect: 绘制区域的外接矩形(像素)
- **/
- TRIGLAV_PLUGIN_API *getExtentRectProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInRect* rect );
7. 获取指定离屏对象的通道对齐信息
- /**
- * offscreenObject: 离屏对象
- * channelOrder: 通道对齐信息
- **/
- TRIGLAV_PLUGIN_API *getChannelOrderProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInInt* channelOrder );
获取的 channel order 为下述常量之一:
- #define kTriglavPlugInOffscreenChannelOrderAlpha (0x01)
- #define kTriglavPlugInOffscreenChannelOrderGrayAlpha (0x02)
- #define kTriglavPlugInOffscreenChannelOrderRGBAlpha (0x03)
- #define kTriglavPlugInOffscreenChannelOrderCMYKAlpha (0x04)
- #define kTriglavPlugInOffscreenChannelOrderBinarizationAlpha (0x05)
- #define kTriglavPlugInOffscreenChannelOrderBinarizationGrayAlpha (0x06)
- #define kTriglavPlugInOffscreenChannelOrderSelectArea (0x10)
- #define kTriglavPlugInOffscreenChannelOrderPlane (0x20)
8. 获取指定离屏对象的 RGB channel index
- /**
- * offscreenObject: 离屏对象
- * redChannelIndex: 红色 channel index
- * blueChannelIndex: 蓝色 channel index
- * greenChannelIndex: 绿色 channel index
- **/
- TRIGLAV_PLUGIN_API *getRGBChannelIndexProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInInt* redChannelIndex,
- TriglavPlugInInt* blueChannelIndex,
- TriglavPlugInInt* greenChannelIndex );
9. 获取指定离屏对象的 CMYK channel index
- /**
- * offscreenObject: 离屏对象
- * cyanChannelIndex: 青色 channel index
- * magentaChannelIndex: 品红色 channel index
- * yellowChannelIndex: 黄色 channel index
- * keytoneChannelIndex: 基调 channel index
- **/
- TRIGLAV_PLUGIN_API *getCMYKChannelIndexProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInInt* cyanChannelIndex,
- TriglavPlugInInt* magentaChannelIndex,
- TriglavPlugInInt* yellowChannelIndex,
- TriglavPlugInInt* keytoneChannelIndex );
10. 获取指定区域的指定离屏对象的块数
- /**
- * offscreenObject: 离屏对象
- * bounds: 搜索区域
- * blockRectCount: 块数
- **/
- TRIGLAV_PLUGIN_API *getBlockRectCountProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInRect* bounds,
- TriglavPlugInInt* blockRectCount);
11. 在指定区域中获取指定离屏对象块的区域
- /**
- * offscreenObject: 离屏对象
- * bounds: 搜索区域
- * blockIndex: 块索引
- * blockRect: 块所在区域
- **/
- TRIGLAV_PLUGIN_API *getBlockRectProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInRect* bounds,
- TriglavPlugInInt blockIndex,
- TriglavPlugInRect* blockRect);
12. 在指定的离屏对象中根据指定坐标获取图像地址、到下一列像素的字节数、到下一行像素的字节数以及块的大小
- /**
- * offscreenObject: 离屏对象
- * pos: 坐标
- * address: 地址
- * rowBytes: 到下一列像素的字节数
- * pixelBytes: 到下一行像素的字节数
- * blockRect: 块所在区域
- **/
- TRIGLAV_PLUGIN_API *getBlockImageProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInPoint* pos,
- TriglavPlugInPtr* address,
- TriglavPlugInInt* rowBytes,
- TriglavPlugInInt* pixelBytes,
- TriglavPlugInRect* blockRect);
13. 在指定的离屏对象中根据指定坐标获取 alpha 地址、到下一列像素的字节数、到下一行像素的字节数以及块的大小
- /**
- * offscreenObject: 离屏对象
- * pos: 坐标
- * address: 地址
- * rowBytes: 到下一列像素的字节数
- * pixelBytes: 到下一行像素的字节数
- * blockRect: 块所在区域
- **/
- TRIGLAV_PLUGIN_API *getBlockAlphaProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInPoint* pos,
- TriglavPlugInPtr* address,
- TriglavPlugInInt* rowBytes,
- TriglavPlugInInt* pixelBytes,
- TriglavPlugInRect* blockRect);
14. 在指定的离屏对象中根据指定坐标获取选择区域地址、到下一列像素的字节数、到下一行像素的字节数以及块的大小
- /**
- * offscreenObject: 离屏对象
- * pos: 坐标
- * address: 地址
- * rowBytes: 到下一列像素的字节数
- * pixelBytes: 到下一行像素的字节数
- * blockRect: 块所在区域
- **/
- TRIGLAV_PLUGIN_API *getBlockSelectAreaProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInPoint* pos,
- TriglavPlugInPtr* address,
- TriglavPlugInInt* rowBytes,
- TriglavPlugInInt* pixelBytes,
- TriglavPlugInRect* blockRect);
15. 在指定的离屏对象中根据指定坐标获取屏幕地址、到下一列像素的字节数、到下一行像素的字节数以及块的大小
- /**
- * offscreenObject: 离屏对象
- * pos: 坐标
- * address: 地址
- * rowBytes: 到下一列像素的字节数
- * pixelBytes: 到下一行像素的字节数
- * blockRect: 块所在区域
- **/
- TRIGLAV_PLUGIN_API *getBlockPlaneProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInPoint* pos,
- TriglavPlugInPtr* address,
- TriglavPlugInInt* rowBytes,
- TriglavPlugInInt* pixelBytes,
- TriglavPlugInRect* blockRect);
16. 获取指定离屏对象的主机设置平铺宽度
- /**
- * offscreenObject: 离屏对象
- * tileWidth: 平铺宽度
- **/
- TRIGLAV_PLUGIN_API *getTileWidthProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInInt* tileWidth);
17. 获取指定离屏对象的主机设置平铺高度
- /**
- * offscreenObject: 离屏对象
- * tileHeight: 平铺高度
- **/
- TRIGLAV_PLUGIN_API *getTileHeightProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInInt* tileHeight);
18. 从指定的离屏对象创建并获取位图对象
- /**
- * offscreenObject: 离屏对象
- * offscreenPos: 离屏左上角坐标
- * bitmapPos: 位图左上角坐标
- * copyWidth: 复制宽度
- * copyHeight: 复制高度
- * copyMode: 复制模式
- * bitmapObject: 位图对象
- **/
- TRIGLAV_PLUGIN_API *getBitmapProc(
- TriglavPlugInOffscreenObject offscreenObject,
- const TriglavPlugInPoint* offscreenPos,
- const TriglavPlugInPoint* bitmapPos,
- const TriglavPlugInInt copyWidth,
- const TriglavPlugInInt copyHeight,
- const TriglavPlugInInt copyMode,
- TriglavPlugInBitmapObject bitmapObject);
复制模式取下列常量之一:
- #define kTriglavPlugInOffscreenCopyModeNormal (0x01)
- #define kTriglavPlugInOffscreenCopyModeImage (0x02)
- #define kTriglavPlugInOffscreenCopyModeGray (0x03)
- #define kTriglavPlugInOffscreenCopyModeRed (0x04)
- #define kTriglavPlugInOffscreenCopyModeGreen (0x05)
- #define kTriglavPlugInOffscreenCopyModeBlue (0x06)
- #define kTriglavPlugInOffscreenCopyModeCyan (0x07)
- #define kTriglavPlugInOffscreenCopyModeMagenta (0x08)
- #define kTriglavPlugInOffscreenCopyModeYellow (0x09)
- #define kTriglavPlugInOffscreenCopyModeKeyPlate (0x10)
- #define kTriglavPlugInOffscreenCopyModeAlpha (0x11)
19. 根据指定的位图对象设置离屏对象
- /**
- * bitmapObject: 位图对象
- * bitmapPos: 位图左上角坐标
- * copyWidth: 复制宽度
- * copyHeight: 复制高度
- * copyMode: 复制模式
- * offscreenObject: 离屏对象
- * offscreenPos: 离屏左上角坐标
- **/
- TRIGLAV_PLUGIN_API *setBitmapProc(
- TriglavPlugInBitmapObject bitmapObject,
- const TriglavPlugInPoint* bitmapPos,
- const TriglavPlugInInt copyWidth,
- const TriglavPlugInInt copyHeight,
- const TriglavPlugInInt copyMode,
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInPoint* offscreenPos);
该服务主要提供处理离屏的功能,结构体定义如下:
- typedef struct _TriglavPlugInOffscreenService2 {
- TriglavPlugInOffscreenGetBitmapNormalAlphaChannelIndexProc getBitmapNormalAlphaChannelIndexProc;
- } TriglavPlugInOffscreenService2;
1. 获取复制模式为 kTriglavPlugInOffscreenCopyModeNormal 时的 channel index
- /**
- * offscreenObject: 离屏对象
- * alphaChannelIndex: alpha channel index
- **/
- TRIGLAV_PLUGIN_API *getBitmapNormalAlphaChannelIndexProc(
- TriglavPlugInOffscreenObject offscreenObject,
- TriglavPlugInInt* alphaChannelIndex);
以上就是离屏服务的 api,下篇将介绍属性服务相关内容。