adsk::libPSD Namespace Reference

adsk::libPSD Namespace Reference

Classes

struct  AdditionalLayerInfo
 
struct  BlendChannelInfo
 
class  ChannelInfo
 
struct  IMAGERESOURCES
 
struct  LAYERSTATE
 
class  LRect
 
struct  PSD_FILE_HEADER
 
class  PSDFileMeta
 The PSDFileMeta object contains meta data about the psd file, such header information, the number of layers, etc... More...
 
class  PSDLayerMeta
 The PSDLayerMeta object contains informations about a layer. More...
 
struct  RESOLUTIONINFO
 
struct  SectionDividerSetting
 

Enumerations

enum  PSDBlendMode {
  blendNORMAL = 0, blendMULTIPLY, blendDARKEN, blendDIFFERENCE,
  blendEXCLUSION, blendHARDLIGHT, blendCOLORDODGE, blendLIGHTEN,
  blendSCREEN, blendCOLORBURN, blendOVERLAY, blendHUE,
  blendSATURATION, blendLUMINOSITY, blendCOLOR, blendDISSOLVE,
  blendSOFTLIGHT, blendLINEARDODGE, blendVIVIDLIGHT, blendLINEARBURN,
  blendLINEARLIGHT, blendPINLIGHT, blendHARDMIX, blendDARKERCOLOR,
  blendLIGHTERCOLOR, blendSUBTRACT, blendDIVIDE, blendUNKNOW
}
 
enum  PSDError {
  PSD_SUCCESS = 0, PSD_FAIL, PSD_MEMORY_FAILURE, PSD_ERROR_OPENING_FILE,
  PSD_FOPEN_FAIL, PSD_FILE_NOT_PSD, PSD_READ_ERROR, PSD_WRITE_ERROR,
  PSD_WRONG_VERSION, PSD_NO_INSTANCE, PSD_INDEX_OUT_OF_RANGE, PSD_FILE_HEADER_NOT_VALID,
  PSD_PSDFILE_ERROR, PSD_INVALID_LAYER, PSD_CHANNEL_INDEX_OUT_OF_RANGE, PSD_LAYER_INDEX_OUT_OF_RANGE,
  PSD_DECOMPRESSION_ERROR, PSD_BITDEPTH_ERROR
}
 
enum  CompressionMethod {
  PSD_COMPRESSION_NONE = -1, PSD_COMPRESSION_RAW, PSD_COMPRESSION_RLE, PSD_COMPRESSION_ZIP,
  PSD_COMPRESSION_ZIP_PREDICTION
}
 
enum  layerType { LAYER_NORMAL = 0, LAYER_SET_OPEN, LAYER_SET_CLOSED, LAYER_DIVIDER }
 

Functions

PSDFile MBDLL_DECLPSDOpen (const QString &fileName, bool write=false)
 Open a Photoshop(PSD) file and fill internally meta data (file meta and layers meta data). More...
 
PSDError MBDLL_DECL PSDGetLastError (PSDFile *psdFile)
 Obtain the last status of libPSD. More...
 
const MBDLL_DECL PSDFileMetaPSDGetFileMeta (const PSDFile *psdFile)
 Get the file metadata of a PSD file. More...
 
bool MBDLL_DECL PSDSetFileMeta (PSDFile *psdFile, const PSDFileMeta *psdFileMeta)
 Set the file metadata of psdFile. More...
 
const MBDLL_DECL PSDLayerMetaPSDGetLayerMeta (const PSDFile *psdFile, unsigned int layerIndex)
 Get the layer meta data for layerIndex of psdFile object. More...
 
void MBDLL_DECL PSDSetLayerMeta (PSDFile *psdFile, unsigned int layerIndex, PSDLayerMeta *psdLayerMeta)
 Set the layer meta data for layerIndex of psdFile object. More...
 
bool MBDLL_DECL PSDReadChannelImageData (PSDFile *psdFile, unsigned int layerIndex, unsigned int channelIndex, void *buffer, size_t bufferSize)
 Read the channel image data for this layer and this channel of psdFile object. More...
 
