- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Namespace List
- Namespace Members

Classes | Enumerations | Functions

# adsk::libPSD Namespace Reference

## Classes
struct | BlendChannelInfo
struct | SectionDividerSetting
struct | AdditionalLayerInfo
struct | RESOLUTIONINFO
struct | LAYERSTATE
struct | IMAGERESOURCES
struct | PSD_FILE_HEADER
class | LRect
class | ChannelInfo
class | PSDLayerMeta
| The PSDLayerMeta object contains informations about a layer. More...
class | PSDFileMeta
| The PSDFileMeta object contains meta data about the psd file, such header information, the number of layers, etc... More...
## 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_DECL * | PSDOpen (const QString &fileName, bool write=false)
| Open a Photoshop(PSD) file and fill internally meta data (file meta and layers meta data).
PSDError MBDLL_DECL | PSDGetLastError (PSDFile *psdFile)
| Obtain the last status of libPSD.
const MBDLL_DECL PSDFileMeta * | PSDGetFileMeta (const PSDFile *psdFile)
| Get the file metadata of a PSD file.
bool MBDLL_DECL | PSDSetFileMeta (PSDFile *psdFile, const PSDFileMeta *psdFileMeta)
| Set the file metadata of psdFile.
const MBDLL_DECL PSDLayerMeta * | PSDGetLayerMeta (const PSDFile *psdFile, unsigned int layerIndex)
| Get the layer meta data for layerIndex of psdFile object.
void MBDLL_DECL | PSDSetLayerMeta (PSDFile *psdFile, unsigned int layerIndex, PSDLayerMeta *psdLayerMeta)
| Set the layer meta data for layerIndex of psdFile object.
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.
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.
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.
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.
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.
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.
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.
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.

## Enumeration Type Documentation

enum PSDBlendMode

Search for all occurrences

Enumerator:

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

Definition at line 34 of file LibPSD.h.

    {
        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

Search for all occurrences

Enumerator:

  PSD_SUCCESS | Search for all occurrences
  PSD_FAIL | Search for all occurrences
  PSD_MEMORY_FAILURE | Search for all occurrences
  PSD_ERROR_OPENING_FILE | Search for all occurrences
  PSD_FOPEN_FAIL | Search for all occurrences
  PSD_FILE_NOT_PSD | Search for all occurrences
  PSD_READ_ERROR | Search for all occurrences
  PSD_WRITE_ERROR | Search for all occurrences
  PSD_WRONG_VERSION | Search for all occurrences
  PSD_NO_INSTANCE | Search for all occurrences
  PSD_INDEX_OUT_OF_RANGE | Search for all occurrences
  PSD_FILE_HEADER_NOT_VALID | Search for all occurrences
  PSD_PSDFILE_ERROR | Search for all occurrences
  PSD_INVALID_LAYER | Search for all occurrences
  PSD_CHANNEL_INDEX_OUT_OF_RANGE | Search for all occurrences
  PSD_LAYER_INDEX_OUT_OF_RANGE | Search for all occurrences
  PSD_DECOMPRESSION_ERROR | Search for all occurrences
  PSD_BITDEPTH_ERROR | Search for all occurrences

Definition at line 66 of file LibPSD.h.

                  {
        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

Search for all occurrences

Enumerator:

  PSD_COMPRESSION_NONE | Search for all occurrences
  PSD_COMPRESSION_RAW | Search for all occurrences
  PSD_COMPRESSION_RLE | Search for all occurrences
  PSD_COMPRESSION_ZIP | Search for all occurrences
  PSD_COMPRESSION_ZIP_PREDICTION | Search for all occurrences

Definition at line 89 of file LibPSD.h.

    {
        PSD_COMPRESSION_NONE = -1,
        PSD_COMPRESSION_RAW,
        PSD_COMPRESSION_RLE,
        PSD_COMPRESSION_ZIP,
        PSD_COMPRESSION_ZIP_PREDICTION
    };

enum layerType

Search for all occurrences

Enumerator:

  LAYER_NORMAL | Search for all occurrences
  LAYER_SET_OPEN | Search for all occurrences
  LAYER_SET_CLOSED | Search for all occurrences
  LAYER_DIVIDER | Search for all occurrences

Definition at line 105 of file LibPSD.h.

                   { LAYER_NORMAL = 0,
                     LAYER_SET_OPEN,
                     LAYER_SET_CLOSED,
                     LAYER_DIVIDER
    };

## Function Documentation

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

Search for all occurrences

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

Parameters:

  utf8Name | the file name of the PSD file.
  write | set 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 | ) |

Search for all occurrences

Obtain the last status of libPSD.

Parameters:

  psdFile | the private object represending this open PSD file.

Returns:
  PSDError the current error/warning status.

const MBDLL_DECL PSDFileMeta* adsk::libPSD::PSDGetFileMeta | ( | const PSDFile * | psdFile | ) |

Search for all occurrences

Get the file metadata of a PSD file.

Parameters:

  psdFile | the 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
| ) |  |

