ZFFramework
 
Loading...
Searching...
No Matches
ZFUIImageIO.h File Reference

common image load logic More...

#include "ZFUIImage.h"

Go to the source code of this file.

Macros

#define ZFUIImageSerializeType_ZFUIImageFromInput
 see ZFUIIMAGE_SERIALIZE_TYPE_DEFINE
 
#define ZFSerializableKeyword_ZFUIImageFromInput_imageData
 keyword for serialize
 
#define ZFUIImageSerializeType_ZFUIImageInFrame
 see ZFUIIMAGE_SERIALIZE_TYPE_DEFINE
 
#define ZFSerializableKeyword_ZFUIImageInFrame_ref
 keyword for serialize
 
#define ZFSerializableKeyword_ZFUIImageInFrame_refFrame
 keyword for serialize
 
#define ZFUIImageSerializeType_ZFUIImageFromColor
 see ZFUIIMAGE_SERIALIZE_TYPE_DEFINE
 
#define ZFSerializableKeyword_ZFUIImageFromColor_color
 keyword for serialize
 
#define ZFSerializableKeyword_ZFUIImageFromColor_size
 keyword for serialize
 

Functions

zfautoT< ZFUIImageZFUIImageFromBase64 (const ZFInput &inputCallback)
 load image from base64 data
 
zfbool ZFUIImageToBase64 (const ZFOutput &outputCallback, ZFUIImage *image)
 save image to base64 data
 
zfautoT< ZFUIImageZFUIImageFromInput (const ZFInput &inputCallback)
 load image from file
 
zfbool ZFUIImageFromInputT (ZFUIImage *ret, const ZFInput &inputCallback)
 see ZFUIImageFromInput
 
zfbool ZFUIImageToOutput (const ZFOutput &outputCallback, ZFUIImage *image)
 save image to file
 
zfautoT< ZFUIImageZFUIImageScale (ZFUIImage *image, const ZFUISize &newSize)
 scale and return the newly created scaled image
 
zfautoT< ZFUIImageZFUIImageInFrame (ZFUIImage *image, const ZFUIRect &frame)
 clip an exist image and sharing low level data if possible
 
zfbool ZFUIImageInFrameT (ZFUIImage *ret, ZFUIImage *image, const ZFUIRect &frame)
 see ZFUIImageInFrame
 
zfautoT< ZFUIImageZFUIImageFromNativeImage (void *nativeImage, zfbool retainNativeImage=(_ZFT_t_zftrue))
 create image from native image
 
zfautoT< ZFUIImageZFUIImageFromColor (const ZFUIColor &color, const ZFUISize &size=(ZFUISizeZero()))
 load image from color
 
zfbool ZFUIImageFromColorT (ZFUIImage *ret, const ZFUIColor &color, const ZFUISize &size=(ZFUISizeZero()))
 see ZFUIImageFromColor
 

Detailed Description

common image load logic

Macro Definition Documentation

◆ ZFUIImageSerializeType_ZFUIImageFromInput

#define ZFUIImageSerializeType_ZFUIImageFromInput

see ZFUIIMAGE_SERIALIZE_TYPE_DEFINE

serializable data:

<ZFUIImage imageType="ZFUIImageFromInput">
<ZFCallback category="imageData" ... /> // callback serialization, see #ZFCALLBACK_SERIALIZE_TYPE_DEFINE
callback used by ZFFramework
Definition ZFCallback.h:96
image storage
Definition ZFUIImage.h:30

◆ ZFUIImageSerializeType_ZFUIImageInFrame

#define ZFUIImageSerializeType_ZFUIImageInFrame

see ZFUIIMAGE_SERIALIZE_TYPE_DEFINE

serializable data:

imageType="ZFUIImageInFrame"
refFrame="ZFUIRect"
>
<ZFUIImage category="ref" ... />

◆ ZFUIImageSerializeType_ZFUIImageFromColor

#define ZFUIImageSerializeType_ZFUIImageFromColor

see ZFUIIMAGE_SERIALIZE_TYPE_DEFINE

serializable data:

imageType="ZFUIImageFromColor"
color="ZFUIColor" // optional, transparent by default
size="ZFUISize" // optional, (1, 1) by default
>

Function Documentation

◆ ZFUIImageFromBase64()

zfautoT< ZFUIImage > ZFUIImageFromBase64 ( const ZFInput & inputCallback)
extern

load image from base64 data

Note
this method has no cache logic

◆ ZFUIImageToOutput()

zfbool ZFUIImageToOutput ( const ZFOutput & outputCallback,
ZFUIImage * image )
extern

save image to file

Note
save ZFUIImage::nativeImage to file, the ZFUIImage::imageStateImpl is not processed, you may use ZFObjectToData to serialize the image object

◆ ZFUIImageScale()

zfautoT< ZFUIImage > ZFUIImageScale ( ZFUIImage * image,
const ZFUISize & newSize )
extern

scale and return the newly created scaled image

if the source image have nine patch, scale would use the nine patch setting
return null if source image or newSize invalid
this method would create a new image even if size not changed

◆ ZFUIImageInFrame()

zfautoT< ZFUIImage > ZFUIImageInFrame ( ZFUIImage * image,
const ZFUIRect & frame )
extern

clip an exist image and sharing low level data if possible

Note
this method has no cache logic
see ZFUIImage::imageScale for more info

◆ ZFUIImageFromColor()

zfautoT< ZFUIImage > ZFUIImageFromColor ( const ZFUIColor & color,
const ZFUISize & size = (ZFUISizeZero()) )
extern

load image from color

invalid size is automatically convert to 1

Note
this method has no cache logic