bool MBDLL_DECL PSDWriteChannelImageData (PSDFile *psdFile, unsigned int layerIndex, unsigned int channelIndex, void *buffer, size_t bufferSize)
 
bool MBDLL_DECL PSDReadChannelImageData (PSDFile *psdFile, void *buffer, size_t bufferSize)
 
bool MBDLL_DECL PSDReadCompositeImageData (PSDFile *psdFile, unsigned int imageWidth, unsigned int imageHeight, void *buffer, size_t bufferSize)
 
bool MBDLL_DECL PSDWriteCompositeImageData (PSDFile *psdFile, unsigned int imageWidth, unsigned int imageHeight, CompressionMethod compressMethod, void *buffer, size_t bufferSize)
 
bool MBDLL_DECL PSDWrite4ChanCompositeImageData (PSDFile *psdFile, unsigned int imageWidth, unsigned int imageHeight, CompressionMethod compressMethod, void **ARGBPixels)
 
void MBDLL_DECL PSDClose (PSDFile *psdFile)
 Close the psdFile object and free all private data. More...
 
bool MBDLL_DECL PSDBlendLayers (unsigned char *rSrc, unsigned char *gSrc, unsigned char *bSrc, unsigned char *aSrc, float glbOpacity, LRect inRectLayer1, int blendMode, unsigned int inWidth, unsigned int inHeight, unsigned char *&rDst, unsigned char *&gDst, unsigned char *&bDst, unsigned char *&aDst)
 BlendLayers is a helper function that blend 2 layers based on the src's blend mode. More...
 
void MBDLL_DECL PSDInterleaveImageData (int nPixels, const unsigned char *r, const unsigned char *g, const unsigned char *b, const unsigned char *a, unsigned int *target, bool multAlpha=true)
 InterleaveImageData takes the 4 seperate RGBA planes and interleaves them into a single RGBA image – optionally multiplying the RGB by the alpha. More...
 
void MBDLL_DECL PSDInterleaveImageData16_16 (int nPixels, const unsigned short *r, const unsigned short *g, const unsigned short *b, const unsigned short *a, unsigned short *target, bool multAlpha=true)
 InterleaveImageData16 takes the 4 separate 16 bit RGBA planes and interleaves them into a single 16 bit per channel RGBA image – optionally multiplying the RGB by the alpha. More...
 
void MBDLL_DECL PSDInterleaveImageData32_32 (int nPixels, const float *r, const float *g, const float *b, const float *a, float *target, bool multAlpha=true)
 InterleaveImageData32 takes the 4 separate 32 bit float RGBA planes and interleaves them into a single 32 bit float per channel RGBA image – optionally multiplying the RGB by the alpha. More...
 
void MBDLL_DECL PSDInterleaveImageData16 (int nPixels, const unsigned short *r, const unsigned short *g, const unsigned short *b, const unsigned short *a, unsigned int *target, bool multAlpha=true)
 InterleaveImageData16 takes the 4 separate 16 bit RGBA planes and interleaves them into a single 8 bit per channel RGBA image – optionally multiplying the RGB by the alpha. More...
 
void MBDLL_DECL PSDInterleaveImageData32 (int nPixels, const float *r, const float *g, const float *b, const float *a, unsigned int *target, bool multAlpha=true)
 InterleaveImageData32 takes the 4 separate 32 bit float RGBA planes and interleaves them into a single 8 bit per channel RGBA image – optionally multiplying the RGB by the alpha. More...
 

Enumeration Type Documentation

Enumerator
blendNORMAL 
blendMULTIPLY 
blendDARKEN 
blendDIFFERENCE 
blendEXCLUSION 
blendHARDLIGHT 
blendCOLORDODGE 
blendLIGHTEN 
blendSCREEN 
blendCOLORBURN 
blendOVERLAY 
blendHUE 
blendSATURATION 
blendLUMINOSITY 
blendCOLOR 
blendDISSOLVE 
blendSOFTLIGHT 
blendLINEARDODGE 
blendVIVIDLIGHT 
blendLINEARBURN 
blendLINEARLIGHT 
blendPINLIGHT 
blendHARDMIX 
blendDARKERCOLOR 
blendLIGHTERCOLOR 
blendSUBTRACT 
blendDIVIDE 
blendUNKNOW 

