00001 #ifndef OSDL_POLYGON_H_
00002 #define OSDL_POLYGON_H_
00003
00004
00005 #include "OSDLPixel.h"
00006
00007 #include "Ceylan.h"
00008
00009 #include <string>
00010 #include <list>
00011
00012
00013
00014
00015 namespace OSDL
00016 {
00017
00018
00019 namespace Video
00020 {
00021
00022
00023
00024 class Surface ;
00025
00026
00027 namespace TwoDimensional
00028 {
00029
00030
00031
00032 class Point2D ;
00033
00034
00041 typedef std::list<Point2D *> listPoint2D ;
00042
00043
00055
00056
00057
00058
00059
00060
00061
00098 OSDL_DLL bool drawPie( Surface & targetSurface,
00099 Coordinate xCenter, Coordinate yCenter, Length radius,
00100 Ceylan::Maths::AngleInDegrees angleStart,
00101 Ceylan::Maths::AngleInDegrees angleStop,
00102 Pixels::ColorElement red, Pixels::ColorElement green,
00103 Pixels::ColorElement blue,
00104 Pixels::ColorElement alpha = Pixels::AlphaOpaque ) throw() ;
00105
00106
00137 OSDL_DLL bool drawPie( Surface & targetSurface,
00138 Coordinate xCenter, Coordinate yCenter, Length radius,
00139 Ceylan::Maths::AngleInDegrees angleStart,
00140 Ceylan::Maths::AngleInDegrees angleStop,
00141 Pixels::ColorDefinition colorDef ) throw() ;
00142
00143
00144
00163 OSDL_DLL bool drawTriangle( Surface & targetSurface,
00164 Coordinate x1, Coordinate y1,
00165 Coordinate x2, Coordinate y2,
00166 Coordinate x3, Coordinate y3,
00167 Pixels::ColorElement red, Pixels::ColorElement green,
00168 Pixels::ColorElement blue,
00169 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
00170 bool filled = true ) throw() ;
00171
00172
00191 OSDL_DLL bool drawTriangle( Surface & targetSurface,
00192 Coordinate x1, Coordinate y1,
00193 Coordinate x2, Coordinate y2,
00194 Coordinate x3, Coordinate y3,
00195 Pixels::ColorDefinition colorDef, bool filled = true )
00196 throw() ;
00197
00198
00217 OSDL_DLL bool drawTriangle( Surface & targetSurface,
00218 const Point2D & p1, const Point2D & p2, const Point2D & p3,
00219 Pixels::ColorElement red, Pixels::ColorElement green,
00220 Pixels::ColorElement blue,
00221 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
00222 bool filled = true ) throw() ;
00223
00224
00243 OSDL_DLL bool drawTriangle( Surface & targetSurface,
00244 const Point2D & p1, const Point2D & p2, const Point2D & p3,
00245 Pixels::ColorDefinition colorDef, bool filled = true ) throw() ;
00246
00247
00248
00277 OSDL_DLL bool drawPolygon( Surface & targetSurface,
00278 const listPoint2D & summits,
00279 Coordinate x, Coordinate y,
00280 Pixels::ColorElement red, Pixels::ColorElement green,
00281 Pixels::ColorElement blue,
00282 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
00283 bool filled = true ) throw() ;
00284
00285
00286
00316 OSDL_DLL bool drawPolygon( Surface & targetSurface,
00317 const listPoint2D & summits,
00318 Coordinate x, Coordinate y,
00319 Pixels::ColorDefinition colorDef, bool filled = true ) throw() ;
00320
00321
00322
00342 class OSDL_DLL Polygon : public Ceylan::Locatable2D
00343 {
00344
00345 public:
00346
00347
00366 explicit Polygon( listPoint2D & summits,
00367 bool listOwner = false ) throw() ;
00368
00369
00371 virtual ~Polygon() throw() ;
00372
00373
00374
00396 virtual bool draw( Surface & targetSurface,
00397 Pixels::ColorDefinition colorDef = Pixels::White,
00398 bool filled = true )
00399 const throw() ;
00400
00401
00409 virtual listPoint2D & getPoints() const throw() ;
00410
00411
00421 virtual void setPoints( listPoint2D & newList ) throw() ;
00422
00423
00424
00426 virtual bool isListOwner() const throw() ;
00427
00428
00441 virtual const std::string toString(
00442 Ceylan::VerbosityLevels level = Ceylan::high )
00443 const throw() ;
00444
00445
00446
00447
00448
00449
00450
00451
00483 static Polygon & CreateFlakeBranch(
00484 Length length = 200,
00485 Length thickness = 20,
00486 Ceylan::Maths::AngleInDegrees childAngle = 50,
00487 Ceylan::Maths::Ratio branchingHeightRatio = 0.7,
00488 Ceylan::Maths::Ratio scale = 0.3 ) throw() ;
00489
00490
00499 static listPoint2D & Duplicate( const listPoint2D & source )
00500 throw() ;
00501
00502
00508 static void Delete( listPoint2D & listToBeDeleted )
00509 throw() ;
00510
00511
00512
00529 static listPoint2D & Append( listPoint2D & toBeAugmented,
00530 const listPoint2D & toAppend ) throw() ;
00531
00532
00551 static listPoint2D & Apply(
00552 const Ceylan::Maths::Linear::HomogeneousMatrix3
00553 & transformation,
00554 listPoint2D & sourceList ) throw() ;
00555
00556
00557
00558
00559 private:
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569 #pragma warning( push )
00570 #pragma warning( disable : 4251 )
00571
00573 listPoint2D * _summits ;
00574
00575 #pragma warning( pop )
00576
00577
00583 bool _listOwner ;
00584
00585
00586
00595 explicit Polygon( const Polygon & source ) throw() ;
00596
00597
00598
00607 Polygon & operator = ( const Polygon & source ) throw() ;
00608
00609
00610 } ;
00611
00612
00613
00614
00615
00627 class OSDL_DLL PolygonSet : public Ceylan::Locatable2D
00628 {
00629
00630
00631 public:
00632
00633
00634
00644 explicit PolygonSet( bool listOwner = false ) throw() ;
00645
00646
00669 explicit PolygonSet(
00670 std::list<listPoint2D *> & polygonList,
00671 bool listOwner = false ) throw() ;
00672
00673
00675 virtual ~PolygonSet() throw() ;
00676
00677
00678
00695 virtual void addPointsOf( Polygon & newPolygon ) throw() ;
00696
00697
00698
00710 virtual void addPointList( listPoint2D & listToAdd )
00711 throw() ;
00712
00713
00720 virtual bool draw( Surface & targetSurface,
00721 Coordinate x, Coordinate y,
00722 Pixels::ColorDefinition colorDef = Pixels::White,
00723 bool filled = true )
00724 const throw() ;
00725
00726
00739 virtual const std::string toString(
00740 Ceylan::VerbosityLevels level = Ceylan::high )
00741 const throw() ;
00742
00743
00744
00745
00746
00747
00775 static PolygonSet & CreateFlake(
00776 Ceylan::Uint8 branchCount = 5,
00777 Length length = 200, Length thickness = 20,
00778 Ceylan::Maths::AngleInDegrees childAngle = 50,
00779 Ceylan::Maths::Ratio branchingHeightRatio = 0.7,
00780 Ceylan::Maths::Ratio scale = 0.3 )
00781 throw() ;
00782
00783
00784
00785 protected:
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795 #pragma warning( push )
00796 #pragma warning( disable : 4251 )
00797
00799 std::list<listPoint2D *> * _polygonList ;
00800
00801 #pragma warning( pop )
00802
00803
00809 bool _listOwner ;
00810
00811
00812
00813 private:
00814
00815
00824 explicit PolygonSet( const PolygonSet & source ) throw() ;
00825
00826
00835 PolygonSet & operator = ( const PolygonSet & source )
00836 throw() ;
00837
00838
00839 } ;
00840
00841 }
00842
00843 }
00844
00845 }
00846
00847
00848 #endif // OSDL_POLYGON_H_
00849