Back to index

texmacs  1.0.7.15
cg_renderer.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : cg_renderer.hpp
00004 * DESCRIPTION: CoreGraphics drawing interface class
00005 * COPYRIGHT  : (C) 2008 Massimiliano Gubinelli
00006 *******************************************************************************
00007 * This software falls under the GNU general public license and comes WITHOUT
00008 * ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
00009 * If you don't have this file, write to the Free Software Foundation, Inc.,
00010 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00011 ******************************************************************************/
00012 
00013 #ifndef CG_RENDERER_HPP
00014 #define CG_RENDERER_HPP
00015 
00016 #include "basic_renderer.hpp"
00017 
00018 #define ID OTHER_ID
00019 #define outline other_outline
00020 #include <ApplicationServices/ApplicationServices.h>
00021 #undef ID
00022 #undef outline
00023 
00024 class cg_renderer_rep:  public basic_renderer_rep {
00025 public:
00026   CGContextRef context;
00027 
00028 public:
00029   cg_renderer_rep (int w = 0, int h = 0);
00030   virtual ~cg_renderer_rep ();
00031   
00032   void  draw (int char_code, font_glyphs fn, SI x, SI y);
00033   void  set_color (color c);
00034   void  set_line_style (SI w, int type=0, bool round=true);
00035   void  line (SI x1, SI y1, SI x2, SI y2);
00036   void  lines (array<SI> x, array<SI> y);
00037   void  clear (SI x1, SI y1, SI x2, SI y2);
00038   void  fill (SI x1, SI y1, SI x2, SI y2);
00039   void  arc (SI x1, SI y1, SI x2, SI y2, int alpha, int delta);
00040   void  fill_arc (SI x1, SI y1, SI x2, SI y2, int alpha, int delta);
00041   void  polygon (array<SI> x, array<SI> y, bool convex=true);
00042   void  xpm (url file_name, SI x, SI y);
00043   void  image (url u, SI w, SI h, SI x, SI y,
00044               double cx1, double cy1, double cx2, double cy2,
00045                int alpha);
00046 
00047   void next_page ();
00048 
00049 
00050 
00051   /***** private section *****************************************************/
00052 
00053   void draw_clipped (CGImageRef im, int w, int h, SI x, SI y); 
00054   bool native_draw (int ch, font_glyphs fn, SI x, SI y);
00055 
00056   CGImageRef xpm_image(url file_name);
00057 
00058   
00059   
00060   void begin (void* c); // c must be a CGContextRef
00061   void end ();
00062 
00063 };
00064 
00065 cg_renderer_rep* the_cg_renderer();
00066 
00067 #endif // defined CG_RENDERER_HPP