Definition at line 34 of file LibPSD.h.

35 {
36  blendNORMAL = 0,
47  blendHUE,
50  blendCOLOR,
58  blendHARDMIX,
62  blendDIVIDE,
64 };
enum PSDError
Enumerator
PSD_SUCCESS 
PSD_FAIL 
PSD_MEMORY_FAILURE 
PSD_ERROR_OPENING_FILE 
PSD_FOPEN_FAIL 
PSD_FILE_NOT_PSD 
PSD_READ_ERROR 
PSD_WRITE_ERROR 
PSD_WRONG_VERSION 
PSD_NO_INSTANCE 
PSD_INDEX_OUT_OF_RANGE 
PSD_FILE_HEADER_NOT_VALID 
PSD_PSDFILE_ERROR 
PSD_INVALID_LAYER 
PSD_CHANNEL_INDEX_OUT_OF_RANGE 
PSD_LAYER_INDEX_OUT_OF_RANGE 
PSD_DECOMPRESSION_ERROR 
PSD_BITDEPTH_ERROR 

Definition at line 66 of file LibPSD.h.

Enumerator
PSD_COMPRESSION_NONE 
PSD_COMPRESSION_RAW 
PSD_COMPRESSION_RLE 
PSD_COMPRESSION_ZIP 
PSD_COMPRESSION_ZIP_PREDICTION 

Definition at line 89 of file LibPSD.h.

enum layerType
Enumerator
LAYER_NORMAL 
LAYER_SET_OPEN 
LAYER_SET_CLOSED 
LAYER_DIVIDER 

Definition at line 105 of file LibPSD.h.

Function Documentation

PSDFile MBDLL_DECL* adsk::libPSD::PSDOpen ( const QString fileName,
bool  write = false 
)

Open a Photoshop(PSD) file and fill internally meta data (file meta and layers meta data).

Parameters
utf8Namethe file name of the PSD file.
writeset to true to open the file for writing
Returns
PSDFile the private object represending this open PSD file. Threat this as a pointer to blind data. Do NOT directly access any data members or attempt to dereference this pointer.
PSDError MBDLL_DECL adsk::libPSD::PSDGetLastError ( PSDFile *  psdFile)

Obtain the last status of libPSD.

Parameters
psdFilethe private object represending this open PSD file.
Returns
PSDError the current error/warning status.
const MBDLL_DECL PSDFileMeta* adsk::libPSD::PSDGetFileMeta ( const PSDFile *  psdFile)

Get the file metadata of a PSD file.

Parameters
psdFilethe private object represending this open PSD file.
Returns
PSDFileMeta the file meta data that contains basic information like the number of layers, etc...
bool MBDLL_DECL adsk::libPSD::PSDSetFileMeta ( PSDFile *  psdFile,
const PSDFileMeta psdFileMeta 
)

Set the file metadata of psdFile.

Parameters
psdFilethe private object represending this open PSD file.
psdFileMetathe file meta data that contains basic information like the number of layers, etc... This information must be filly filled in before calling this function – it causes the PSD file header to be written
const MBDLL_DECL PSDLayerMeta* adsk::libPSD::PSDGetLayerMeta ( const PSDFile *  psdFile,
unsigned int  layerIndex 
)

Get the layer meta data for layerIndex of psdFile object.

Parameters
psdFilethe private object represending this open PSD file.
layerIndexthe layer index.
Returns
PSDLayerMeta the layer meta data that contains all layers data, like number of channels, etc...
void MBDLL_DECL adsk::libPSD::PSDSetLayerMeta ( PSDFile *  psdFile,
unsigned int  layerIndex,
PSDLayerMeta psdLayerMeta 
)

Set the layer meta data for layerIndex of psdFile object.

