aardio 文档

gdip.image 库模块帮助文档

gdip 成员列表 #

gdip.CloneImage #

$.api("GdipCloneImage","int(PTR img,ptr& cloneImage)")

gdip.GetAllPropertyItems #

$.api("GdipGetAllPropertyItems","int(PTR img,int totalBufferSize,int numProperties,struct& allItems)")

gdip.GetImageHeight #

$.api("GdipGetImageHeight","int(PTR img,int& Height)")

gdip.GetImageHorizontalResolution #

$.api("GdipGetImageHorizontalResolution","int(PTR img,float& resolution)")

gdip.GetImagePixelFormat #

$.api("GdipGetImagePixelFormat","int(PTR img,int& PixelFormat)")

gdip.GetImageThumbnail #

$.api("GdipGetImageThumbnail","int(PTR img,int w,int h,pointer& thumb,pointer callback,pointer callbackData )")

gdip.GetImageVerticalResolution #

$.api("GdipGetImageVerticalResolution","int(PTR img,float& resolution)")

gdip.GetImageWidth #

$.api("GdipGetImageWidth","int(PTR img,int& Width)")

gdip.GetPropertyCount #

$.api("GdipGetPropertyCount","int(PTR img,int& numOfProperty)")

gdip.GetPropertyIdList #

$.api("GdipGetPropertyIdList","int(PTR img,int numOfProperty,struct& list)")

gdip.GetPropertyItem #

$.api("GdipGetPropertyItem","int(PTR img,int propId,int propSize,string& buffer)")

gdip.GetPropertyItemSize #

$.api("GdipGetPropertyItemSize","int(PTR img,int propId,int& size)")

gdip.GetPropertySize #

$.api("GdipGetPropertySize","int(PTR img,int& totalBufferSize,int& numProperties)")

gdip.ImageGetFrameCount #

$.api("GdipImageGetFrameCount","int(PTR img,struct dimensionID,INT& count)")

gdip.ImageGetFrameDimensionsCount #

$.api("GdipImageGetFrameDimensionsCount","int(PTR img,int& count)")

gdip.ImageGetFrameDimensionsList #

$.api("GdipImageGetFrameDimensionsList","int(PTR img,struct& dimensionIDs,int count)")

gdip.ImageRotateFlip #

$.api("GdipImageRotateFlip","int(PTR img,int rfType)")

gdip.ImageSelectActiveFrame #

$.api("GdipImageSelectActiveFrame","int(PTR img,struct& dimensionID,int frameIndex)")

gdip.LoadImageFromFile #

$.api("GdipLoadImageFromFile","int(ustring FileName,pointer& Image)")

gdip.LoadImageFromStream #

$.api("GdipLoadImageFromStream","int(POINTER stream,pointer& Image)")

gdip.RemovePropertyItem #

$.api("GdipRemovePropertyItem","int(PTR img,int propId)")

gdip.SaveImageToFile #

$.api("GdipSaveImageToFile","int(PTR img,ustring FileName,struct clsidEncoder,struct encoderParams)")

gdip.SaveImageToStream #

$.api("GdipSaveImageToStream","int(PTR img,PTR stream,struct clsidEncoder,struct encoderParams)")

gdip.SetPropertyItem #

$.api("GdipSetPropertyItem","int(PTR img,struct& Item)")

gdip.image("字符串参数") #

创建GDI+L图片对象

gdip.image() #

返回对象:gdipimageObject

gdip.loadImageFromString(请输入图片数据) #

从内存字符串直接创建图像

gdip.encoder 成员列表 #

gdip.encoder.parameter("SaveFlag",{int v}) #

创建保存图像参数,用法参考函数源码

gdipExifItemObject 成员列表 #

gdipExifItemObject.length #

数据长度

gdipExifItemObject.number #

数值格式
如果是数组仅显示第一个数值
如果value为文本则number字段为空

gdipExifItemObject.propId #

属性 ID

gdipExifItemObject.text #

尝试转换为文本格式的值,
将对象转入 tostring 函数返回此字段。
此字段有可能是根据 value 在 _get 元方法中动态生成。

gdipExifItemObject.type #

数据类型

gdipExifItemObject.value #

原始数据值。
值可能为文本、buffer、或一个结构体。
如果是结构体,则数组值放在 array 字段里
如果 value 为文本或 buffer 则 number 字段为空

gdipExifItemObject.value.array #

数组值

gdipimageObject 成员列表 #

gdipimageObject.activeFrame #

当前帧索引
修改该属性请使用SelectActiveFrame函数

gdipimageObject.clone() #

复制图像

返回对象:gdipimageObject

gdipimageObject.createAnimation #

如果图像是一个动画,创建定时器执行动画
注意每个图像同时只能在一个窗口上创建动画
创建动画前自动删除之前创建的动画定时器
如果图像不是动画,此函数不执行任何操作
成功返回定时器ID

gdipimageObject.createAnimation(窗口对象,回调函数) #

在窗口上创建定时器,
每帧动画触发回调函数,
回调函数owner参数被设为参数@1指定的窗口对象

如果不指定控件,则默认指定为上次创建动画的控件,
如果不指定回调函数,则默认指定为控件的redrawTransparent函数

gdipimageObject.dispose() #

释放图像
此对象支持自动释放,不必手工调用此函数

gdipimageObject.eachFrame #