Search for all occurrences

Set the file metadata of psdFile.

Parameters:

  psdFile | the private object represending this open PSD file.
  psdFileMeta | the 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
| ) |  |

Search for all occurrences

Get the layer meta data for layerIndex of psdFile object.

Parameters:

  psdFile | the private object represending this open PSD file.
  layerIndex | the 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
| ) |  |

Search for all occurrences

Set the layer meta data for layerIndex of psdFile object.

Parameters:

  psdFile | the private object represending this open PSD file.
  layerIndex | the layer index.
  psdLayerMeta | the 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
| ) |  |

Search for all occurrences

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

Parameters:

  psdFile | the private object represending this open PSD file.
  layerIndex | the layer index value.
  channelIndex | the channel index value.
  buffer | the buffer will be filled with image data. Caller responsible for memory management of this buffer.
  bufferSize | the 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
| ) |  |

Search for all occurrences

bool MBDLL_DECL adsk::libPSD::PSDReadChannelImageData | ( | PSDFile * | psdFile,
|  | void * | buffer,
|  | size_t | bufferSize
| ) |  |

Search for all occurrences

bool MBDLL_DECL adsk::libPSD::PSDReadCompositeImageData | ( | PSDFile * | psdFile,
|  | unsigned int | imageWidth,
|  | unsigned int | imageHeight,
|  | void * | buffer,
|  | size_t | bufferSize
| ) |  |

Search for all occurrences

bool MBDLL_DECL adsk::libPSD::PSDWriteCompositeImageData | ( | PSDFile * | psdFile,
|  | unsigned int | imageWidth,
|  | unsigned int | imageHeight,
|  | CompressionMethod | compressMethod,
|  | void * | buffer,
|  | size_t | bufferSize
| ) |  |

Search for all occurrences

bool MBDLL_DECL adsk::libPSD::PSDWrite4ChanCompositeImageData | ( | PSDFile * | psdFile,
|  | unsigned int | imageWidth,
|  | unsigned int | imageHeight,
|  | CompressionMethod | compressMethod,
|  | void ** | ARGBPixels
| ) |  |

Search for all occurrences

void MBDLL_DECL adsk::libPSD::PSDClose | ( | PSDFile * | psdFile | ) |

Search for all occurrences

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:

  psdFile | the 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
| ) |  |

Search for all occurrences

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:

  rSrc | The Red channel source.
  gSrc | The green channel source.
  bSrc | The blue channel source.
  aSrc | The alpha channel source.
  glbOpacity | The Opacity of the layer that will blend Src with
  inRectLayer1 | The Rect of the Src Layer
  blendMode | The Blend mode of Src Layer
  inWidth | The Width of the image
  inHeight | The Height of the image
  rDst | The red channel destination
  gDst | The green channel destination
  bDst | The blue channel destination
  aDst | The 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`
| ) |  |

Search for all occurrences

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

Parameters:

  nPixels | The count of the pixels to be processed
  r | Pointer to the Red plane
  g | Pointer to the Green plane
  b | Pointer to the Blue plane
  a | Pointer to the Alpha plane (can be null -- then all alphas are assumed to be opaque)
  target | Pointer to the target RGBA image
  multAlpha | true 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`
| ) |  |

Search for all occurrences

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:

  nPixels | The count of the pixels to be processed
  r | Pointer to the Red plane
  g | Pointer to the Green plane
  b | Pointer to the Blue plane
  a | Pointer to the Alpha plane (can be null -- then all alphas are assumed to be opaque)
  target | Pointer to the target RGBA image
  multAlpha | true 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`
| ) |  |

Search for all occurrences

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:

  nPixels | The count of the pixels to be processed
  r | Pointer to the Red plane
  g | Pointer to the Green plane
  b | Pointer to the Blue plane
  a | Pointer to the Alpha plane (can be null -- then all alphas are assumed to be opaque)
  target | Pointer to the target RGBA image
  multAlpha | true 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`
| ) |  |

Search for all occurrences

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:

  nPixels | The count of the pixels to be processed
  r | Pointer to the Red plane
  g | Pointer to the Green plane
  b | Pointer to the Blue plane
  a | Pointer to the Alpha plane (can be null -- then all alphas are assumed to be opaque)
  target | Pointer to the target RGBA image
  multAlpha | true 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`
| ) |  |

Search for all occurrences

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:

  nPixels | The count of the pixels to be processed
  r | Pointer to the Red plane
  g | Pointer to the Green plane
  b | Pointer to the Blue plane
  a | Pointer to the Alpha plane (can be null -- then all alphas are assumed to be opaque)
  target | Pointer to the target RGBA image
  multAlpha | true 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.