00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef GR_COCOAIMAGE_H
00024 #define GR_COCOAIMAGE_H
00025
00026 #import <Cocoa/Cocoa.h>
00027
00028 #include "gr_Image.h"
00029
00030 struct Fatmap
00031 {
00032 Fatmap ();
00033 int width;
00034 int height;
00035
00036
00037 unsigned char * data;
00038 };
00039
00040 class GR_CocoaImage : public GR_RasterImage
00041 {
00042 public:
00043 GR_CocoaImage(const char* pszName);
00044 virtual ~GR_CocoaImage();
00045
00046 virtual bool convertToBuffer(UT_ByteBuf** ppBB) const;
00047 virtual bool convertFromBuffer(const UT_ByteBuf* pBB, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00048
00049 virtual GR_Image * createImageSegment(GR_Graphics * pG, const UT_Rect & rec);
00050 virtual bool hasAlpha (void) const;
00051 virtual bool isTransparentAt(UT_sint32 x, UT_sint32 y);
00052
00053
00054
00055 virtual GRType getType() const { return m_grtype; }
00056 virtual bool render(GR_Graphics *pGR, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00057
00058 void setFromImageRep(NSImageRep *imgRep);
00059 NSImage * getNSImage ()
00060 { return m_image; };
00061
00062 static NSImage * imageFromPNG (NSData * data, UT_uint32 & image_width, UT_uint32 & image_height);
00063
00064 private:
00065 NSImage* m_image;
00066 NSData* m_pngData;
00067
00068 GRType m_grtype;
00069
00070 bool _convertPNGFromBuffer(NSData* data, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00071
00072
00073 };
00074
00075 #endif