Go to the documentation of this file.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 #include <cairo.h>
00027 #include <Cocoa/Cocoa.h>
00028
00029 #include "gr_CairoGraphics.h"
00030 #include "gr_Image.h"
00031
00032
00033 class GR_CocoaImage : public GR_CairoRasterImage
00034 {
00035 public:
00036 GR_CocoaImage(const char * pszName);
00037 virtual ~GR_CocoaImage();
00038
00039 virtual bool convertToBuffer(UT_ConstByteBufPtr & ppBB) const;
00040 virtual bool convertFromBuffer(const UT_ConstByteBufPtr & pBB, const std::string & mimetype, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00041
00042 virtual bool hasAlpha (void) const;
00043 virtual bool isTransparentAt(UT_sint32 x, UT_sint32 y);
00044
00045
00046
00047 virtual GRType getType() const { return m_grtype; }
00048 virtual bool render(GR_Graphics *pGR, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00049
00050
00051
00052 static NSImage * imageFromPNG (NSData * data, UT_uint32 & image_width, UT_uint32 & image_height);
00053
00054 virtual void cairoSetSource(cairo_t *);
00055
00056
00057 void setSurface(cairo_surface_t *);
00058 protected:
00059 virtual GR_CairoRasterImage *makeSubimage(const std::string & n,
00060 UT_sint32 x, UT_sint32 y,
00061 UT_sint32 w, UT_sint32 h) const;
00062
00063 private:
00064 cairo_surface_t * m_surface;
00065 GRType m_grtype;
00066
00067
00068
00069 bool _convertPNGFromBuffer(const UT_ByteBuf* pBB, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00070 };
00071
00072 #endif