00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __STYLEBASE_H__
00021 #define __STYLEBASE_H__
00022
00023 #ifndef WX_PRECOMP
00024 #include "wx/wx.h"
00025 #endif
00026
00027 #include <wx/fontenc.h>
00028 #include <wx/encconv.h>
00029 #include <wx/bitmap.h>
00030
00031 #include "a2dprivate.h"
00032
00033 #include "wx/txtstrm.h"
00034 #include "wx/geometry.h"
00035
00036 #include <map>
00037
00038 using namespace std;
00039
00040
00041 #if wxART2D_USE_FREETYPE
00042 #include <ft2build.h>
00043 #ifdef _MSC_VER
00044
00045
00046 #include <freetype/freetype.h>
00047 #include <freetype/ftglyph.h>
00048 #else // _MSC_VER
00049
00050 #include FT_FREETYPE_H
00051 #include FT_GLYPH_H
00052 #endif // _MSC_VER
00053 #endif
00054
00055 #include "wx/general/gen.h"
00056
00057 #if wxART2D_USE_XMLPARSE
00058 #include "wx/xmlparse/genxmlpars.h"
00059 #endif //wxART2D_USE_XMLPARSE
00060
00061 #include "wx/artbase/artglob.h"
00062 #include "wx/artbase/liner.h"
00063 #include "wx/artbase/afmatrix.h"
00064 #include "wx/artbase/bbox.h"
00065
00066
00067 #define FTNORMFONT 1000
00068
00069 #define NORMFONT 100
00070
00071 class A2DARTBASEDLLEXP a2dBoundingBox;
00072 class A2DARTBASEDLLEXP a2dAffineMatrix;
00073
00074 class a2dDrawer2D;
00075 class a2dVpath;
00076
00077
00078 extern a2dPropertyIdColour PROPID_colour;
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 enum a2dFillStyle
00092 {
00093 a2dFILL_TRANSPARENT,
00094 a2dFILL_SOLID,
00095 a2dFILL_BDIAGONAL_HATCH,
00096 a2dFILL_CROSSDIAG_HATCH,
00097 a2dFILL_FDIAGONAL_HATCH,
00098 a2dFILL_CROSS_HATCH,
00099 a2dFILL_HORIZONTAL_HATCH,
00100 a2dFILL_VERTICAL_HATCH,
00101 a2dFIRST_HATCH = a2dFILL_BDIAGONAL_HATCH,
00102 a2dLAST_HATCH = a2dFILL_VERTICAL_HATCH,
00103 a2dFILL_TWOCOL_BDIAGONAL_HATCH,
00104 a2dFILL_TWOCOL_CROSSDIAG_HATCH,
00105 a2dFILL_TWOCOL_FDIAGONAL_HATCH,
00106 a2dFILL_TWOCOL_CROSS_HATCH,
00107 a2dFILL_TWOCOL_HORIZONTAL_HATCH,
00108 a2dFILL_TWOCOL_VERTICAL_HATCH,
00109 a2dFIRST_TWOCOL_HATCH = a2dFILL_TWOCOL_BDIAGONAL_HATCH,
00110 a2dLAST_TWOCOL_HATCH = a2dFILL_TWOCOL_VERTICAL_HATCH,
00111 a2dFILL_STIPPLE,
00112 a2dFILL_STIPPLE_MASK_OPAQUE,
00113 a2dFILL_STIPPLE_MASK_OPAQUE_TRANSPARENT,
00114 a2dFILL_GRADIENT_FILL_XY_LINEAR,
00115 a2dFILL_GRADIENT_FILL_XY_RADIAL,
00116 a2dFILL_GRADIENT_FILL_XY_DROP,
00117 a2dFILL_INHERIT,
00118 a2dFILL_LAYER,
00119 a2dFILL_NULLFILL
00120 };
00121
00122
00123
00124
00125
00126 enum a2dFillType
00127 {
00128 a2dFILL_NULL,
00129 a2dFILL_ONE_COLOUR,
00130 a2dFILL_HATCH_TWO_COLOUR,
00131 a2dFILL_GRADIENT_FILL_LINEAR,
00132 a2dFILL_GRADIENT_FILL_RADIAL,
00133 a2dFILL_BITMAP,
00134 };
00135
00136
00137
00138
00139
00140
00141
00142
00143 class A2DARTBASEDLLEXP a2dFill : public wxObject
00144 {
00145
00146 #ifdef CLASS_MEM_MANAGEMENT
00147
00148 static a2dMemManager sm_memManager;
00149 public:
00150
00151 void* operator new( size_t bytes )
00152 {
00153 return sm_memManager.Allocate( bytes );
00154 }
00155
00156
00157
00158
00159
00160
00161
00162 void operator delete( void *space, size_t bytes )
00163 {
00164 sm_memManager.Deallocate( space, bytes );
00165 }
00166 #endif //CLASS_MEM_MANAGEMENT
00167
00168 public:
00169
00170
00171 a2dFill( void );
00172
00173 a2dFill( const a2dFill& fill );
00174
00175 a2dFill( const wxBrush& brush );
00176
00177 a2dFill( const wxColour& col, a2dFillStyle style = a2dFILL_SOLID );
00178
00179 a2dFill( const wxColour& col, const wxColour& col2, a2dFillStyle style );
00180
00181 a2dFill( const wxBitmap& stipple, a2dFillStyle style = a2dFILL_STIPPLE );
00182
00183 a2dFill( const wxBitmap& stipple, const wxColour& col, const wxColour& col2, a2dFillStyle style = a2dFILL_STIPPLE );
00184
00185 a2dFill( const wxFileName& filename, a2dFillStyle style = a2dFILL_STIPPLE );
00186
00187 a2dFill( const wxFileName& filename, const wxColour& col, const wxColour& col2, a2dFillStyle style = a2dFILL_STIPPLE );
00188
00189 a2dFill( const wxColour& col, const wxColour& col2,
00190 double x1, double y1, double x2, double y2 );
00191
00192 a2dFill( const wxColour& col, const wxColour& col2,
00193 double xfc, double yfc, double xe, double ye, double radius );
00194
00195 bool operator==(const a2dFill& a)
00196 {
00197 return m_refData == a.m_refData;
00198 }
00199
00200 bool operator!=(const a2dFill& a)
00201 {
00202 return m_refData != a.m_refData;
00203 }
00204
00205 friend inline bool operator==(const a2dFill& a, const a2dFill& b)
00206 {
00207 return a.m_refData == b.m_refData;
00208 }
00209
00210 friend inline bool operator!=(const a2dFill& a, const a2dFill& b)
00211 {
00212 return a.m_refData != b.m_refData;
00213 }
00214
00215 a2dFill& UnShare();
00216
00217 wxObjectRefData* CreateRefData() const;
00218
00219 wxObjectRefData* CloneRefData(const wxObjectRefData * data) const;
00220
00221
00222 virtual ~a2dFill( void );
00223
00224 a2dFillType GetType( void ) const;
00225
00226 a2dFillStyle GetStyle() const;
00227
00228 void SetStyle( a2dFillStyle style );
00229
00230 a2dFillType GetTypeForStyle( a2dFillStyle style ) const;
00231
00232 void SetStipple( const wxBitmap& stipple );
00233
00234 const wxBitmap& GetStipple() const;
00235
00236
00237 wxColour GetColour() const;
00238
00239
00240 wxColour GetColour2() const;
00241
00242
00243 void SetColour( const wxColour& col );
00244
00245
00246 void SetColour2( const wxColour& col );
00247
00248 void SetAlpha( wxUint8 val );
00249 wxUint8 GetAlpha() const;
00250
00251
00252 a2dPoint2D GetStart() const;
00253
00254
00255 a2dPoint2D GetStop() const;
00256
00257
00258 wxUint32 GetStamp() const;
00259
00260
00261 a2dPoint2D GetCenter() const;
00262
00263
00264 a2dPoint2D GetFocal() const;
00265
00266
00267 double GetRadius() const;
00268
00269
00270
00271
00272
00273 bool IsNoFill() const { return m_refData == NULL; }
00274
00275
00276 a2dFill* SetNoFill() { UnRef(); return this; }
00277
00278
00279
00280 void SetFilling( bool OnOff );
00281
00282
00283 bool GetFilling() const;
00284
00285 DECLARE_DYNAMIC_CLASS( a2dFill )
00286
00287 #if wxART2D_USE_CVGIO
00288 virtual void Load( wxObject* parent, a2dIOHandlerXmlSerIn& parser );
00289 virtual void Save( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dObjectList* towrite );
00290 #endif //wxART2D_USE_CVGIO
00291
00292 };
00293
00294
00295
00296
00297
00298 enum a2dStrokeStyle
00299 {
00300 a2dSTROKE_TRANSPARENT,
00301 a2dSTROKE_SOLID,
00302 a2dSTROKE_DOT,
00303 a2dSTROKE_LONG_DASH,
00304 a2dSTROKE_SHORT_DASH,
00305 a2dSTROKE_DOT_DASH,
00306 a2dSTROKE_USER_DASH,
00307 a2dSTROKE_BDIAGONAL_HATCH,
00308 a2dSTROKE_CROSSDIAG_HATCH,
00309 a2dSTROKE_FDIAGONAL_HATCH,
00310 a2dSTROKE_CROSS_HATCH,
00311 a2dSTROKE_HORIZONTAL_HATCH,
00312 a2dSTROKE_VERTICAL_HATCH,
00313 a2dSTROKE_STIPPLE,
00314 a2dSTROKE_STIPPLE_MASK_OPAQUE,
00315 a2dSTROKE_STIPPLE_MASK_OPAQUE_TRANSPARENT,
00316 a2dSTROKE_OBJECTS,
00317 a2dSTROKE_INHERIT,
00318 a2dSTROKE_LAYER,
00319 a2dSTROKE_NULLSTROKE
00320 };
00321
00322
00323
00324
00325 enum a2dStrokeType
00326 {
00327 a2dSTROKE_NULL,
00328 a2dSTROKE_OBJECT,
00329 a2dSTROKE_NORMAL,
00330 a2dSTROKE_ONE_COLOUR,
00331
00332
00333 a2dSTROKE_BITMAP,
00334 };
00335
00336 typedef float a2dDash;
00337
00338 #if !wxCHECK_VERSION(2,9,0)
00339 typedef int wxPenJoin;
00340 typedef int wxPenCap;
00341 typedef int wxPolygonFillMode;
00342 typedef int wxRasterOperationMode;
00343
00344
00345 enum wxBrushStyle
00346 {
00347 wxBRUSHSTYLE_INVALID = -1,
00348
00349 wxBRUSHSTYLE_SOLID = wxSOLID,
00350 wxBRUSHSTYLE_TRANSPARENT = wxTRANSPARENT,
00351 wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
00352 wxBRUSHSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
00353 wxBRUSHSTYLE_STIPPLE = wxSTIPPLE,
00354 wxBRUSHSTYLE_BDIAGONAL_HATCH = wxBDIAGONAL_HATCH,
00355 wxBRUSHSTYLE_CROSSDIAG_HATCH = wxCROSSDIAG_HATCH,
00356 wxBRUSHSTYLE_FDIAGONAL_HATCH = wxFDIAGONAL_HATCH,
00357 wxBRUSHSTYLE_CROSS_HATCH = wxCROSS_HATCH,
00358 wxBRUSHSTYLE_HORIZONTAL_HATCH = wxHORIZONTAL_HATCH,
00359 wxBRUSHSTYLE_VERTICAL_HATCH = wxVERTICAL_HATCH,
00360 wxBRUSHSTYLE_FIRST_HATCH = wxFIRST_HATCH,
00361 wxBRUSHSTYLE_LAST_HATCH = wxLAST_HATCH
00362 };
00363
00364 #endif
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378 class A2DARTBASEDLLEXP a2dStroke : public wxObject
00379 {
00380 #ifdef CLASS_MEM_MANAGEMENT
00381
00382
00383 static a2dMemManager sm_memManager;
00384 public:
00385
00386 void* operator new( size_t bytes )
00387 {
00388 return sm_memManager.Allocate( bytes );
00389 }
00390
00391
00392
00393
00394
00395
00396
00397 void operator delete( void *space, size_t bytes )
00398 {
00399 sm_memManager.Deallocate( space, bytes );
00400 }
00401 #endif //CLASS_MEM_MANAGEMENT
00402
00403 public:
00404
00405
00406 a2dStroke( void );
00407
00408 a2dStroke( const wxColour& col, a2dStrokeStyle style = a2dSTROKE_SOLID );
00409
00410 a2dStroke( const wxColour& col, double width, a2dStrokeStyle style = a2dSTROKE_SOLID );
00411
00412
00413 a2dStroke( const wxColour& col, int width, a2dStrokeStyle style = a2dSTROKE_SOLID );
00414
00415 a2dStroke( const wxBitmap& stipple, a2dStrokeStyle style = a2dSTROKE_STIPPLE );
00416
00417 a2dStroke( const wxBitmap& stipple, const wxColour& col, const wxColour& col2, a2dStrokeStyle style = a2dSTROKE_STIPPLE );
00418
00419 a2dStroke( const wxFileName& filename, a2dStrokeStyle style = a2dSTROKE_STIPPLE );
00420
00421 a2dStroke( const wxFileName& filename, const wxColour& col, const wxColour& col2, a2dStrokeStyle style = a2dSTROKE_STIPPLE );
00422
00423
00424 a2dStroke( const a2dStroke& stroke );
00425
00426
00427 a2dStroke( const wxPen& stroke );
00428
00429
00430 virtual ~a2dStroke( void );
00431
00432 a2dStroke& UnShare();
00433
00434 bool operator==(const a2dStroke& a)
00435 {
00436 return m_refData == a.m_refData;
00437 }
00438
00439 bool operator!=(const a2dStroke& a)
00440 {
00441 return m_refData != a.m_refData;
00442 }
00443
00444 friend inline bool operator==(const a2dStroke& a, const a2dStroke& b)
00445 {
00446 return a.m_refData == b.m_refData;
00447 }
00448
00449 friend inline bool operator!=(const a2dStroke& a, const a2dStroke& b)
00450 {
00451 return a.m_refData != b.m_refData;
00452 }
00453
00454 wxObjectRefData* CreateRefData() const;
00455
00456 wxObjectRefData* CloneRefData(const wxObjectRefData * data) const;
00457
00458 virtual a2dStrokeType GetType( void ) const;
00459
00460 void SetStipple( const wxBitmap& stipple );
00461
00462 const wxBitmap& GetStipple() const;
00463
00464
00465 wxColour GetColour() const;
00466
00467
00468 void SetColour( const wxColour& col );
00469
00470
00471 wxColour GetColour2() const;
00472
00473
00474 void SetColour2( const wxColour& col );
00475
00476 void SetJoin( wxPenJoin join_style );
00477
00478 void SetCap( wxPenCap cap_style );
00479
00480 wxPenCap GetCap() const;
00481
00482 wxPenJoin GetJoin() const;
00483
00484
00485 void SetWidth( float width );
00486
00487
00488
00489 float GetWidth() const;
00490 float GetExtend() const;
00491
00492
00493 void SetPixelStroke( bool pixelstroke );
00494
00495
00496 bool GetPixelStroke() const;
00497
00498 void SetAlpha( wxUint8 val );
00499
00500 wxUint8 GetAlpha() const;
00501
00502 a2dStrokeStyle GetStyle() const;
00503
00504 void SetStyle( a2dStrokeStyle style );
00505
00506
00507
00508
00509
00510 bool IsNoStroke() const { return m_refData == NULL; }
00511
00512
00513 a2dStroke* SetNoStroke() { UnRef(); return this; }
00514
00515 a2dStrokeType GetTypeForStyle( a2dStrokeStyle style ) const;
00516
00517 DECLARE_DYNAMIC_CLASS( a2dStroke )
00518
00519 #if wxART2D_USE_CVGIO
00520 virtual void Load( wxObject* parent, a2dIOHandlerXmlSerIn& parser );
00521 virtual void Save( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dObjectList* towrite );
00522 #endif //wxART2D_USE_CVGIO
00523
00524 };
00525
00526
00527
00528
00529
00530 enum a2dFontType
00531 {
00532 a2dFONT_NULL,
00533 a2dFONT_WXDC,
00534 a2dFONT_FREETYPE,
00535 a2dFONT_STROKED,
00536 };
00537
00538 #if defined(__WXMSW__)
00539 #define __USE_WINAPI__
00540 #endif
00541
00542 class a2dVertexList;
00543
00544 typedef a2dVertexList** a2dStrokeGlyph;
00545
00546 #if !wxART2D_USE_FREETYPE
00547
00548 typedef void* FT_Glyph;
00549 typedef void* FT_Vector;
00550 typedef void* FT_Face;
00551 typedef unsigned int FT_UInt;
00552 #endif // wxART2D_USE_FREETYPE
00553
00554
00555
00556
00557
00558 class A2DARTBASEDLLEXP a2dCharHash
00559 {
00560 public:
00561 a2dCharHash() { }
00562 unsigned long operator()( const wxChar& k ) const
00563 { return ( unsigned long ) k; }
00564 a2dCharHash& operator=( const a2dCharHash& ) { return * this; }
00565 };
00566
00567
00568
00569
00570
00571 class A2DARTBASEDLLEXP a2dCharEqual
00572 {
00573 public:
00574 a2dCharEqual() { }
00575 bool operator()( const wxChar& a, const wxChar& b ) const
00576 { return ( a == b ); }
00577 a2dCharEqual& operator=( const a2dCharEqual& ) { return * this; }
00578 };
00579
00580
00581 struct A2DARTBASEDLLEXP a2dGlyph
00582 {
00583 FT_UInt m_index;
00584 FT_Glyph m_glyph;
00585 a2dGlyph()
00586 {
00587 m_index = ( FT_UInt ) - 1; m_glyph = NULL;
00588 }
00589 ~a2dGlyph()
00590 {
00591 #if wxART2D_USE_FREETYPE
00592 if( m_glyph )
00593 FT_Done_Glyph( m_glyph );
00594 #endif
00595 }
00596 };
00597
00598
00599
00600
00601
00602 WX_DECLARE_HASH_MAP_WITH_DECL( wxChar, a2dGlyph, a2dCharHash, a2dCharEqual, a2dGlyphHash, class A2DARTBASEDLLEXP );
00603
00604
00605
00606
00607
00608
00609 WX_DECLARE_HASH_MAP_WITH_DECL( wxChar, double, a2dCharHash, a2dCharEqual, DcWidthHash, class A2DARTBASEDLLEXP );
00610
00611
00612
00613
00614
00615 WX_DECLARE_HASH_MAP_WITH_DECL( wxString, double, wxStringHash, wxStringEqual, DcKerningHash, class A2DARTBASEDLLEXP );
00616
00617 enum a2dFontAlignment
00618 {
00619
00620 wxMINX = wxLEFT,
00621 wxMAXX = wxRIGHT,
00622 wxMINY = wxBOTTOM,
00623 wxMAXY = wxTOP,
00624 wxBBOX = 0x100,
00625 a2dDEFAULT_ALIGNMENT = wxTOP | wxLEFT | wxBBOX
00626 };
00627
00628 #define UNKNOWN_YAXIS 2
00629
00630 class a2dFont;
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668 class A2DARTBASEDLLEXP a2dFontInfo
00669 {
00670 public:
00671
00672 a2dFontInfo() {}
00673
00674 a2dFontInfo( const wxString& type, const wxString& name, const wxString& style = wxT( "" ),
00675 double size = 1.0, const wxString& extra = wxT( "" ) );
00676
00677 a2dFontInfo( const wxString& type, const wxString& name,
00678 const wxString& style, const wxString& extra = wxT( "" ) );
00679
00680 a2dFontInfo( const wxString& info );
00681
00682
00683 a2dFontInfo& operator=( const a2dFontInfo& other );
00684
00685
00686 bool operator == ( const a2dFontInfo& other ) const;
00687
00688
00689
00690
00691 a2dFont CreateFont( double size );
00692
00693
00694 inline const wxString& GetType() const { return m_type; }
00695
00696 inline void SetType( const wxString& type ) { m_type = type; }
00697
00698
00699 inline const wxString& GetName() const { return m_name; }
00700
00701 inline void SetName( const wxString& name ) { m_name = name; }
00702
00703
00704 inline const wxString& GetStyle() const { return m_style; }
00705
00706 inline void SetStyle( const wxString& style ) { m_style = style; }
00707
00708
00709 inline double GetSize() const { return m_size; }
00710
00711 inline void SetSize( double size ) { m_size = size; }
00712
00713
00714 wxString CreateString() const;
00715
00716
00717 void ParseString( wxString string );
00718
00719
00720 inline const wxString& GetExtra() const { return m_extra; }
00721
00722
00723 inline void SetExtra( const wxString& extra ) { m_extra = extra; }
00724
00725 protected:
00726
00727 wxString m_type;
00728
00729 wxString m_name;
00730
00731 wxString m_style;
00732
00733 double m_size;
00734
00735 wxString m_extra;
00736 };
00737
00738
00739
00740
00741
00742
00743 WX_DECLARE_LIST_WITH_DECL( a2dFontInfo, a2dFontInfoList, class A2DARTBASEDLLEXP );
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755 class A2DARTBASEDLLEXP a2dFont : public wxObject
00756 {
00757 public:
00758
00759 a2dFontType GetType( void ) const;
00760
00761
00762 a2dFont();
00763
00764
00765 a2dFont( const a2dFont& other );
00766
00767
00768
00769
00770
00771
00772
00773
00774 a2dFont( const wxFont& font, double size, a2dFontType type = a2dFONT_WXDC, wxFontEncoding encoding = wxFONTENCODING_DEFAULT );
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807 a2dFont( double size, int family, int style = wxNORMAL, int weight = wxNORMAL,
00808 const bool underline = false, const wxString& faceName = wxT( "" ),
00809 wxFontEncoding encoding = wxFONTENCODING_DEFAULT );
00810
00811
00812 a2dFont( const wxString& filename, double size = 0.0, wxFontEncoding encoding = wxFONTENCODING_DEFAULT, int weight = wxNORMAL );
00813
00814
00815 a2dFont( const wxString& filename, double size, bool monoSpaced, double weight = 0.0 );
00816
00817
00818 virtual ~a2dFont();
00819
00820
00821 bool operator==(const a2dFont& a)
00822 {
00823 return m_refData == a.m_refData;
00824 }
00825
00826
00827 bool operator!=(const a2dFont& a)
00828 {
00829 return m_refData != a.m_refData;
00830 }
00831
00832
00833 friend inline bool operator==(const a2dFont& a, const a2dFont& b)
00834 {
00835 return a.m_refData == b.m_refData;
00836 }
00837
00838
00839 friend inline bool operator!=(const a2dFont& a, const a2dFont& b)
00840 {
00841 return a.m_refData != b.m_refData;
00842 }
00843
00844
00845
00846
00847 bool Ok() const;
00848
00849
00850 const a2dFontInfo& GetFontInfo() const;
00851
00852
00853
00854 void SetSize( double size );
00855
00856
00857
00858 double GetSize() const;
00859
00860
00861
00862
00863
00864 double GetLineHeight() const;
00865
00866
00867
00868
00869
00870 double GetDescent() const;
00871
00872
00873 double GetWidth( wxChar c );
00874
00875
00876
00877
00878
00879
00880
00881 double GetKerning( wxChar WXUNUSED( c1 ), wxChar WXUNUSED( c2 ) ) const;
00882
00883
00884
00885
00886
00887
00888 double GetStrokeWidth() const;
00889
00890
00891
00892
00893 a2dStrokeGlyph GetGlyphStroke( wxChar c ) const;
00894
00895 const a2dGlyph* GetGlyphFreetype( wxChar c ) const;
00896
00897 #if wxART2D_USE_FREETYPE && defined(__USE_WINAPI__)
00898
00899 a2dFont GetFreetypeFont();
00900 #endif
00901
00902
00903 wxFont& GetFont( void );
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917 a2dBoundingBox GetTextExtent( const wxString& string, int yaxisdirection,
00918 int alignment = wxLEFT | wxTOP | wxBBOX, double* w = NULL,
00919 double* h = NULL, double* descent = NULL,
00920 double* externalLeading = NULL ) const;
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931 void GetTextExtent( const wxString& string, double& w, double& h,
00932 double& descent, double& externalLeading ) const;
00933
00934
00935
00936
00937
00938
00939 void GetTextExtentWH( const wxString& string, double& w, double& h ) const;
00940
00941 bool GetPartialTextExtents ( const wxString & text, wxArrayInt & widths ) const;
00942
00943
00944
00945
00946
00947
00948
00949
00950 bool GetVpath( wxChar c, a2dVpath& glyph, const a2dAffineMatrix& affine = a2dIDENTITY_MATRIX );
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962 void GetVpath( const wxString& text, a2dVpath& vpath, double x = 0, double y = 0, int alignment = wxLEFT | wxTOP | wxBBOX, bool yaxis = true, const a2dAffineMatrix& affine = a2dIDENTITY_MATRIX );
00963
00964
00965 bool AlwaysWriteSerializationId() const { return true; }
00966
00967
00968
00969
00970 static void GetInfoList( a2dFontInfoList& list );
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986 static a2dFont CreateFont( const a2dFontInfo& info, bool force = false );
00987
00988
00989
00990
00991 wxString CreateString();
00992
00993
00994 static wxString CreateString( const wxString& filename, double size, wxFontEncoding encoding, int weight );
00995
00996 static wxString CreateString( const wxString& filename, double size, bool monoSpaced, double weight );
00997
00998 static wxString CreateString( a2dFontType type, const wxFont& font, double size, wxFontEncoding encoding );
00999
01000
01001
01002
01003
01004
01005 void SetFilename( const wxString& filename );
01006
01007
01008
01009
01010 wxString GetFilename( bool filenameonly = false ) const;
01011
01012
01013
01014
01015
01016 double GetWeight() const;
01017
01018
01019
01020
01021
01022 void SetWeight( double weight );
01023
01024
01025
01026
01027 void SetWeight( const wxString& weight );
01028
01029 wxObjectRefData* CreateRefData() const;
01030
01031 wxObjectRefData* CloneRefData(const wxObjectRefData * data) const;
01032
01033 #if wxART2D_USE_CVGIO
01034 private:
01035
01036 virtual void Load( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) ) {}
01037 virtual void Save( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerOut &WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ) , a2dObjectList* WXUNUSED( towrite ) ) {}
01038 #endif //wxART2D_USE_CVGIO
01039
01040 public:
01041 private:
01042 DECLARE_ABSTRACT_CLASS( a2dFont )
01043
01044 static void ClearFontCache() { ms_fontCache.clear(); }
01045
01046 static map< wxString, a2dFont > ms_fontCache;
01047 };
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063 A2DARTBASEDLLEXP_DATA( extern const a2dFill* ) a2dWHITE_FILL;
01064
01065
01066
01067 A2DARTBASEDLLEXP_DATA( extern const a2dFill* ) a2dBLACK_FILL;
01068
01069
01070
01071 A2DARTBASEDLLEXP_DATA( extern const a2dFill* ) a2dTRANSPARENT_FILL;
01072
01073
01074
01075 A2DARTBASEDLLEXP_DATA( extern const a2dFill* ) a2dINHERIT_FILL;
01076
01077
01078
01079 A2DARTBASEDLLEXP_DATA( extern const a2dFill* ) a2dSELECT_FILL;
01080
01081
01082
01083
01084
01085
01086 A2DARTBASEDLLEXP_DATA(extern const a2dFill* ) a2dNullFILL;
01087
01088
01089
01090 A2DARTBASEDLLEXP_DATA( extern const a2dStroke* ) a2dBLACK_STROKE;
01091
01092
01093
01094 A2DARTBASEDLLEXP_DATA( extern const a2dStroke* ) a2dWHITE_STROKE;
01095
01096
01097
01098 A2DARTBASEDLLEXP_DATA( extern const a2dStroke* ) a2dTRANSPARENT_STROKE;
01099
01100
01101
01102 A2DARTBASEDLLEXP_DATA( extern const a2dStroke* ) a2dINHERIT_STROKE;
01103
01104
01105
01106
01107
01108
01109 A2DARTBASEDLLEXP_DATA(extern const a2dStroke*) a2dNullSTROKE;
01110
01111
01112
01113 A2DARTBASEDLLEXP_DATA( extern const a2dStroke*) a2dLAYER_SELECT_STROKE;
01114
01115
01116
01117 A2DARTBASEDLLEXP_DATA( extern const a2dFont* ) a2dNullFONT;
01118
01119
01120
01121 A2DARTBASEDLLEXP_DATA( extern const a2dFont* ) a2dDEFAULT_CANVASFONT;
01122
01123
01124
01125
01126
01127
01128
01129
01130 extern A2DARTBASEDLLEXP void a2dCanvasInitializeStockObjects ();
01131
01132
01133
01134
01135
01136
01137
01138 extern A2DARTBASEDLLEXP void a2dCanvasDeleteStockObjects ();
01139
01140
01141 class A2DARTBASEDLLEXP a2dFreetypeModule : public wxModule
01142 {
01143 public:
01144
01145 a2dFreetypeModule();
01146
01147 virtual bool OnInit();
01148 virtual void OnExit();
01149
01150 private:
01151
01152 DECLARE_DYNAMIC_CLASS( a2dFreetypeModule )
01153 };
01154
01155
01156 class A2DGENERALDLLEXP a2dFillProperty;
01157 typedef a2dPropertyIdTyped< a2dFill, a2dFillProperty> a2dPropertyIdFill;
01158
01159
01160
01161
01162
01163
01164 class A2DGENERALDLLEXP a2dFillProperty: public a2dNamedProperty
01165 {
01166 public:
01167
01168 a2dFillProperty();
01169
01170 a2dFillProperty( const a2dPropertyIdFill* id, const a2dFill& value );
01171
01172 a2dFillProperty( const a2dFillProperty* ori );
01173
01174 a2dFillProperty(const a2dFillProperty &other );
01175
01176 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01177
01178 virtual void Assign( const a2dNamedProperty &other );
01179
01180 virtual ~a2dFillProperty();
01181
01182
01183
01184 static a2dFillProperty *CreatePropertyFromString( const a2dPropertyIdFill* id, const wxString &value );
01185
01186 void SetValue( const a2dFill& value );
01187
01188 const a2dFill& GetValue() const { return m_value; }
01189
01190 virtual wxString StringRepresentation() const;
01191
01192 virtual wxString StringValueRepresentation() const;
01193
01194 #if wxART2D_USE_CVGIO
01195 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01196 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01197 #endif //wxART2D_USE_CVGIO
01198
01199 DECLARE_DYNAMIC_CLASS(a2dFillProperty)
01200
01201 protected:
01202
01203 a2dFill m_value;
01204 };
01205
01206 class A2DGENERALDLLEXP a2dStrokeProperty;
01207 typedef a2dPropertyIdTyped< a2dStroke, a2dStrokeProperty> a2dPropertyIdStroke;
01208
01209
01210
01211
01212
01213
01214 class A2DGENERALDLLEXP a2dStrokeProperty: public a2dNamedProperty
01215 {
01216 public:
01217
01218 a2dStrokeProperty();
01219
01220 a2dStrokeProperty( const a2dPropertyIdStroke* id, const a2dStroke& value );
01221
01222 a2dStrokeProperty( const a2dStrokeProperty* ori );
01223
01224 a2dStrokeProperty(const a2dStrokeProperty &other );
01225
01226 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01227
01228 virtual void Assign( const a2dNamedProperty &other );
01229
01230 virtual ~a2dStrokeProperty();
01231
01232
01233
01234 static a2dStrokeProperty *CreatePropertyFromString( const a2dPropertyIdStroke* id, const wxString &value );
01235
01236 void SetValue( const a2dStroke& value );
01237
01238 const a2dStroke& GetValue() const { return m_value; }
01239
01240 virtual wxString StringRepresentation() const;
01241
01242 virtual wxString StringValueRepresentation() const;
01243
01244 #if wxART2D_USE_CVGIO
01245 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01246 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01247 #endif //wxART2D_USE_CVGIO
01248
01249 DECLARE_DYNAMIC_CLASS(a2dStrokeProperty)
01250
01251 protected:
01252
01253 a2dStroke m_value;
01254 };
01255
01256 class A2DGENERALDLLEXP a2dFontProperty;
01257 typedef a2dPropertyIdTyped< a2dFont, a2dFontProperty> a2dPropertyIdFont;
01258
01259
01260
01261
01262
01263
01264 class A2DGENERALDLLEXP a2dFontProperty: public a2dNamedProperty
01265 {
01266 public:
01267
01268 a2dFontProperty();
01269
01270 a2dFontProperty( const a2dPropertyIdFont* id, const a2dFont& value );
01271
01272 a2dFontProperty( const a2dFontProperty* ori );
01273
01274 a2dFontProperty(const a2dFontProperty &other );
01275
01276 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01277
01278 virtual void Assign( const a2dNamedProperty &other );
01279
01280 virtual ~a2dFontProperty();
01281
01282
01283
01284 static a2dFontProperty *CreatePropertyFromString( const a2dPropertyIdFont* id, const wxString &value );
01285
01286 void SetValue( const a2dFont& value );
01287
01288 const a2dFont& GetValue() const { return m_value; }
01289
01290 virtual wxString StringRepresentation() const;
01291
01292 virtual wxString StringValueRepresentation() const;
01293
01294 #if wxART2D_USE_CVGIO
01295 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01296 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01297 #endif //wxART2D_USE_CVGIO
01298
01299 DECLARE_DYNAMIC_CLASS(a2dFontProperty)
01300
01301 protected:
01302
01303 a2dFont m_value;
01304 };
01305
01306 #endif
01307