Parameters
psdFilethe private object represending this open PSD file.
layerIndexthe layer index.
psdLayerMetathe layer meta data that contains all layers data, like number of channels, etc...
bool MBDLL_DECL adsk::libPSD::PSDReadChannelImageData ( PSDFile *  psdFile,
unsigned int  layerIndex,
unsigned int  channelIndex,
void buffer,
size_t  bufferSize 
)

Read the channel image data for this layer and this channel of psdFile object.

Parameters
psdFilethe private object represending this open PSD file.
layerIndexthe layer index value.
channelIndexthe channel index value.
bufferthe buffer will be filled with image data. Caller responsible for memory management of this buffer.
bufferSizethe size of the buffer. ( layer's width * layer's height * sizeof(char) )
Returns
bool true, if the call succeeded. False otherwise ( check with PSDGetLastError() for reason)
bool MBDLL_DECL adsk::libPSD::PSDWriteChannelImageData ( PSDFile *  psdFile,
unsigned int  layerIndex,
unsigned int  channelIndex,
void buffer,
size_t  bufferSize 
)
bool MBDLL_DECL adsk::libPSD::PSDReadChannelImageData ( PSDFile *  psdFile,
void buffer,
size_t  bufferSize 
)
bool MBDLL_DECL adsk::libPSD::PSDReadCompositeImageData ( PSDFile *  psdFile,
unsigned int  imageWidth,
unsigned int  imageHeight,
void buffer,
size_t  bufferSize 
)
bool MBDLL_DECL adsk::libPSD::PSDWriteCompositeImageData ( PSDFile *  psdFile,
unsigned int  imageWidth,
unsigned int  imageHeight,
CompressionMethod  compressMethod,
void buffer,
size_t  bufferSize 
)
bool MBDLL_DECL adsk::libPSD::PSDWrite4ChanCompositeImageData ( PSDFile *  psdFile,
unsigned int  imageWidth,
unsigned int  imageHeight,
CompressionMethod  compressMethod,
void **  ARGBPixels 
)
void MBDLL_DECL adsk::libPSD::PSDClose ( PSDFile *  psdFile)

Close the psdFile object and free all private data.

Regardless of error status, this function needs to be called when done with a file, otherwise memory will leak.

Parameters
psdFilethe private object represending this open PSD file.
bool MBDLL_DECL adsk::libPSD::PSDBlendLayers ( unsigned char *  rSrc,
unsigned char *  gSrc,
unsigned char *  bSrc,
unsigned char *  aSrc,
float  glbOpacity,
LRect  inRectLayer1,
int  blendMode,
unsigned int  inWidth,
unsigned int  inHeight,
unsigned char *&  rDst,
unsigned char *&  gDst,
unsigned char *&  bDst,
unsigned char *&  aDst 
)

BlendLayers is a helper function that blend 2 layers based on the src's blend mode.

In order to this to work, you need pass a Src and Dst RGBA channels.

Parameters
rSrcThe Red channel source.
gSrcThe green channel source.
bSrcThe blue channel source.
aSrcThe alpha channel source.
glbOpacityThe Opacity of the layer that will blend Src with
inRectLayer1The Rect of the Src Layer
blendModeThe Blend mode of Src Layer
inWidthThe Width of the image
inHeightThe Height of the image
rDstThe red channel destination
gDstThe green channel destination
bDstThe blue channel destination
aDstThe alpha channel destination, if NULL, it will be allocated by the function, use free(aDst) when done.
void MBDLL_DECL adsk::libPSD::PSDInterleaveImageData ( int  nPixels,
const unsigned char *  r,
const unsigned char *  g,
const unsigned char *  b,
const unsigned char *  a,
unsigned int target,
bool  multAlpha = true 
)

InterleaveImageData takes the 4 seperate RGBA planes and interleaves them into a single RGBA image – optionally multiplying the RGB by the alpha.

