00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OSDL_SURFACE_H_
00028 #define OSDL_SURFACE_H_
00029
00030
00031 #include "OSDLImage.h"
00032 #include "OSDLUprightRectangle.h"
00033 #include "OSDLPalette.h"
00034
00035
00036 #include "Ceylan.h"
00037
00038 #include <string>
00039 #include <list>
00040
00041
00042 #include "OSDLIncludeCorrecter.h"
00043
00044
00045
00046 #if ! defined(OSDL_USES_SDL) || OSDL_USES_SDL
00047
00048
00049 struct SDL_Surface ;
00050
00051 #endif // ! defined(OSDL_USES_SDL) || OSDL_USES_SDL
00052
00053
00054
00055
00056 namespace OSDL
00057 {
00058
00059
00060
00061 namespace Video
00062 {
00063
00064
00065
00066 namespace TwoDimensional
00067 {
00068
00069
00070 class Point2D ;
00071
00072
00073 class Widget ;
00074
00075 }
00076
00077
00078
00079 namespace OpenGL
00080 {
00081
00082
00083 class GLTexture ;
00084
00085 }
00086
00087
00088
00089 #if ! defined(OSDL_USES_SDL) || OSDL_USES_SDL
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00101 typedef ::SDL_Surface LowLevelSurface ;
00102
00103 #else // OSDL_USES_SDL
00104
00105 struct LowLevelSurface {} ;
00106
00107 #endif // OSDL_USES_SDL
00108
00109
00110
00111
00112 typedef Ceylan::Uint32 UpdateCount ;
00113
00114
00115
00116
00117 class Palette ;
00118
00119
00120
00126 class OSDL_DLL SurfaceEvent : public Ceylan::Event
00127 {
00128
00129 public:
00130
00131 explicit SurfaceEvent( Ceylan::EventSource & source ) ;
00132
00133 SurfaceEvent() ;
00134
00135 virtual ~SurfaceEvent() throw() ;
00136
00137 } ;
00138
00139
00140
00141
00143 class OSDL_DLL VideoMemoryLostException : public VideoException
00144 {
00145
00146 public:
00147
00148 VideoMemoryLostException( const std::string & message ) ;
00149
00150
00156 VideoMemoryLostException() ;
00157
00158 virtual ~VideoMemoryLostException() throw() ;
00159
00160 } ;
00161
00162
00163
00164
00165
00166
00257 class OSDL_DLL Surface :
00258 public TwoDimensional::UprightRectangle,
00259 public Ceylan::EventSource,
00260 public Ceylan::Lockable,
00261 public Ceylan::SmartResource
00262 {
00263
00264
00265 public:
00266
00267
00268
00277 enum DisplayType
00278 {
00279 BackBuffer,
00280 ClassicalScreenSurface,
00281 OpenGLScreenSurface
00282 } ;
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00294 static const Ceylan::Flags Software ;
00295
00296
00297
00299 static const Ceylan::Flags Hardware ;
00300
00301
00302
00308 static const Ceylan::Flags AsynchronousBlit ;
00309
00310
00311
00313 static const Ceylan::Flags ExclusivePalette ;
00314
00315
00321 static const Ceylan::Flags HardwareAcceleratedBlit ;
00322
00323
00324
00326 static const Ceylan::Flags ColorkeyBlit ;
00327
00328
00329
00335 static const Ceylan::Flags RLEColorkeyBlit ;
00336
00337
00338
00340 static const Ceylan::Flags AlphaBlendingBlit ;
00341
00342
00343
00345 static const Ceylan::Flags Preallocated ;
00346
00347
00356 static const Ceylan::Flags RLEColorkeyBlitAvailable ;
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00373 static const Ceylan::Flags AnyPixelFormat ;
00374
00375
00381 static const Ceylan::Flags DoubleBuffered ;
00382
00383
00384
00390 static const Ceylan::Flags FullScreen ;
00391
00392
00393
00399 static const Ceylan::Flags OpenGL ;
00400
00401
00402
00408 static const Ceylan::Flags Resizable ;
00409
00410
00411
00412
00479 Surface( Ceylan::Flags flags, Length width, Length height,
00480 BitsPerPixel depth = 32,
00481 Pixels::ColorMask redMask = 0,
00482 Pixels::ColorMask greenMask = 0,
00483 Pixels::ColorMask blueMask = 0,
00484 Pixels::ColorMask alphaMask = 0 ) ;
00485
00486
00487
00502 explicit Surface( LowLevelSurface & surface,
00503 DisplayType displayType = BackBuffer ) ;
00504
00505
00506
00512 virtual ~Surface() throw() ;
00513
00514
00515
00530 virtual Clonable & clone() const ;
00531
00532
00533
00545 virtual LowLevelSurface & getSDLSurface() const ;
00546
00547
00548
00561 virtual void setSDLSurface( LowLevelSurface & newSurface,
00562 DisplayType displayType = BackBuffer ) ;
00563
00564
00565
00566
00572 virtual DisplayType getDisplayType() const ;
00573
00574
00575
00581 virtual void setDisplayType( DisplayType newDisplayType ) ;
00582
00583
00584
00591 virtual Ceylan::Flags getFlags() const ;
00592
00593
00594
00603 virtual void setFlags( Ceylan::Flags newFlags ) ;
00604
00605
00606
00629 virtual void convertToDisplay( bool alphaChannelWanted = true );
00630
00631
00632
00656 virtual void setAlpha( Ceylan::Flags flags,
00657 Pixels::ColorElement newAlpha ) ;
00658
00659
00660
00672 Pixels::ColorDefinition guessColorKeyDefinition() const ;
00673
00674
00675
00687 Pixels::PixelColor guessColorKey() const ;
00688
00689
00690
00717 virtual void setColorKey( Ceylan::Flags flags,
00718 Pixels::PixelColor keyPixelColor ) ;
00719
00720
00721
00749 virtual void setColorKey( Ceylan::Flags flags,
00750 Pixels::ColorDefinition keyColorDef ) ;
00751
00752
00753
00765 virtual void convertFromColorKeyToAlphaChannel() ;
00766
00767
00768
00777 virtual Palette & getPalette() const ;
00778
00779
00780
00806 virtual bool setPalette( const Palette & newPalette,
00807 ColorCount startingColorIndex = 0,
00808 ColorCount numberOfColors = 0,
00809 Ceylan::Flags targetedPalettes =
00810 Palette::Logical | Palette::Physical ) ;
00811
00812
00813
00840 Surface & createColorReducedSurfaceFor(
00841 const Palette & palette, bool manageColorkey = true )
00842 const ;
00843
00844
00845
00853 virtual Pixels::PixelFormat & getPixelFormat() const ;
00854
00855
00856
00858 virtual void setPixelFormat(
00859 Pixels::PixelFormat & newFormat ) ;
00860
00861
00862
00863
00865 virtual Pitch getPitch() const ;
00866
00867
00869 virtual void setPitch( Pitch newPitch ) ;
00870
00871
00872
00874 virtual Length getWidth() const ;
00875
00876
00877
00886 virtual void setWidth( Length newWidth ) ;
00887
00888
00889
00891 virtual Length getHeight() const ;
00892
00893
00894
00903 virtual void setHeight( Length newHeight ) ;
00904
00905
00906
00932 virtual void resize( Length newWidth, Length newHeight,
00933 bool scaleContent = false ) ;
00934
00935
00936
00945 virtual BitsPerPixel getBitsPerPixel() const ;
00946
00947
00948
00956 virtual void setBitsPerPixel( BitsPerPixel newBitsPerPixel ) ;
00957
00958
00959
00969 virtual BytesPerPixel getBytesPerPixel() const ;
00970
00971
00972
00980 virtual void setBytesPerPixel(
00981 BytesPerPixel newBytesPerPixel ) ;
00982
00983
00984
00990 virtual void * getPixels() const ;
00991
00992
00993
00999 virtual void setPixels( void * newPixels ) ;
01000
01001
01002
01016 virtual bool fill(
01017 Pixels::ColorDefinition colorDef = Pixels::Black ) ;
01018
01019
01020
01035 virtual bool clear() ;
01036
01037
01038
01058 virtual Surface & flipVertical() const ;
01059
01060
01061
01081 virtual Surface & flipHorizontal() const ;
01082
01083
01084
01097 virtual std::string describePixelAt(
01098 Coordinate x, Coordinate y ) ;
01099
01100
01101
01115 virtual Pixels::PixelColor getPixelColorAt(
01116 Coordinate x, Coordinate y ) const ;
01117
01118
01119
01134 virtual Pixels::ColorDefinition getColorDefinitionAt(
01135 Coordinate x, Coordinate y ) const ;
01136
01137
01138
01181 virtual void putRGBAPixelAt(
01182 Coordinate x, Coordinate y,
01183 Pixels::ColorElement red, Pixels::ColorElement green,
01184 Pixels::ColorElement blue,
01185 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
01186 bool blending = true, bool clipping = true,
01187 bool locking = false ) ;
01188
01189
01190
01228 virtual void putColorDefinitionAt( Coordinate x, Coordinate y,
01229 Pixels::ColorDefinition colorDef,
01230 bool blending = true, bool clipping = true,
01231 bool locking = false ) ;
01232
01233
01234
01259 virtual void putPixelColorAt( Coordinate x, Coordinate y,
01260 Pixels::PixelColor convertedColor,
01261 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
01262 bool blending = true, bool clipping = true,
01263 bool locking = false ) ;
01264
01265
01266
01291 virtual bool setAlphaForColor( Pixels::ColorDefinition colorDef,
01292 Pixels::ColorElement newAlpha ) ;
01293
01294
01295
01318 virtual bool drawHorizontalLine(
01319 Coordinate xStart, Coordinate xStop, Coordinate y,
01320 Pixels::ColorElement red, Pixels::ColorElement green,
01321 Pixels::ColorElement blue,
01322 Pixels::ColorElement alpha = Pixels::AlphaOpaque ) ;
01323
01324
01325
01348 virtual bool drawHorizontalLine(
01349 Coordinate xStart, Coordinate xStop, Coordinate y,
01350 Pixels::PixelColor actualColor ) ;
01351
01352
01353
01376 virtual bool drawHorizontalLine(
01377 Coordinate xStart, Coordinate xStop, Coordinate y,
01378 Pixels::ColorDefinition colorDef = Pixels::White ) ;
01379
01380
01381
01404 virtual bool drawVerticalLine(
01405 Coordinate x, Coordinate yStart, Coordinate yStop,
01406 Pixels::ColorElement red, Pixels::ColorElement green,
01407 Pixels::ColorElement blue,
01408 Pixels::ColorElement alpha = Pixels::AlphaOpaque ) ;
01409
01410
01411
01434 virtual bool drawVerticalLine(
01435 Coordinate x, Coordinate yStart, Coordinate yStop,
01436 Pixels::ColorDefinition colorDef = Pixels::White ) ;
01437
01438
01439
01461 virtual bool drawLine(
01462 Coordinate xStart, Coordinate yStart,
01463 Coordinate xStop, Coordinate yStop,
01464 Pixels::ColorElement red, Pixels::ColorElement green,
01465 Pixels::ColorElement blue,
01466 Pixels::ColorElement alpha = Pixels::AlphaOpaque ) ;
01467
01468
01469
01492 virtual bool drawLine(
01493 Coordinate xStart, Coordinate yStart,
01494 Coordinate xStop, Coordinate yStop,
01495 Pixels::ColorDefinition = Pixels::White ) ;
01496
01497
01498
01513 virtual bool drawCross( const TwoDimensional::Point2D & center,
01514 Pixels::ColorDefinition colorDef = Pixels::White,
01515 Length squareEdge = 5 ) ;
01516
01517
01518
01533 virtual bool drawCross( Coordinate xCenter, Coordinate yCenter,
01534 Pixels::ColorDefinition colorDef = Pixels::White,
01535 Length squareEdge = 5 ) ;
01536
01537
01538
01552 virtual bool drawEdges(
01553 Pixels::ColorDefinition edgeColor = Pixels::White,
01554 Length edgeWidth = 1 ) ;
01555
01556
01557
01568 virtual bool drawBox( const UprightRectangle & rectangle,
01569 Pixels::ColorElement red, Pixels::ColorElement green,
01570 Pixels::ColorElement blue,
01571 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
01572 bool filled = true ) ;
01573
01574
01575
01590 virtual bool drawBox( const UprightRectangle & rectangle,
01591 Pixels::ColorDefinition colorDef = Pixels::White,
01592 bool filled = true ) ;
01593
01594
01595
01624 virtual bool drawCircle(
01625 Coordinate xCenter, Coordinate yCenter,
01626 Length radius,
01627 Pixels::ColorElement red, Pixels::ColorElement green,
01628 Pixels::ColorElement blue,
01629 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
01630 bool filled = true, bool blended = true ) ;
01631
01632
01633
01663 virtual bool drawCircle(
01664 Coordinate xCenter, Coordinate yCenter,
01665 Length radius,
01666 Pixels::ColorDefinition colorDef = Pixels::White,
01667 bool filled = true, bool blended = true ) ;
01668
01669
01670
01712 virtual bool drawDiscWithEdge(
01713 Coordinate xCenter, Coordinate yCenter,
01714 Length outerRadius, Length innerRadius,
01715 Pixels::ColorDefinition ringColorDef = Pixels::Blue,
01716 Pixels::ColorDefinition discColorDef = Pixels::White,
01717 bool blended = true ) ;
01718
01719
01720
01741 virtual bool drawEllipse(
01742 Coordinate xCenter, Coordinate yCenter,
01743 Length horizontalRadius, Length verticalRadius,
01744 Pixels::ColorElement red, Pixels::ColorElement green,
01745 Pixels::ColorElement blue,
01746 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
01747 bool filled = true ) ;
01748
01749
01750
01771 virtual bool drawEllipse(
01772 Coordinate xCenter, Coordinate yCenter,
01773 Length horizontalRadius, Length verticalRadius,
01774 Pixels::ColorDefinition colorDef, bool filled = true ) ;
01775
01776
01777
01813 virtual bool drawPie(
01814 Coordinate xCenter, Coordinate yCenter,
01815 Length radius,
01816 Ceylan::Maths::AngleInDegrees angleStart,
01817 Ceylan::Maths::AngleInDegrees angleStop,
01818 Pixels::ColorElement red, Pixels::ColorElement green,
01819 Pixels::ColorElement blue,
01820 Pixels::ColorElement alpha = Pixels::AlphaOpaque ) ;
01821
01822
01823
01852 virtual bool drawPie(
01853 Coordinate xCenter, Coordinate yCenter,
01854 Length radius,
01855 Ceylan::Maths::AngleInDegrees angleStart,
01856 Ceylan::Maths::AngleInDegrees angleStop,
01857 Pixels::ColorDefinition colorDef ) ;
01858
01859
01860
01880 virtual bool drawTriangle(
01881 Coordinate x1, Coordinate y1,
01882 Coordinate x2, Coordinate y2,
01883 Coordinate x3, Coordinate y3,
01884 Pixels::ColorElement red, Pixels::ColorElement green,
01885 Pixels::ColorElement blue,
01886 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
01887 bool filled = true ) ;
01888
01889
01890
01910 virtual bool drawTriangle(
01911 Coordinate x1, Coordinate y1,
01912 Coordinate x2, Coordinate y2,
01913 Coordinate x3, Coordinate y3,
01914 Pixels::ColorDefinition colorDef,
01915 bool filled = true ) ;
01916
01917
01918
01938 virtual bool drawTriangle(
01939 const TwoDimensional::Point2D & p1,
01940 const TwoDimensional::Point2D & p2,
01941 const TwoDimensional::Point2D & p3,
01942 Pixels::ColorElement red, Pixels::ColorElement green,
01943 Pixels::ColorElement blue,
01944 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
01945 bool filled = true ) ;
01946
01947
01948
01968 virtual bool drawTriangle(
01969 const TwoDimensional::Point2D & p1,
01970 const TwoDimensional::Point2D & p2,
01971 const TwoDimensional::Point2D & p3,
01972 Pixels::ColorDefinition colorDef, bool filled = true ) ;
01973
01974
01975
02005 virtual bool drawPolygon(
02006 const std::list<TwoDimensional::Point2D *> summits,
02007 Coordinate x, Coordinate y,
02008 Pixels::ColorElement red, Pixels::ColorElement green,
02009 Pixels::ColorElement blue,
02010 Pixels::ColorElement alpha = Pixels::AlphaOpaque,
02011 bool filled = true ) ;
02012
02013
02014
02044 virtual bool drawPolygon(
02045 const std::list<TwoDimensional::Point2D *> summits,
02046 Coordinate x, Coordinate y,
02047 Pixels::ColorDefinition colorDef, bool filled = true ) ;
02048
02049
02050
02073 virtual bool drawGrid(
02074 Length columnStride = 20,
02075 Length rowStride = 20,
02076 Pixels::ColorDefinition lineColor = Pixels::White,
02077 bool fillBackground = false,
02078 Pixels::ColorDefinition backgroundColor = Pixels::Black ) ;
02079
02080
02081
02091 virtual bool printText( const std::string & text,
02092 Coordinate x, Coordinate y,
02093 Pixels::ColorElement red, Pixels::ColorElement green,
02094 Pixels::ColorElement blue,
02095 Pixels::ColorElement alpha = Pixels::AlphaOpaque ) ;
02096
02097
02098
02108 virtual bool printText( const std::string & text,
02109 Coordinate x, Coordinate y,
02110 Pixels::ColorDefinition colorDef = Pixels::White ) ;
02111
02112
02113
02114
02115
02116
02117
02118
02146 virtual bool blitTo( Surface & targetSurface ) const ;
02147
02148
02149
02181 virtual bool blitTo( Surface & targetSurface,
02182 Coordinate x, Coordinate y ) const ;
02183
02184
02185
02205 virtual bool blitTo( Surface & targetSurface,
02206 const TwoDimensional::Point2D & location ) const ;
02207
02208
02209
02230 virtual bool blitTo(
02231 Surface & targetSurface,
02232 const TwoDimensional::UprightRectangle & sourceRectangle,
02233 const TwoDimensional::Point2D & destinationLocation )
02234 const ;
02235
02236
02237
02258 virtual void displayAt( const OpenGL::GLTexture & texture,
02259 Coordinate x, Coordinate y ) const ;
02260
02261
02285 virtual void displayWithAlphaAt(
02286 const OpenGL::GLTexture & texture,
02287 Coordinate x, Coordinate y,
02288 Pixels::FloatColorElement alpha ) const ;
02289
02290
02291
02306 virtual void displayCenteredHorizontallyAt(
02307 const OpenGL::GLTexture & texture, Coordinate y ) const ;
02308
02309
02310
02328 virtual void displayCenteredHorizontallyWithAlphaAt(
02329 const OpenGL::GLTexture & texture, Coordinate y,
02330 Pixels::FloatColorElement alpha ) const ;
02331
02332
02333
02354 virtual void displayCenteredHorizontallyAt(
02355 const OpenGL::GLTexture & texture,
02356 Coordinate xOffset, Coordinate y ) const ;
02357
02358
02359
02376 virtual void displayAtCenter(
02377 const OpenGL::GLTexture & texture ) const ;
02378
02379
02380
02403 virtual void displayAtCenterWithAlpha(
02404 const OpenGL::GLTexture & texture,
02405 Pixels::FloatColorElement alpha ) const ;
02406
02407
02408
02428 virtual void displayAtCenterWithFadeIn(
02429 const OpenGL::GLTexture & texture,
02430 Ceylan::System::Millisecond fadeInDuration = 2000 ) ;
02431
02432
02433
02453 virtual void displayAtCenterWithFadeOut(
02454 const OpenGL::GLTexture & texture,
02455 Ceylan::System::Millisecond fadeOutDuration = 1000 ) ;
02456
02457
02458
02472 virtual void displayInFullscreen(
02473 const OpenGL::GLTexture & texture ) const ;
02474
02475
02476
02497 virtual void displayInFullscreenWithAlpha(
02498 const OpenGL::GLTexture & texture,
02499 Pixels::FloatColorElement alpha ) const ;
02500
02501
02502
02528 virtual void displayInFullscreenSizeWithAlphaAt(
02529 const OpenGL::GLTexture & texture,
02530 Pixels::FloatColorElement alpha,
02531 Coordinate x, Coordinate y ) const ;
02532
02533
02534
02535
02536
02537
02538
02539
02540
02541
02542
02543
02544
02545
02546
02547
02548
02549
02550
02551
02590 virtual Surface & zoom(
02591 Ceylan::Maths::Real abscissaZoomFactor,
02592 Ceylan::Maths::Real ordinateZoomFactor,
02593 bool antialiasing = true ) const ;
02594
02595
02596
02634 virtual Surface & rotoZoom(
02635 Ceylan::Maths::AngleInDegrees angle,
02636 Ceylan::Maths::Real zoomFactor,
02637 bool antialiasing = true ) const ;
02638
02639
02640
02682 virtual Surface & rotoZoom(
02683 Ceylan::Maths::AngleInDegrees angle,
02684 Ceylan::Maths::Real abscissaZoomFactor,
02685 Ceylan::Maths::Real ordinateZoomFactor,
02686 bool antialiasing = true ) const ;
02687
02688
02689
02690
02691
02692
02693
02694
02710 virtual UprightRectangle & getClippingArea() const ;
02711
02712
02713
02722 virtual void setClippingArea(
02723 UprightRectangle & newClippingArea ) ;
02724
02725
02726
02743 virtual UprightRectangle & getContentArea() const ;
02744
02745
02746
02784 virtual void loadImage(
02785 const std::string & filename,
02786 bool blitOnly = false,
02787 bool convertToDisplayFormat = true,
02788 bool convertWithAlpha = true ) ;
02789
02790
02791
02827 virtual void loadJPG(
02828 const std::string & filename,
02829 bool blitOnly = false,
02830 bool convertToDisplayFormat = true,
02831 bool convertWithAlpha = true ) ;
02832
02833
02834
02870 virtual void loadPNG(
02871 const std::string & filename,
02872 bool blitOnly = false,
02873 bool convertToDisplayFormat = true,
02874 bool convertWithAlpha = true ) ;
02875
02876
02877
02913 virtual void loadBMP(
02914 const std::string & filename,
02915 bool blitOnly = false,
02916 bool convertToDisplayFormat = true,
02917 bool convertWithAlpha = true ) ;
02918
02919
02920
02956 virtual void loadGIF(
02957 const std::string & filename,
02958 bool blitOnly = false,
02959 bool convertToDisplayFormat = true,
02960 bool convertWithAlpha = true ) ;
02961
02962
02963
02999 virtual void loadLBM(
03000 const std::string & filename,
03001 bool blitOnly = false,
03002 bool convertToDisplayFormat = true,
03003 bool convertWithAlpha = true ) ;
03004
03005
03006
03042 virtual void loadPCX(
03043 const std::string & filename,
03044 bool blitOnly = false,
03045 bool convertToDisplayFormat = true,
03046 bool convertWithAlpha = true ) ;
03047
03048
03049
03085 virtual void loadPNM(
03086 const std::string & filename,
03087 bool blitOnly = false,
03088 bool convertToDisplayFormat = true,
03089 bool convertWithAlpha = true ) ;
03090
03091
03092
03128 virtual void loadTGA(
03129 const std::string & filename,
03130 bool blitOnly = false,
03131 bool convertToDisplayFormat = true,
03132 bool convertWithAlpha = true ) ;
03133
03134
03135
03171 virtual void loadXPM(
03172 const std::string & filename,
03173 bool blitOnly = false,
03174 bool convertToDisplayFormat = true,
03175 bool convertWithAlpha = true ) ;
03176
03177
03178
03179
03199 virtual void savePNG( const std::string & filename,
03200 bool overwrite = true ) ;
03201
03202
03203
03223 virtual void saveBMP( const std::string & filename,
03224 bool overwrite = true ) ;
03225
03226
03227
03261 virtual void update() ;
03262
03263
03264
03278 virtual UpdateCount getUpdateCount() const ;
03279
03280
03281
03311 virtual void updateRectangles(
03312 const std::list<UprightRectangle *> & listRects ) ;
03313
03314
03315
03330 virtual void updateRectangle( const UprightRectangle & rect ) ;
03331
03332
03333
03351 virtual void updateRectangle(
03352 Coordinate x, Coordinate y, Length width, Length height ) ;
03353
03354
03355
03364 virtual void setRedrawState( bool needsToBeRedrawn ) ;
03365
03366
03367
03369 virtual bool getRedrawState() const ;
03370
03371
03372
03382 virtual void redraw() ;
03383
03384
03385
03394 virtual void redrawInternal() ;
03395
03396
03397
03406 virtual bool isInternalSurfaceAvailable() const ;
03407
03408
03409
03419 virtual void addWidget( TwoDimensional::Widget & widget ) ;
03420
03421
03422
03431 Surface & getWidgetRenderTarget() ;
03432
03433
03434
03446 virtual void putWidgetToFront(
03447 TwoDimensional::Widget & widget ) ;
03448
03449
03450
03461 virtual void putWidgetToBack(
03462 TwoDimensional::Widget & widget ) ;
03463
03464
03465
03474 virtual void centerMousePosition() ;
03475
03476
03477
03489 virtual void setMousePosition(
03490 Coordinate newX = 0, Coordinate newY = 0 ) ;
03491
03492
03493
03494
03495
03496
03497
03498
03512 virtual bool mustBeLocked() const ;
03513
03514
03515
03516
03517
03518
03519
03520
03528 virtual Ceylan::System::Size getSizeInMemory() const ;
03529
03530
03531
03551 virtual bool displayData(
03552 const Ceylan::Maths::IntegerData * dataArray,
03553 Ceylan::Uint32 dataCount,
03554 Pixels::ColorDefinition pencilColor,
03555 Pixels::ColorDefinition captionColor,
03556 Pixels::ColorDefinition backgroundColor,
03557 const std::string & caption = "",
03558 const UprightRectangle * inBox = 0 ) ;
03559
03560
03561
03573 virtual const std::string toString(
03574 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
03575
03576
03577
03578
03579
03580
03581
03582
03607 static Surface & LoadImage(
03608 const std::string & filename,
03609 bool convertToDisplayFormat = true,
03610 bool convertWithAlpha = true ) ;
03611
03612
03613
03638 static Surface & LoadPNG(
03639 const std::string & filename,
03640 bool convertToDisplayFormat = true,
03641 bool convertWithAlpha = true ) ;
03642
03643
03644
03669 static Surface & LoadJPG(
03670 const std::string & filename,
03671 bool convertToDisplayFormat = true,
03672 bool convertWithAlpha = true ) ;
03673
03674
03675
03688 static std::string InterpretFlags( Ceylan::Flags flags ) ;
03689
03690
03691
03693 static const Length graphAbscissaOffset ;
03694
03695
03697 static const Length graphOrdinateOffset ;
03698
03699
03700
03702 static const Length captionAbscissaOffset ;
03703
03704
03706 static const Length captionOrdinateOffset ;
03707
03708
03709
03710
03711
03712 protected:
03713
03714
03715
03725 virtual void preUnlock() ;
03726
03727
03728
03737 virtual void postLock() ;
03738
03739
03740
03741
03743 typedef Ceylan::Sint16 Offset ;
03744
03745
03746
03763 explicit Surface() ;
03764
03765
03766
03768 inline Offset getOffset() const ;
03769
03770
03772 inline void setOffset( Offset offset ) ;
03773
03774
03775
03777 virtual void flush() ;
03778
03779
03780
03790 virtual void inconsistencyDetected(
03791 const std::string & message ) const ;
03792
03793
03794
03800 LowLevelSurface * _surface ;
03801
03802
03803
03815 DisplayType _displayType ;
03816
03817
03818
03824 bool _mustBeLocked ;
03825
03826
03827
03835 UpdateCount _updateCount ;
03836
03837
03838
03839 private:
03840
03841
03842
03851 bool _needsRedraw ;
03852
03853
03854
03863 Surface( const Surface & source ) ;
03864
03865
03866
03875 Surface & operator = ( const Surface & source ) ;
03876
03877
03878 } ;
03879
03880
03881 }
03882
03883 }
03884
03885
03886
03888 OSDL_DLL std::ostream & operator << ( std::ostream & os,
03889 OSDL::Video::Surface & s ) ;
03890
03891
03892
03893 #endif // OSDL_SURFACE_H_
03894