00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __WXIMAGEPRIM_H__
00016 #define __WXIMAGEPRIM_H__
00017
00018 #ifndef WX_PRECOMP
00019 #include "wx/wx.h"
00020 #endif
00021
00022 #include "wx/image.h"
00023 #include "wx/canvas/candefs.h"
00024 #include "wx/canvas/canobj.h"
00025 #include "wx/canvas/rectangle.h"
00026
00027
00028
00029
00030
00031
00032
00033 class A2DCANVASDLLEXP a2dImage: public a2dCanvasObject
00034 {
00035 public:
00036
00037
00038 a2dImage();
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 a2dImage( const wxImage &image, double xc, double yc, double w, double h );
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 a2dImage( const wxString &imagefile, wxBitmapType type, double xc, double yc, double w, double h );
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 a2dImage( a2dCanvasObject* torender, double xc, double yc, double w, double h, int imagew = 100, int imageh = 100 );
00077
00078 a2dImage( const a2dImage& ori, CloneOptions options );
00079
00080 ~a2dImage();
00081
00082
00083
00084
00085
00086 void SetOpacityFactor( wxUint8 OpacityFactor );
00087
00088
00089 wxUint8 GetOpacityFactor() { return m_OpacityFactor; }
00090
00091 virtual a2dObject* Clone( CloneOptions options ) const;
00092
00093
00094
00095
00096
00097 a2dCanvasObjectList* GetAsRectangles( const wxColour& col1, const wxColour& col2, bool transform );
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 void RenderObject( a2dCanvasObject* torender, int imagew = 100 , int imageh = 100 );
00111
00112
00113 double GetWidth() const { return m_width; }
00114
00115
00116 double GetHeight() const { return m_height; }
00117
00118
00119
00120 void SetWidth( double width ) { m_width = width; SetPending(true); }
00121
00122
00123
00124 void SetHeight( double height ) { m_height = height; SetPending(true); }
00125
00126
00127 wxImage& GetImage() { return m_image; }
00128
00129
00130 void SetImage( const wxImage& image ) { m_image = image; SetPending(true); }
00131
00132
00133 wxString& GetFilename() { return m_filename; }
00134
00135
00136
00137
00138
00139
00140
00141 void SetFilename( const wxString filename, wxBitmapType type, bool doread = true );
00142
00143
00144 void SetImageType( wxBitmapType type ) { m_type = type; }
00145
00146
00147 wxBitmapType GetImageType() { return m_type; }
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 void SetDrawPatternOnTop(bool drawPatternOnTop);
00159
00160
00161
00162
00163
00164
00165
00166 bool GetDrawPatternOnTop() { return m_drawPatternOnTop; }
00167
00168 DECLARE_CLASS(a2dImage)
00169
00170 protected:
00171
00172
00173 virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
00174
00175 #if wxART2D_USE_CVGIO
00176 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00177
00178 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00179 #endif //wxART2D_USE_CVGIO
00180
00181 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00182 bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
00183 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00184
00185 double m_width;
00186 double m_height;
00187
00188 wxImage m_image;
00189
00190 wxString m_filename;
00191
00192 wxBitmapType m_type;
00193
00194 bool m_drawPatternOnTop;
00195
00196 wxUint8 m_OpacityFactor;
00197
00198 public:
00199 static a2dPropertyIdDouble* PROPID_Width;
00200 static a2dPropertyIdDouble* PROPID_Height;
00201
00202 DECLARE_PROPERTIES()
00203
00204 private:
00205
00206 a2dImage( const a2dImage &other );
00207 };
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 class A2DCANVASDLLEXP a2dRgbaImage: public a2dRectMM
00221 {
00222
00223 A2D_DECLARE_EVENT_TABLE()
00224
00225 public:
00226
00227 a2dRgbaImage();
00228
00229
00230
00231
00232
00233
00234
00235
00236 a2dRgbaImage( double x, double y, wxImage& image, wxUint8 OpacityFactor );
00237
00238 a2dRgbaImage( const a2dRgbaImage& image, CloneOptions options );
00239
00240 ~a2dRgbaImage();
00241
00242
00243
00244
00245
00246 void SetOpacityFactor( wxUint8 OpacityFactor );
00247
00248
00249 wxUint8 GetOpacityFactor() { return m_OpacityFactor; }
00250
00251
00252
00253
00254
00255 void SetWidth( double w) { m_maxx = m_minx + w; SetPending(true); }
00256
00257
00258
00259
00260
00261 void SetHeight( double h) { m_maxy = m_miny + h; SetPending(true); }
00262
00263 a2dImageRGBA& GetImage() { return m_glimage; }
00264
00265 virtual a2dObject* Clone( CloneOptions options ) const;
00266
00267 #if wxART2D_USE_CVGIO
00268 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00269
00270 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00271 #endif //wxART2D_USE_CVGIO
00272
00273 DECLARE_DYNAMIC_CLASS(a2dRgbaImage)
00274
00275 protected:
00276
00277 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00278
00279 a2dImageRGBA m_glimage;
00280
00281 bool m_flip;
00282
00283 bool m_drawPatternOnTop;
00284
00285 wxUint8 m_OpacityFactor;
00286
00287 private:
00288
00289 a2dRgbaImage( const a2dRgbaImage &other );
00290 };
00291
00292
00293
00294
00295
00296
00297
00298 class A2DCANVASDLLEXP a2dImageMM: public a2dRectMM
00299 {
00300 public:
00301
00302
00303 a2dImageMM();
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313 a2dImageMM( const wxImage &image, double xc, double yc, double w, double h );
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324 a2dImageMM( const wxString &imagefile, wxBitmapType type, double xc, double yc, double w, double h );
00325
00326
00327
00328
00329
00330
00331
00332
00333 a2dImageMM( double x, double y, wxImage& image, unsigned char alpha );
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350 a2dImageMM( a2dCanvasObject* torender, double xc, double yc, double w, double h, int imagew = 100, int imageh = 100 );
00351
00352 a2dImageMM( const a2dImageMM& ori, CloneOptions options );
00353
00354 ~a2dImageMM();
00355
00356 virtual a2dObject* Clone( CloneOptions options ) const;
00357
00358
00359
00360
00361
00362 a2dCanvasObjectList* GetAsRectangles( const wxColour& col1, const wxColour& col2, bool transform );
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 void RenderObject( a2dCanvasObject* torender, int imagew = 100 , int imageh = 100 );
00376
00377
00378 wxImage& GetImage() { return m_image; }
00379
00380
00381 void SetImage( const wxImage& image ) { m_image = image; SetPending(true); }
00382
00383
00384 wxString& GetFilename() { return m_filename; }
00385
00386
00387
00388
00389
00390
00391
00392 void SetFilename( const wxString filename, wxBitmapType type, bool doread = true );
00393
00394
00395 void SetImageType( wxBitmapType type ) { m_type = type; }
00396
00397
00398 wxBitmapType GetImageType() { return m_type; }
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409 void SetDrawPatternOnTop(bool drawPatternOnTop);
00410
00411
00412
00413
00414
00415
00416
00417 bool GetDrawPatternOnTop() { return m_drawPatternOnTop; }
00418
00419 DECLARE_CLASS(a2dImageMM)
00420
00421 protected:
00422
00423
00424 virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
00425
00426 #if wxART2D_USE_CVGIO
00427 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00428
00429 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00430 #endif //wxART2D_USE_CVGIO
00431
00432 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00433 bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
00434
00435 wxImage m_image;
00436
00437 wxString m_filename;
00438
00439 wxBitmapType m_type;
00440
00441 bool m_drawPatternOnTop;
00442
00443 private:
00444
00445 a2dImageMM( const a2dImageMM &other );
00446 };
00447
00448 #endif