Parameters
nPixelsThe count of the pixels to be processed
rPointer to the Red plane
gPointer to the Green plane
bPointer to the Blue plane
aPointer to the Alpha plane (can be null – then all alphas are assumed to be opaque)
targetPointer to the target RGBA image
multAlphatrue if this function is to multiply the aAlpha into the RGB channels (defaults to true)
Note
on little endian machines the resulting channel order will be RGBA in memory (and therefore ABGR in a register – ie. A is in the most significant 8 bits). On big endian machines, the order will be ABGR in both memory and register.
void MBDLL_DECL adsk::libPSD::PSDInterleaveImageData16_16 ( int  nPixels,
const unsigned short *  r,
const unsigned short *  g,
const unsigned short *  b,
const unsigned short *  a,
unsigned short *  target,
bool  multAlpha = true 
)

InterleaveImageData16 takes the 4 separate 16 bit RGBA planes and interleaves them into a single 16 bit per channel RGBA image – optionally multiplying the RGB by the alpha.

Parameters
nPixelsThe count of the pixels to be processed
rPointer to the Red plane
gPointer to the Green plane
bPointer to the Blue plane
aPointer to the Alpha plane (can be null – then all alphas are assumed to be opaque)
targetPointer to the target RGBA image
multAlphatrue if this function is to multiply the aAlpha into the RGB channels (defaults to true)
Note
on little endian machines the resulting channel order will be RGBA in memory (and therefore ABGR in a register – ie. A is in the most significant 8 bits). On big endian machines, the order will be ABGR in both memory and register.
void MBDLL_DECL adsk::libPSD::PSDInterleaveImageData32_32 ( int  nPixels,
const float *  r,
const float *  g,
const float *  b,
const float *  a,
float *  target,
bool  multAlpha = true 
)

InterleaveImageData32 takes the 4 separate 32 bit float RGBA planes and interleaves them into a single 32 bit float per channel RGBA image – optionally multiplying the RGB by the alpha.

Parameters
nPixelsThe count of the pixels to be processed
rPointer to the Red plane
gPointer to the Green plane
bPointer to the Blue plane
aPointer to the Alpha plane (can be null – then all alphas are assumed to be opaque)
targetPointer to the target RGBA image
multAlphatrue if this function is to multiply the aAlpha into the RGB channels (defaults to true)
Note
on little endian machines the resulting channel order will be RGBA in memory (and therefore ABGR in a register – ie. A is in the most significant 8 bits). On big endian machines, the order will be ABGR in both memory and register.
void MBDLL_DECL adsk::libPSD::PSDInterleaveImageData16 ( int  nPixels,
const unsigned short *  r,
const unsigned short *  g,
const unsigned short *  b,
const unsigned short *  a,
unsigned int target,
bool  multAlpha = true 
)

InterleaveImageData16 takes the 4 separate 16 bit RGBA planes and interleaves them into a single 8 bit per channel RGBA image – optionally multiplying the RGB by the alpha.

Parameters
nPixelsThe count of the pixels to be processed
rPointer to the Red plane
gPointer to the Green plane
bPointer to the Blue plane
aPointer to the Alpha plane (can be null – then all alphas are assumed to be opaque)
targetPointer to the target RGBA image
multAlphatrue if this function is to multiply the aAlpha into the RGB channels (defaults to true)
Note
on little endian machines the resulting channel order will be RGBA in memory (and therefore ABGR in a register – ie. A is in the most significant 8 bits). On big endian machines, the order will be ABGR in both memory and register.
void MBDLL_DECL adsk::libPSD::PSDInterleaveImageData32 ( int  nPixels,
const float *  r,
const float *  g,
const float *  b,
const float *  a,
unsigned int target,
bool  multAlpha = true 
)

InterleaveImageData32 takes the 4 separate 32 bit float RGBA planes and interleaves them into a single 8 bit per channel RGBA image – optionally multiplying the RGB by the alpha.

Parameters
nPixelsThe count of the pixels to be processed
rPointer to the Red plane
gPointer to the Green plane
bPointer to the Blue plane
aPointer to the Alpha plane (can be null – then all alphas are assumed to be opaque)
targetPointer to the target RGBA image
multAlphatrue if this function is to multiply the aAlpha into the RGB channels (defaults to true)
Note
on little endian machines the resulting channel order will be RGBA in memory (and therefore ABGR in a register – ie. A is in the most significant 8 bits). On big endian machines, the order will be ABGR in both memory and register.