如果图像支持动画,则返回一个帧迭代器。
否则此函数返回 null。

gdipimageObject.eachFrame(loopCount) #

遍历动画帧。
每次调用帧迭代器切换到下一帧并返回当前帧所需延时,帧索引。
动画完成迭代器返回 null 。
可选用 @loopCount 参数指定循环所有帧的次数,0 为无限循环。
不指定参数则获取图像默认循环次数。

示例:

for delay,frame in bmp.eachFrame(1) {  
    bmp.save("/"+frame+".gif");  
}  

gdipimageObject.eachProperty() #

for( tagId,propertyItem in gdipimageObject.eachProperty() ){
     propertyItem./*遍历图像属性字段*/
}  

[返回对象:gdipExifItemObject](#gdipExifItemObject)

gdipimageObject.frameDimension #

当前分辨率GUID

gdipimageObject.getFrameDelays() #

返回多帧图像每帧延时数值组成的数组,
延时单位为厘秒,即0.01秒

gdipimageObject.getFrameDimensionsList() #

图像帧分辨率列表
该值是GUID数组

gdipimageObject.getGraphics() #

从图像获取画布

返回对象:gdipgraphicsObject

gdipimageObject.getLoopCount() #

获取动画循环次数,0为一直循环,
根据 GDI+ 的规则,循环次数为2会改为1,其他不变,
为不影响性能默认不处理这个问题

如果要处理,步骤如下:
1、读取循环次数如果为1就进行下一步
2、在GIF图像数据中搜索关键字"NETSCAPE2.0"
如果找到就将此图像的 $loopCount 属性赋值为2,
注意 plus 控件支持将加载好的GDI+图像作为参数

GIF动画循环次数一般不是0就是1,
其他数值基本无人使用,搞这么复杂是不必要的

gdipimageObject.getPixelFormat() #

返回像素格式

gdipimageObject.getPropertyIds() #

返回所有属性ID数组

gdipimageObject.getPropertyItem() #

返回对象:gdipExifItemObject

gdipimageObject.getPropertyItem(属性ID) #

返回字段

gdipimageObject.getResolution() #

返回分辨率xdpi,ydpi

gdipimageObject.getThumbnail() #

返回对象:gdipimageObject

gdipimageObject.getThumbnail(宽度,高度,是否保持比例) #

获取缩略图,
返回 gdip.image 对象.
宽度,高度指定新的像素大小,也可以用小于1大于0的小数指定缩放百分比.

gdipimageObject.height #

高度

gdipimageObject.isPlaying() #

是否正在播放动画

gdipimageObject.isValid() #

图像是否有效
dispose函数释放以后返回false

gdipimageObject.origHeight #

原始高度,
对于一个 gdip.image 对象会一直缓存第一次读取的值

gdipimageObject.origWidth #

原始宽度,
对于一个 gdip.image 对象会一直缓存第一次读取的值

gdipimageObject.removePropertyItem(属性ID) #

移除字段

gdipimageObject.rotateFlip(_GdipRotate指定翻转选项) #

翻转图片

gdipimageObject.save("字符串参数") #

保存图像
使用参数指定的文件路径或加载图片时的路径
根据后缀名自动设定格式,
可选在参数@3使用gdip.encoder.parameter数组指定保存参数

gdipimageObject.save("字符串参数",80) #

保存图像
使用参数指定的文件路径或加载图片时的路径
根据后缀名自动设定格式
jpg文件可使用第二个参数指定图像质量,
可选在参数@3使用gdip.encoder.parameter数组指定保存参数

gdipimageObject.saveAdd() #

添加当前图像到多帧图像

gdipimageObject.saveAdd(图像) #

添加其他gdip.image或gdip.bitmap对象到多帧图像,
可选使用参数2指定saveFlag,可选在参数@3使用gdip.encoder.parameter数组指定保存参数

gdipimageObject.saveAdd(图像路径) #

创建多帧图像,参数 @1 指定保存路径,
后续添加图像帧时,参数 @1 不能再指定路径。
在添加所有帧以后调用 saveFlush 函数保存文件。

gdipimageObject.saveToBuffer(后缀名,输出质量) #

保存图像到 buffer,返回 buffer 对象,
后缀名默认为"*.jpg",质量默认为100,
可选在参数@3使用gdip.encoder.parameter数组指定保存参数

gdipimageObject.saveToStream #

保存到内存流对象,
该函数成功返回值为流对象

gdipimageObject.saveToStream() #

返回对象:fsysStreamObject

gdipimageObject.saveToStream(流对象,后缀名,输出质量) #

流对象请使用 fsys.stream 创建
后缀名默认为"*.jpg",质量默认为100,
可选在参数@4使用gdip.encoder.parameter数组指定保存参数

gdipimageObject.selectActiveFrame(帧序号) #

设置当前动画帧

gdipimageObject.setFrameDelays() #

修改多帧图像每帧延时数值
参数必须是由数值组成的非空数组,
延时单位为厘秒,即0.01秒
必须在调用saveAdd以前设置

gdipimageObject.setPropertyItem(字段结构体) #

修改字段

gdipimageObject.stopAnimation() #

如果此图像已运行动画,则停止动画并返回 true

gdipimageObject.totalFrames #

动画帧总数
不是动画返回1

gdipimageObject.width #

宽度

Markdown 格式