Alien-FreeImage

 view release on metacpan or  search on metacpan

src/Source/FreeImage/PSDParser.h  view on Meta::CPAN

	int _Format;			//! = 1 (kJpegRGB). Also supports kRawRGB (0).
	int _Width;				//! Width of thumbnail in pixels.
	int _Height;			//! Height of thumbnail in pixels.
	int _WidthBytes;		//! Padded row bytes as (width * bitspixel + 31) / 32 * 4.
	int _Size;				//! Total size as widthbytes * height * planes
	int _CompressedSize;	//! Size after compression. Used for consistentcy check. 
	short _BitPerPixel;		//! = 24. Bits per pixel.
	short _Planes;			//! = 1. Number of planes.
	FIBITMAP * _dib;		//! JFIF data as uncompressed dib. Note: For resource ID 1033 the data is in BGR format.
	
public:
	psdThumbnail();
	~psdThumbnail();
	FIBITMAP* getDib() { return _dib; }
	/**
	@return Returns the number of bytes read
	*/
	int Read(FreeImageIO *io, fi_handle handle, int iResourceSize, bool isBGR);

private:
	psdThumbnail(const psdThumbnail&);
	psdThumbnail& operator=(const psdThumbnail&);
};

class psdICCProfile {
public:
	int _ProfileSize;
	BYTE * _ProfileData;
public:
	psdICCProfile();
	~psdICCProfile();
	void clear();
	/**
	@return Returns the number of bytes read
	*/
	int Read(FreeImageIO *io, fi_handle handle, int size);
};

/**
PSD loader
*/
class psdParser {
private:
	psdHeaderInfo			_headerInfo;
	psdColourModeData		_colourModeData;
	psdResolutionInfo		_resolutionInfo;
	psdResolutionInfo_v2	_resolutionInfo_v2;
	psdDisplayInfo			_displayInfo;
	psdThumbnail			_thumbnail;
	psdICCProfile			_iccProfile;

	short _ColourCount;
	short _TransparentIndex;
	int _GlobalAngle;
	bool _bResolutionInfoFilled;
	bool _bResolutionInfoFilled_v2;
	bool _bDisplayInfoFilled;
	bool _bThumbnailFilled;
	bool _bCopyright;

	int _fi_flags;
	int _fi_format_id;
	
private:
	/**	Actually ignore it */
	bool ReadLayerAndMaskInfoSection(FreeImageIO *io, fi_handle handle);
	FIBITMAP* ReadImageData(FreeImageIO *io, fi_handle handle);

public:
	psdParser();
	~psdParser();
	FIBITMAP* Load(FreeImageIO *io, fi_handle handle, int s_format_id, int flags=0);
	/** Also used by the TIFF plugin */
	bool ReadImageResources(FreeImageIO *io, fi_handle handle, LONG length=0);
	/** Used by the TIFF plugin */
	FIBITMAP* GetThumbnail() {
		return _thumbnail.getDib();
	}
};

#endif // PSDPARSER_H



( run in 1.228 second using v1.01-cache-2.11-cpan-56fb94df46f )