• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

gr_CocoaImage.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiWord
00004  * Copyright (C) 1998 AbiSource, Inc.
00005  * Copyright (C) 2001-2002, 2009 Hubert Figuiere
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020  * 02110-1301 USA.
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 //  void            setData(Fatmap * image) { m_image = image; }
00046 
00047     virtual GRType      getType() const { return m_grtype; }
00048     virtual bool        render(GR_Graphics *pGR, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00049 
00050 //  void setFromImageRep(NSImageRep *imgRep);
00051 
00052     static NSImage * imageFromPNG (NSData * data, UT_uint32 & image_width, UT_uint32 & image_height);
00053 
00054     virtual void cairoSetSource(cairo_t *);
00055 
00056     // WILL retain the surface passed. You shall destroy it.
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 //  bool _convertPNGFromBuffer(NSData* data, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00068 
00069     bool _convertPNGFromBuffer(const UT_ByteBuf* pBB, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00070 };
00071 
00072 #endif /* GR_COCOAIMAGE_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1