00001 #ifndef _LIB_ART_SURFACE_H 00002 #define _LIB_ART_SURFACE_H 00003 00004 #include "libart_lgpl/libart.h" 00005 #include "libart_lgpl/art_render.h" 00006 #include "libart_lgpl/art_render_svp.h" 00007 00008 class GLibArtPen 00009 { 00010 friend class GLibArtSurface; 00011 friend class GLibArtPath; 00012 00013 COLOUR Colour; 00014 double Width; 00015 double MiterLimit; 00016 double Flatness; 00017 ArtPathStrokeJoinType Join; 00018 ArtPathStrokeCapType Cap; 00019 00020 public: 00021 GLibArtPen() 00022 { 00023 Colour = 0; 00024 Width = 1.0; 00025 MiterLimit = 2.0; 00026 Flatness = 1.0; 00027 Join = ART_PATH_STROKE_JOIN_MITER; 00028 Cap = ART_PATH_STROKE_CAP_BUTT; 00029 } 00030 00031 GLibArtPen(COLOUR c) 00032 { 00033 Colour = c; 00034 Width = 1.0; 00035 MiterLimit = 2.0; 00036 Flatness = 1.0; 00037 Join = ART_PATH_STROKE_JOIN_MITER; 00038 Cap = ART_PATH_STROKE_CAP_BUTT; 00039 } 00040 00041 GLibArtPen(COLOUR c, double wid) 00042 { 00043 Colour = c; 00044 Width = wid; 00045 MiterLimit = 2.0; 00046 Flatness = 1.0; 00047 Join = ART_PATH_STROKE_JOIN_MITER; 00048 Cap = ART_PATH_STROKE_CAP_BUTT; 00049 } 00050 }; 00051 00052 class GLibArtPath 00053 { 00054 int Points; 00055 int Max; 00056 ArtVpath *Path; 00057 00058 void _Add(ArtPathcode code, double x = 0.0, double y = 0.0); 00059 00060 public: 00061 GLibArtPath(); 00062 ~GLibArtPath(); 00063 00064 int GetPoints(); 00065 ArtVpath *PointAt(int i); 00066 ArtSVP *FillSvp(); 00067 ArtSVP *StrokeSvp(GLibArtPen &Pen); 00068 00069 void AddCircle(double x, double y, double r); 00070 void AddRectangle(int x1, int y1, int x2, int y2); 00071 void AddRectangle(double x1, double y1, double x2, double y2); 00072 void AddRoundedRectangle(double x1, double y1, double x2, double y2, double r); 00073 void AddLine(int x1, int y1, int x2, int y2); 00074 void AddLine(double x1, double y1, double x2, double y2); 00075 }; 00076 00077 class GLibArtSurface : public GMemDC 00078 { 00079 ArtRender * Ar; 00080 00081 public: 00082 GLibArtSurface(int x = -1, int y = -1); 00083 00084 ArtRender *RenderNew(int x, int y); 00085 void DrawPath(GLibArtPen &Pen, GLibArtPath *Path); 00086 void FillPath(COLOUR c, GLibArtPath *Path); 00087 00088 COLOUR Colour(COLOUR c, int Bits = -1); 00089 }; 00090 00091 00092 #endif