Back to index

nux  3.0.0
CairoWrapper.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 Canonical Ltd
00003  *
00004  * This program is free software: you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 3 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00015  *
00016  * Authored by: Mirco Müller <mirco.mueller@canonical.com
00017  */
00018 
00019 #ifndef CAIRO_WRAPPER_H
00020 #define CAIRO_WRAPPER_H
00021 
00022 #include <cairo.h>
00023 
00024 #include "Nux/Nux.h"
00025 
00026 namespace nux
00027 {
00028   typedef sigc::slot<void, Geometry const&, cairo_t*> DrawCanvasCallback;
00029 
00030   class CairoWrapper
00031   {
00032     public:
00033       CairoWrapper (Geometry const& geom, DrawCanvasCallback callback);
00034       ~CairoWrapper ();
00035 
00036       bool               Invalidate (Geometry const& geom);
00037       void               SetDrawCanvasCallback (DrawCanvasCallback callback);
00038       cairo_surface_t*   GetCairoSurface () const;
00039       cairo_t*           GetCairoContext () const;
00040       bool               DumpToFile (std::string const& filename);
00041       BaseTexture*       GetTexture () const;
00042       NBitmapData*       GetBitmap () const;
00043       bool               Recreate ();
00044 
00045     private:
00046       struct Impl;
00047       Impl* pimpl;
00048   };
00049 }
00050 
00051 #endif // CAIRO_WRAPPER_H