OSDL::Video::Surface Class Reference

Represents a video buffer. More...

#include <OSDLSurface.h>

Inheritance diagram for OSDL::Video::Surface:
Inheritance graph
[legend]
Collaboration diagram for OSDL::Video::Surface:
Collaboration graph
[legend]

List of all members.

Public Types

enum  DisplayType { BackBuffer, ClassicalScreenSurface, OpenGLScreenSurface }
 

Describes the display type of a surface:

More...

Public Member Functions

 Surface (Ceylan::Flags flags, Length width, Length height, BitsPerPixel depth=32, Pixels::ColorMask redMask=0, Pixels::ColorMask greenMask=0, Pixels::ColorMask blueMask=0, Pixels::ColorMask alphaMask=0)
 Creates an empty surface, whose display type is back-buffer.
 Surface (LowLevelSurface &surface, DisplayType displayType=BackBuffer)
 Constructs an OSDL Surface from a SDL surface.
virtual ~Surface () throw ()
 Surface virtual destructor, frees internal buffer if needed.
virtual Clonable & clone () const
 Clones this Surface: creates a new Surface, exact copy of this Surface, but with no data shared with it at all.
virtual LowLevelSurfacegetSDLSurface () const
 Returns the SDL surface corresponding to that surface.
virtual void setSDLSurface (LowLevelSurface &newSurface, DisplayType displayType=BackBuffer)
 Sets this surface so that it corresponds to the supplied SDL surface.
virtual DisplayType getDisplayType () const
 Returns the display type (back-buffer, screen, etc.
virtual void setDisplayType (DisplayType newDisplayType)
 Sets the new display type (back-buffer, screen, etc.
virtual Ceylan::Flags getFlags () const
 Returns the flags caracterizing this surface.
virtual void setFlags (Ceylan::Flags newFlags)
 Sets the flags caracterizing this surface.
virtual void convertToDisplay (bool alphaChannelWanted=true)
 Converts the internal surface to the pixel format of the display, so that any blit of this surface to the screen is quicker.
virtual void setAlpha (Ceylan::Flags flags, Pixels::ColorElement newAlpha)
 Adjusts the alpha properties of the surface: sets the per-surface alpha value and/or enables or disables alpha blending.
Pixels::ColorDefinition guessColorKeyDefinition () const
 Returns the color definition of the colorkey of this surface, as attempted to be guessed from the actual pixel colors (alpha not taken into account).
Pixels::PixelColor guessColorKey () const
 Returns the pixel color of the colorkey of this surface, as attempted to be guessed from the actual pixel colors (alpha not taken into account).
virtual void setColorKey (Ceylan::Flags flags, Pixels::PixelColor keyPixelColor)
 Sets the color key (transparent pixel) in a blittable surface, and enables or disables RLE blit acceleration.
virtual void setColorKey (Ceylan::Flags flags, Pixels::ColorDefinition keyColorDef)
 Sets the color key (transparent pixel) in a blittable surface, and enables or disables RLE blit acceleration.
virtual void convertFromColorKeyToAlphaChannel ()
 Converts this surface, which must use a color key, so that it uses an alpha channel instead.
virtual PalettegetPalette () const
 Returns a palette associated with this surface, if any.
virtual bool setPalette (const Palette &newPalette, ColorCount startingColorIndex=0, ColorCount numberOfColors=0, Ceylan::Flags targetedPalettes=Palette::Logical|Palette::Physical)
 Sets this surface's palette thanks to specified one.
SurfacecreateColorReducedSurfaceFor (const Palette &palette, bool manageColorkey=true) const
 Returns a newly created 8-bit (indexed) color surface, whose pixels have been chosen in the specified palette to match best with the pixel of the surface the method has been called on.
virtual Pixels::PixelFormatgetPixelFormat () const
 Returns this surface's pixel format.
virtual void setPixelFormat (Pixels::PixelFormat &newFormat)
 Sets this surface's pixel format.
virtual Pitch getPitch () const
 Returns this surface's pitch.
virtual void setPitch (Pitch newPitch)
 Sets this surface's pitch.
virtual Length getWidth () const
 Returns the width of this Surface.
virtual void setWidth (Length newWidth)
 Sets this Surface's width.
virtual Length getHeight () const
 Returns the height of this Surface.
virtual void setHeight (Length newHeight)
 Sets this Surface's height.
virtual void resize (Length newWidth, Length newHeight, bool scaleContent=false)
 Resizes this surface so that its new dimensions are the specified ones.
virtual BitsPerPixel getBitsPerPixel () const
 Returns this surface's color depth, bits per pixel.
virtual void setBitsPerPixel (BitsPerPixel newBitsPerPixel)
 Sets this surface's color depth, bits per pixel.
virtual BytesPerPixel getBytesPerPixel () const
 Returns this surface's overall color depth, bytes per pixel.
virtual void setBytesPerPixel (BytesPerPixel newBytesPerPixel)
 Sets this surface's color depth, bytes per pixel.
virtual void * getPixels () const
 Returns this surface's video buffer, i.e.
virtual void setPixels (void *newPixels)
 Sets this surface's video buffer, i.e.
virtual bool fill (Pixels::ColorDefinition colorDef=Pixels::Black)
 Fills this surface with specified color.
virtual bool clear ()
 Clears this surface, which may be the screen surface.
virtual SurfaceflipVertical () const
 Returns the result of a vertical flip of this source surface: the result will contain the original image mirrored according to a vertical line splitting this surface into a left and right area of equal size.
virtual SurfaceflipHorizontal () const
 Returns the result of an horizontal flip of this source surface: the result will contain the original image mirrored according to an horizontal line splitting this surface into a top and bottom area of equal size.
virtual std::string describePixelAt (Coordinate x, Coordinate y)
 Returns a textual description of the pixel of this surface located at [x;y].
virtual Pixels::PixelColor getPixelColorAt (Coordinate x, Coordinate y) const
 Returns the pixel color of one particular pixel of this surface, located at [x;y], encoded according to the pixel format of this surface.
virtual Pixels::ColorDefinition getColorDefinitionAt (Coordinate x, Coordinate y) const
 Returns the color definition of one particular pixel of this surface, located at [x;y].
virtual void putRGBAPixelAt (Coordinate x, Coordinate y, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool blending=true, bool clipping=true, bool locking=false)
 Sets the pixel at [x;y] of this surface to the given color, specified as separate RGBA coordinates.
virtual void putColorDefinitionAt (Coordinate x, Coordinate y, Pixels::ColorDefinition colorDef, bool blending=true, bool clipping=true, bool locking=false)
 Sets the pixel at [x;y] of this surface to the given color, specified as a color definition (set of RGBA coordinates).
virtual void putPixelColorAt (Coordinate x, Coordinate y, Pixels::PixelColor convertedColor, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool blending=true, bool clipping=true, bool locking=false)
 Sets the pixel at [x;y] of this surface to the given color, specified as an already converted RGBA color.
virtual bool setAlphaForColor (Pixels::ColorDefinition colorDef, Pixels::ColorElement newAlpha)
virtual bool drawHorizontalLine (Coordinate xStart, Coordinate xStop, Coordinate y, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque)
 Draws an horizontal line ranging from point (xStart;y), included, to point (xStop;y), included if and only if endpoint drawing mode is set, with specified RGBA color, in this surface.
virtual bool drawHorizontalLine (Coordinate xStart, Coordinate xStop, Coordinate y, Pixels::PixelColor actualColor)
 Draws an horizontal line ranging from point (xStart;y), included, to point (xStop;y), included if and only if endpoint drawing mode is set, with specified actual RGBA pixel color, in this surface.
virtual bool drawHorizontalLine (Coordinate xStart, Coordinate xStop, Coordinate y, Pixels::ColorDefinition colorDef=Pixels::White)
 Draws an horizontal line ranging from point (xStart;y), included, to point (xStop;y), included if and only if endpoint drawing mode is set, with specified RGBA color, in this surface.
virtual bool drawVerticalLine (Coordinate x, Coordinate yStart, Coordinate yStop, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque)
 Draws a vertical line ranging from point (x;yStart), included, to point (x;yStop), included if and only if endpoint drawing mode is set, with specified RGBA color, in this surface.
virtual bool drawVerticalLine (Coordinate x, Coordinate yStart, Coordinate yStop, Pixels::ColorDefinition colorDef=Pixels::White)
 Draws a vertical line ranging from point (x;yStart), included, to point (x;yStop), included if and only if endpoint drawing mode is set, with specified RGBA color, in this surface.
virtual bool drawLine (Coordinate xStart, Coordinate yStart, Coordinate xStop, Coordinate yStop, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque)
 Draws a line in this surface, ranging from point (xStart;yStart), included, to point (xStop;yStop), included if and only if endpoint drawing mode is set, with specified RGBA color.
virtual bool drawLine (Coordinate xStart, Coordinate yStart, Coordinate xStop, Coordinate yStop, Pixels::ColorDefinition=Pixels::White)
 Draws a line in this surface, ranging from point (xStart;yStart), included, to point (xStop;yStop), included if and only if endpoint drawing mode is set, with specified RGBA color.
virtual bool drawCross (const TwoDimensional::Point2D &center, Pixels::ColorDefinition colorDef=Pixels::White, Length squareEdge=5)
 Draws a cross centered in center, included in a square whose length of edge is squareEdge.
virtual bool drawCross (Coordinate xCenter, Coordinate yCenter, Pixels::ColorDefinition colorDef=Pixels::White, Length squareEdge=5)
 Draws a cross centered in center, included in a square whose length of edge is squareEdge.
virtual bool drawEdges (Pixels::ColorDefinition edgeColor=Pixels::White, Length edgeWidth=1)
 Draws the edges of this surface, with specified color and edge width.
virtual bool drawBox (const UprightRectangle &rectangle, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool filled=true)
 Draws a box with specified RGBA color.
virtual bool drawBox (const UprightRectangle &rectangle, Pixels::ColorDefinition colorDef=Pixels::White, bool filled=true)
 Draws a box with specified RGBA color.
virtual bool drawCircle (Coordinate xCenter, Coordinate yCenter, Length radius, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool filled=true, bool blended=true)
 Draws a circle whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface.
virtual bool drawCircle (Coordinate xCenter, Coordinate yCenter, Length radius, Pixels::ColorDefinition colorDef=Pixels::White, bool filled=true, bool blended=true)
 Draws a circle whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface.
virtual bool drawDiscWithEdge (Coordinate xCenter, Coordinate yCenter, Length outerRadius, Length innerRadius, Pixels::ColorDefinition ringColorDef=Pixels::Blue, Pixels::ColorDefinition discColorDef=Pixels::White, bool blended=true)
 Draws a disc whose center is (xCenter,yCenter), of specified radius (totalRadius), filled with specified color discColorDef, with a ring in it, on its border, i.e.
virtual bool drawEllipse (Coordinate xCenter, Coordinate yCenter, Length horizontalRadius, Length verticalRadius, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool filled=true)
 Draws an ellipse whose center is (xCenter,yCenter), with specified horizontal and vertical radii, with specified RGBA color, on this surface.
virtual bool drawEllipse (Coordinate xCenter, Coordinate yCenter, Length horizontalRadius, Length verticalRadius, Pixels::ColorDefinition colorDef, bool filled=true)
 Draws an ellipse whose center is (xCenter,yCenter), with specified horizontal and vertical radii, with specified RGBA color, on this surface.
virtual bool drawPie (Coordinate xCenter, Coordinate yCenter, Length radius, Ceylan::Maths::AngleInDegrees angleStart, Ceylan::Maths::AngleInDegrees angleStop, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque)
 Draws a polygon-based filled pie whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface, starting from angleStart, stopping to angleStop, both expressed in degrees.
virtual bool drawPie (Coordinate xCenter, Coordinate yCenter, Length radius, Ceylan::Maths::AngleInDegrees angleStart, Ceylan::Maths::AngleInDegrees angleStop, Pixels::ColorDefinition colorDef)
 Draws a polygon-based filled pie whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface, starting from angleStart, stopping to angleStop.
virtual bool drawTriangle (Coordinate x1, Coordinate y1, Coordinate x2, Coordinate y2, Coordinate x3, Coordinate y3, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool filled=true)
 Draws a triangle defined by specified three points, with specified RGBA color, on this surface.
virtual bool drawTriangle (Coordinate x1, Coordinate y1, Coordinate x2, Coordinate y2, Coordinate x3, Coordinate y3, Pixels::ColorDefinition colorDef, bool filled=true)
 Draws a triangle defined by specified three points, with specified RGBA color, on this surface.
virtual bool drawTriangle (const TwoDimensional::Point2D &p1, const TwoDimensional::Point2D &p2, const TwoDimensional::Point2D &p3, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool filled=true)
 Draws a triangle defined by specified three points, with specified RGBA color, on this surface.
virtual bool drawTriangle (const TwoDimensional::Point2D &p1, const TwoDimensional::Point2D &p2, const TwoDimensional::Point2D &p3, Pixels::ColorDefinition colorDef, bool filled=true)
 Draws a triangle defined by specified three points, with specified RGBA color, on this surface.
virtual bool drawPolygon (const std::list< TwoDimensional::Point2D * > summits, Coordinate x, Coordinate y, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool filled=true)
 Draws a polygon defined by specified list of points, with specified RGBA color, on specified surface.
virtual bool drawPolygon (const std::list< TwoDimensional::Point2D * > summits, Coordinate x, Coordinate y, Pixels::ColorDefinition colorDef, bool filled=true)
 Draws a polygon defined by specified list of points, with specified RGBA color, on specified surface.
virtual bool drawGrid (Length columnStride=20, Length rowStride=20, Pixels::ColorDefinition lineColor=Pixels::White, bool fillBackground=false, Pixels::ColorDefinition backgroundColor=Pixels::Black)
 Draws a grid, with specified space between columns and rows and specified colors.
virtual bool printText (const std::string &text, Coordinate x, Coordinate y, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque)
 Prints specified string on this surface, with specified color, taking as upper left corner specified coordinates.
virtual bool printText (const std::string &text, Coordinate x, Coordinate y, Pixels::ColorDefinition colorDef=Pixels::White)
 Prints specified string on this surface, with specified color, taking as upper left corner specified coordinates.
virtual bool blitTo (Surface &targetSurface) const
 Blits this surface onto specified surface.
virtual bool blitTo (Surface &targetSurface, Coordinate x, Coordinate y) const
 Blits this surface onto specified surface.
virtual bool blitTo (Surface &targetSurface, const TwoDimensional::Point2D &location) const
 Blits this surface onto specified surface.
virtual bool blitTo (Surface &targetSurface, const TwoDimensional::UprightRectangle &sourceRectangle, const TwoDimensional::Point2D &destinationLocation) const
 Blits this surface onto specified surface.
virtual void displayAt (const OpenGL::GLTexture &texture, Coordinate x, Coordinate y) const
 Displays the specified texture at the specified location on that surface, supposed to be the screen surface, at natural size (i.e.
virtual void displayWithAlphaAt (const OpenGL::GLTexture &texture, Coordinate x, Coordinate y, Pixels::FloatColorElement alpha) const
 Displays the specified texture at the specified location on that surface, supposed to be the screen surface, at natural size (i.e.
virtual void displayCenteredHorizontallyAt (const OpenGL::GLTexture &texture, Coordinate y) const
 Displays the specified texture at specified ordinate, at original size, horizontally centered.
virtual void displayCenteredHorizontallyWithAlphaAt (const OpenGL::GLTexture &texture, Coordinate y, Pixels::FloatColorElement alpha) const
 Displays the specified texture at specified ordinate, at original size, horizontally centered, blended on the background based on specified alpha component.with .
virtual void displayCenteredHorizontallyAt (const OpenGL::GLTexture &texture, Coordinate xOffset, Coordinate y) const
 Displays the specified texture at specified ordinate and, horizontally, with a left and right border of width xOffset, scaling accordingly the texture.
virtual void displayAtCenter (const OpenGL::GLTexture &texture) const
 Displays the specified texture at the center of that surface, supposed to be the screen surface, at natural size (i.e.
virtual void displayAtCenterWithAlpha (const OpenGL::GLTexture &texture, Pixels::FloatColorElement alpha) const
 Displays the specified texture at the center of that surface, supposed to be the screen surface, at natural size (i.e.
virtual void displayAtCenterWithFadeIn (const OpenGL::GLTexture &texture, Ceylan::System::Millisecond fadeInDuration=2000)
 Displays the specified texture at the center of that surface, supposed to be the screen surface, at natural size (i.e.
virtual void displayAtCenterWithFadeOut (const OpenGL::GLTexture &texture, Ceylan::System::Millisecond fadeOutDuration=1000)
 Displays the specified texture at the center of that surface, supposed to be the screen surface, at natural size (i.e.
virtual void displayInFullscreen (const OpenGL::GLTexture &texture) const
 Displays the specified texture in the full screen surface, possibly zooming (if the texture has a different size from the viewport) and distorting (if they have different width/height ratio.
virtual void displayInFullscreenWithAlpha (const OpenGL::GLTexture &texture, Pixels::FloatColorElement alpha) const
 Displays the specified texture in the full screen surface, possibly zooming (if the texture has a different size from the viewport) and distorting (if they have different width/height ratio), blended on the background based on specified alpha component.
virtual void displayInFullscreenSizeWithAlphaAt (const OpenGL::GLTexture &texture, Pixels::FloatColorElement alpha, Coordinate x, Coordinate y) const
 Displays the specified texture with a size corresponding to the full screen surface, possibly zooming (if the texture has a different size from the viewport) and distorting (if they have different width/height ratio), blended on the background based on specified alpha component, at specified onscreen location.
virtual Surfacezoom (Ceylan::Maths::Real abscissaZoomFactor, Ceylan::Maths::Real ordinateZoomFactor, bool antialiasing=true) const
 Returns a newly created surface, obtained from this surface after a zoom of given factors.
virtual SurfacerotoZoom (Ceylan::Maths::AngleInDegrees angle, Ceylan::Maths::Real zoomFactor, bool antialiasing=true) const
 Returns a newly created surface, obtained from this surface after a rotation of given angle and a zoom of given factor.
virtual SurfacerotoZoom (Ceylan::Maths::AngleInDegrees angle, Ceylan::Maths::Real abscissaZoomFactor, Ceylan::Maths::Real ordinateZoomFactor, bool antialiasing=true) const
 Returns a newly created surface, obtained from this surface after a rotation of given angle and zooms of given factors.
virtual UprightRectanglegetClippingArea () const
 Returns this surface's clipping area, expressed thanks to an UprightRectangle.
virtual void setClippingArea (UprightRectangle &newClippingArea)
 Sets this surface's clipping area, expressed thanks to an UprightRectangle, whose ownership is left to the caller.
virtual UprightRectanglegetContentArea () const
 Returns this surface's content area, expressed thanks to an UprightRectangle.
virtual void loadImage (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads an image, whose format will be auto-detected, from specified file, into this surface.
virtual void loadJPG (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads a JPEG image from specified file into this surface.
virtual void loadPNG (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads a PNG image from specified file into this surface.
virtual void loadBMP (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads a BMP image from specified file into this surface.
virtual void loadGIF (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads a GIF image from specified file into this surface.
virtual void loadLBM (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads a LBM image from specified file into this surface.
virtual void loadPCX (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads a PCX image from specified file into this surface.
virtual void loadPNM (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads a PNM image from specified file into this surface.
virtual void loadTGA (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads a TGA image from specified file into this surface.
virtual void loadXPM (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Loads a XPM image from specified file into this surface.
virtual void savePNG (const std::string &filename, bool overwrite=true)
 Saves the current content of this surface into a PNG file.
virtual void saveBMP (const std::string &filename, bool overwrite=true)
 Saves the current content of this surface into a BMP file.
virtual void update ()
 Updates the display with this surface, which will be automatically set in an up-to-date state if necessary, so that it is fully redrawn, including its widgets.
virtual UpdateCount getUpdateCount () const
 Returns the current number of updates for that surface.
virtual void updateRectangles (const std::list< UprightRectangle * > &listRects)
 Updates the part of this surface corresponding to the specified list of rectangles.
virtual void updateRectangle (const UprightRectangle &rect)
 Updates the part of this surface corresponding to specified rectangle.
virtual void updateRectangle (Coordinate x, Coordinate y, Length width, Length height)
 Updates the part of this surface corresponding to specified rectangle.
virtual void setRedrawState (bool needsToBeRedrawn)
 Sets the need for redraw state.
virtual bool getRedrawState () const
 Returns the current need for redraw state.
virtual void redraw ()
 Redraws this surface if needed, and handles automatically its tree of widgets so that it gets fully up-to-date and ready to be blitted.
virtual void redrawInternal ()
 Basic do-nothing redraw method for internal rendering.
virtual bool isInternalSurfaceAvailable () const
 Tells whether the internal SDL surface is void or not.
virtual void addWidget (TwoDimensional::Widget &widget)
 Registers specified widget to this surface, and put it at top level.
SurfacegetWidgetRenderTarget ()
 Returns the surface that should be targeted by widgets having to blit their renderings to their container.
virtual void putWidgetToFront (TwoDimensional::Widget &widget)
 Changes stacking inside this container surface so that specified widget is put to front.
virtual void putWidgetToBack (TwoDimensional::Widget &widget)
 Changes stacking inside this container surface so that specified widget is put to back.
virtual void centerMousePosition ()
 Centers in the middle of the screen the position of the mouse cursor, by generating a mouse motion event.
virtual void setMousePosition (Coordinate newX=0, Coordinate newY=0)
 Sets the position of the mouse cursor, by generating a mouse motion event.
virtual bool mustBeLocked () const
 Tells whether this surface has to be locked before modifying it.
virtual Ceylan::System::Size getSizeInMemory () const
 Returns the approximate size in memory, in bytes, currently taken by this object.
virtual bool displayData (const Ceylan::Maths::IntegerData *dataArray, Ceylan::Uint32 dataCount, Pixels::ColorDefinition pencilColor, Pixels::ColorDefinition captionColor, Pixels::ColorDefinition backgroundColor, const std::string &caption="", const UprightRectangle *inBox=0)
 Displays specified set of data, defined by dataArray, an array of dataCount IntegerData elements, as a curve drawn with pencilColor, on a background whose color is backgroundColor.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns an user-friendly description of the state of this object.
virtual Point2D getUpperLeftCorner () const
 Returns this UprightRectangle's upper left corner.
virtual void setUpperLeftCorner (Point2D &newUpperLeftCorner)
 Sets this UprightRectangle's upper left corner, width and height do not change.
virtual Coordinate getUpperLeftAbscissa () const
 Returns directly the abscissa of upper left corner.
virtual void setUpperLeftAbscissa (Coordinate newAbscissa)
 Sets directly the abscissa of the upper left corner of this rectangle.
virtual Coordinate getUpperLeftOrdinate () const
 Returns directly the ordinate of upper left corner.
virtual void setUpperLeftOrdinate (Coordinate newOrdinate)
 Sets directly the ordinate of the upper left corner of this rectangle.
virtual Point2D getLowerRightCorner () const
 Returns this UprightRectangle's lower right corner.
virtual void setLowerRightCorner (Point2D &newLowerRightCorner)
 Sets directly the lower right corner of this rectangle.
virtual Coordinate getLowerRightAbscissa () const
 Returns directly the abscissa of lower right corner.
virtual void setLowerRightAbscissa (Coordinate newAbscissa)
 Sets directly the abscissa of the lower right corner of this rectangle.
virtual Coordinate getLowerRightOrdinate () const
 Returns directly the ordinate of lower right corner.
virtual void setLowerRightOrdinate (Coordinate newOrdinate)
 Sets directly the ordinate of the lower right corner of this rectangle.
virtual bool draw (Surface &target, Pixels::ColorElement red, Pixels::ColorElement blue, Pixels::ColorElement green, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool filled=true) const
 Draws this UprightRectangle to specified surface with specified RGBA color.
virtual bool draw (Surface &target, Pixels::ColorDefinition colorDef=Pixels::White, bool filled=true) const
 Draws this UprightRectangle to specified surface with specified RGBA color.
virtual bool drawWithRoundedCorners (Surface &target, Length edgeWidth=3, Pixels::ColorDefinition edgeColorDef=Pixels::White, Pixels::ColorDefinition backgroundColorDef=Pixels::Transparent) const
 Draws this UprightRectangle to specified surface with rounded corners, drawn with specified color, above a background of specified color.
virtual Length computeRadiusForRoundRectangle (Length edgeWidth) const
 Computes the preferred radius of round corners for this rectangle, with the specified edge width.
virtual LowLevelRect * toLowLevelRect () const

Static Public Member Functions

static SurfaceLoadImage (const std::string &filename, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Surface factory: creates a new Surface instance from specified image file.
static SurfaceLoadPNG (const std::string &filename, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Surface factory: creates a new Surface instance from specified PNG image file.
static SurfaceLoadJPG (const std::string &filename, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 Surface factory: creates a new Surface instance from specified JPG image file.
static std::string InterpretFlags (Ceylan::Flags flags)
 Outputs a textual description of the given surface flags.

Static Public Attributes

static const Ceylan::Flags Software = 0x00000000
 Indicates that a surface is to be stored in system memory.
static const Ceylan::Flags Hardware = 0x00000001
 Indicates that a surface is to be stored in video memory.
static const Ceylan::Flags AsynchronousBlit = 0x00000004
 Indicates that a surface should use asynchronous blits if possible.
static const Ceylan::Flags ExclusivePalette = 0x20000000
 Indicates that a surface should have an exclusive palette.
static const Ceylan::Flags HardwareAcceleratedBlit = 0x00000100
 Indicates that a surface is to use hardware-accelerated blits.
static const Ceylan::Flags ColorkeyBlit = 0x00001000
 Indicates that a surface is to use colorkey blits.
static const Ceylan::Flags RLEColorkeyBlit = 0x00004000
 Indicates that a surface is to use RLE-accelerated colorkey blits.
static const Ceylan::Flags AlphaBlendingBlit = 0x00010000
 Indicates that a surface is to use alpha blending blits.
static const Ceylan::Flags Preallocated = 0x01000000
 Indicates that a surface is to use preallocated memory.
static const Ceylan::Flags RLEColorkeyBlitAvailable = 0x00002000
 Indicates that RLE colorkey blit is actually accelerated (read-only).
static const Ceylan::Flags AnyPixelFormat = 0x10000000
 Indicates that a display surface may use any pixel format.
static const Ceylan::Flags DoubleBuffered = 0x40000000
 Indicates that a display surface is to be double buffered.
static const Ceylan::Flags FullScreen = 0x80000000
 Indicates that a display surface is to be full screen, not windowed.
static const Ceylan::Flags OpenGL = 0x00000002
 Indicates that a display surface should have an OpenGL context.
static const Ceylan::Flags Resizable = 0x00000010
 Indicates that a display surface is to be resizable.
static const Length graphAbscissaOffset = 10
 Offset used when drawing curve in a container.
static const Length graphOrdinateOffset = 15
 Offset used when drawing curve in a container.
static const Length captionAbscissaOffset = 5
 Offset used when printing caption in a container.
static const Length captionOrdinateOffset = 10
 Offset used when printing caption in a container.

Protected Types

typedef Ceylan::Sint16 Offset
 Offset of a Surface.

Protected Member Functions

virtual void preUnlock ()
 Effective unlocking of the surface.
virtual void postLock ()
 Effective locking of the surface.
 Surface ()
 Creates a completely void surface, whose display type is back-buffer.
Offset getOffset () const
 Returns this surface's offset.
void setOffset (Offset offset)
 Sets this surface's offset.
virtual void flush ()
 Releases internal SDL surface.
virtual void inconsistencyDetected (const std::string &message) const
 Triggered when an abnormal inconsistency is detected between OSDL's surface state and its back-end counterpart.

Protected Attributes

LowLevelSurface_surface
 This internal structure also contains private fields not used here.
DisplayType _displayType
 Tells what is the display type of this surface.
bool _mustBeLocked
 Tells whether this surface must be locked before modifying it.
UpdateCount _updateCount
 Counts the number of updates for this surface.
Coordinate _x
 Upper left corner's abscissa (horizontal coordinate).
Coordinate _y
 Upper left corner's ordinate (vertical coordinate).

Private Member Functions

 Surface (const Surface &source)
 Copy constructor made private to ensure that it will never be called.
Surfaceoperator= (const Surface &source)
 Assignment operator made private to ensure that it will never be called.

Private Attributes

bool _needsRedraw
 Tells whether the surface would need to be redrawn.

Detailed Description

Represents a video buffer.

Its display type depends on whether this buffer corresponds to a back-buffer or to the screen (display buffer) and, in this case, on whether it is OpenGL-based.

A Surface is an UprightRectangle for its shape. Note that it therefore inherits _width and _height attributes from UprightRectangle, but they are not of use for Surfaces since the only values that matter for them are to be read directly from the internal back-end surface. Hence getWidth() and getHeight() should always be used, even for the implementation of Surface's own methods, instead of _width and _height.

The clipping area of a Surface is another UprightRectangle, which must be entirely contained in its Surface.

Surfaces are Lockable UpRightRectangle instances. They are also Smart resources, which implies they are Mesurable and Clonable.

In the future, Surface instances may use smart pointers or reference counting (AddRef/Release) from Ceylan.

Surfaces can contain widgets, which they own.

Surfaces maintain a 'need for redraw' state, which determines whether a given surface has to be redrawn. As soon as a graphical element (be it Surface, Widget or other) needs to be redrawn, the whole container tree has to be itself rescanned, because of possibly overlapping elements.

See also:
OSDL-usersguide.html for more detailed informations on widget management.

Surface will automatically disable locking/unlocking if possible, one does not therefore need to test it with Surface::mustBeLocked before locking or unlocking it.

Note:
In case the surface is double-buffered, and if everything is not to be redrawn at each frame, the surface should be drawn twice, so that both buffers are filled.

Surface is firstly a mere proxy-object of its backend counterpart, LowLevelSurface. However advanced services have been added, to provide higher level abstractions of video buffers.

Surface class is designed to always have a valid internal SDL surface.

A surface being a widget container, it is an event source, since it must register its widgets so that they perform pick-correlation or get, for example, demand for redraw events.

Stacking is handled thanks to a list of widgets, which is this event source's listeners list, listeners being sorted from bottom to top. Therefore, to redraw the whole surface once it has been primarily rendered, its widgets are in turn redraw, thanks to a simple iteration on listener ordered list: they should be then drawn from bottom to top, so that widget overlapping is properly managed.

Obviously no widget should be registered more than once.

Images can be loaded in Surfaces, supported formats are:

Surfaces can be stretched, zoomed, rotated, etc.

See also:
UprightRectangle, TwoDimensional::Image, Ceylan::Lockable
testOSDLVideo.cc
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fDisplayFormat

Screen surfaces have also methods to control the mouse position.

Definition at line 257 of file OSDLSurface.h.


Member Typedef Documentation

typedef Ceylan::Sint16 OSDL::Video::Surface::Offset [protected]

Offset of a Surface.

Definition at line 3743 of file OSDLSurface.h.


Member Enumeration Documentation

Describes the display type of a surface:

  • BackBuffer for non display surfaces
  • ClassicalScreenSurface for usual screen surfaces
  • OpenGLScreenSurface for OpenGL-based screen surfaces
Enumerator:
BackBuffer 
ClassicalScreenSurface 
OpenGLScreenSurface 

Definition at line 277 of file OSDLSurface.h.


Constructor & Destructor Documentation

OSDL::Video::Surface::Surface ( Ceylan::Flags  flags,
Length  width,
Length  height,
BitsPerPixel  depth = 32,
Pixels::ColorMask  redMask = 0,
Pixels::ColorMask  greenMask = 0,
Pixels::ColorMask  blueMask = 0,
Pixels::ColorMask  alphaMask = 0 
)

Creates an empty surface, whose display type is back-buffer.

On creation this Surface will contain only black pixels:

Actually all created surfaces have all bytes set to zero for efficiency reasons, therefore all pixel colors are zero too, which explains the difference between the RGB and the RGBA cases. In the latter case, use 'fill(Pixels::Black)' to have all pixels set to a non-fully transparent color such as RGBA = [0;0;0;Pixels::AlphaOpaque].

A surface is RGBA iff its alpha mask is non null. It in turn implies that the AlphaBlending flag is set.

Parameters:
flags specify the type of Surface that should be created. This can be any combination of:

If color masks are all zeros (for instance, if their value is not specified) then they will be set as RGBA coordinates convenient for OpenGL, according to the endianness of the system.

Parameters:
width the width of this new surface.
height the height of this new surface.
depth if its value is 8 (bits), an empty palette is allocated for the surface, otherwise a 'packed-pixel' pixel format is created, using the [RGBA] mask's provided, if any, or the default masks.
redMask the mask to be used to isolate the red component.
greenMask the mask to be used to isolate the green component.
blueMask the mask to be used to isolate the blue component.
alphaMask the mask to be used to isolate the alpha component. If non null, the Surface::AlphaBlendingBlit flag is automatically set.
Exceptions:
VideoException if an error occurred.
Note:
If all four color masks are left undefined or are set to zero, then the masks will be set automatically to the ones expected by OpenGL for textures.
If an alpha-channel is specified (that is, if alphaMask is nonzero), then the Surface::AlphaBlendingBlit flag is automatically set. You may remove this flag by calling setAlpha after surface creation.
Surface::Surface ( LowLevelSurface surface,
DisplayType  displayType = BackBuffer 
) [explicit]

Constructs an OSDL Surface from a SDL surface.

Parameters:
surface the SDL surface to manage, whose ownership is taken by this OSDL Surface.
displayType tells what is the display type of the provided surface, i.e. whether it is a backbuffer or a screen surface, usual or OpenGL-based.
Exceptions:
VideoException if the operation failed or is not supported.

Definition at line 248 of file OSDLSurface.cc.

References CHECKPOINT.

Surface::~Surface (  )  throw () [virtual]

Surface virtual destructor, frees internal buffer if needed.

Definition at line 411 of file OSDLSurface.cc.

References _displayType, BackBuffer, CHECKPOINT, flush(), and OSDL::Video::Pixels::toString().

Surface::Surface (  )  [explicit, protected]

Creates a completely void surface, whose display type is back-buffer.

Useful in order to have it filled with a loaded image, with Surface::load* and blitOnly set to false.

Note:
Use with care, the created surface is mainly uninitialized.
See also:
Surface::loadPNG
Exceptions:
VideoException if the operation failed or is not supported.

Definition at line 382 of file OSDLSurface.cc.

References CHECKPOINT.

Referenced by OSDL::Video::TwoDimensional::BackBufferedWidget::BackBufferedWidget(), clone(), createColorReducedSurfaceFor(), flipHorizontal(), flipVertical(), LoadImage(), LoadJPG(), LoadPNG(), rotoZoom(), and zoom().

Surface::Surface ( const Surface source  )  [private]

Copy constructor made private to ensure that it will never be called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.

Definition at line 4210 of file OSDLSurface.cc.


Member Function Documentation

void Surface::addWidget ( TwoDimensional::Widget widget  )  [virtual]

Registers specified widget to this surface, and put it at top level.

Note:
The specified widget cannot be 'const' since, for example, a redraw event might result in a change in the widget.

Definition at line 3408 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Widget::toString().

bool Surface::blitTo ( Surface targetSurface,
const TwoDimensional::UprightRectangle sourceRectangle,
const TwoDimensional::Point2D destinationLocation 
) const [virtual]

Blits this surface onto specified surface.

Parameters:
targetSurface the destination surface this surface will be blitted to.
sourceRectangle a clipping rectangle defining which part of this surface is to be blitted.
destinationLocation the point of the destination surface where this surface will be blitted.
Exceptions:
VideoMemoryLostException if either of the surfaces were in video memory, and if the video memory was lost: it then should be reloaded with content and re-blitted.
Note:
Should not be called on a locked surface.

Definition at line 2033 of file OSDLSurface.cc.

References OSDL::Utils::getBackendLastError(), getSDLSurface(), OSDL::Video::TwoDimensional::Point2D::getX(), OSDL::Video::TwoDimensional::Point2D::getY(), OSDL::Video::TwoDimensional::UprightRectangle::toLowLevelRect(), OSDL::Video::TwoDimensional::Point2D::toString(), and OSDL::Video::TwoDimensional::UprightRectangle::toString().

bool Surface::blitTo ( Surface targetSurface,
const TwoDimensional::Point2D location 
) const [virtual]

Blits this surface onto specified surface.

Parameters:
targetSurface the destination surface this surface will be blitted to.
location the point of the destination surface where this surface will be blitted.
Exceptions:
VideoMemoryLostException if either of the surfaces was in video memory, and if the video memory was lost: it then should be reloaded with content and re-blitted. Otherwise, if blit went wrong differently, throw a commented VideoException.
Note:
Should not be called on a locked surface.

Definition at line 2023 of file OSDLSurface.cc.

References blitTo(), OSDL::Video::TwoDimensional::Point2D::getX(), and OSDL::Video::TwoDimensional::Point2D::getY().

bool Surface::blitTo ( Surface targetSurface,
Coordinate  x,
Coordinate  y 
) const [virtual]

Blits this surface onto specified surface.

Blits from a RGBA Surface with AlphaBlendingBlit set to another RGBA surface will keep the alpha of the destination surface. This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them: the destination alpha will work as a mask. Hence one might set the alpha of the destination surface to targeted value before the blit.

Parameters:
targetSurface the destination surface this surface will be blitted to.
x abscissa of the destination surface where this surface will be blitted.
y ordinate of the destination surface where this surface will be blitted
Exceptions:
VideoMemoryLostException if either of the surfaces were in video memory, and if the video memory was lost: it then should be reloaded with content and re-blitted. Otherwise, if blit went wrong differently, throw a commented VideoException.
Note:
Should not be called on a locked surface.

Definition at line 1952 of file OSDLSurface.cc.

References OSDL::Utils::getBackendLastError(), getSDLSurface(), and OSDL::Video::Pixels::toString().

bool Surface::blitTo ( Surface targetSurface  )  const [virtual]

Blits this surface onto specified surface.

Blits from a RGBA Surface with AlphaBlendingBlit set to another RGBA surface will keep the alpha of the destination surface. This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them: the destination alpha will work as a mask. Hence one might set the alpha of the destination surface to targeted value before the blit.

Parameters:
targetSurface the destination surface this surface will be blitted to, starting at [0;0] in the destination surface: both upper left corners will correspond.
Exceptions:
VideoMemoryLostException if either of the surfaces was in video memory, and if the video memory was lost: it then should be reloaded with content and re-blitted. Otherwise, if blit went wrong differently, throw a commented VideoException.
Note:
Should not be called on a locked surface.

Definition at line 1943 of file OSDLSurface.cc.

Referenced by OSDL::Video::TwoDimensional::Text::TrueTypeFont::blitLatin1Glyph(), OSDL::Video::TwoDimensional::Text::Font::blitLatin1MultiLineText(), OSDL::Video::TwoDimensional::Text::Font::blitLatin1Text(), OSDL::Video::TwoDimensional::Text::Font::blitLatin1Word(), blitTo(), OSDL::Video::TwoDimensional::drawDiscWithEdge(), OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Widget::redraw(), OSDL::Video::TwoDimensional::BackBufferedWidget::redraw(), OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer(), OSDL::Video::TwoDimensional::BackBufferedWidget::redrawInternal(), OSDL::Video::TwoDimensional::Text::Font::renderLatin1MultiLineText(), OSDL::Video::TwoDimensional::Text::Font::renderLatin1TextWithWordCached(), resize(), and OSDL::Video::OpenGL::GLTexture::setUpInternalSurfaceFrom().

void Surface::centerMousePosition (  )  [virtual]

Centers in the middle of the screen the position of the mouse cursor, by generating a mouse motion event.

Note:
Must be called on a screen surface, with mouse enabled of course.

Definition at line 3489 of file OSDLSurface.cc.

References getHeight(), getWidth(), and setMousePosition().

bool Surface::clear (  )  [virtual]

Clears this surface, which may be the screen surface.

This method clears the viewport for OpenGL surfaces (both the color buffer and the depth buffer), otherwise performs a mere 'fill' with pure black.

Returns:
true iff the operation succeeded.
Note:
Locks surface if needed.
Exceptions:
VideoException if the operation failed.

Definition at line 967 of file OSDLSurface.cc.

References _displayType, OSDL::Video::Pixels::Black, fill(), and OpenGLScreenSurface.

Referenced by displayAtCenterWithFadeIn(), and displayAtCenterWithFadeOut().

Clonable & Surface::clone (  )  const [virtual]

Clones this Surface: creates a new Surface, exact copy of this Surface, but with no data shared with it at all.

The display type of the clone will be back-buffer.

Exceptions:
VideoException on failure, such as the impossibility of creating the new surface, or to blit the former one.
Note:
Returns 'Clonable' instead of 'Surface' since adjusting pointers for covariant returns is not implemented yet with gcc (3.3.5).

Definition at line 460 of file OSDLSurface.cc.

References _surface, BackBuffer, OSDL::Utils::getBackendLastError(), getBitsPerPixel(), OSDL::Video::Pixels::getCurrentColorMasks(), getFlags(), getHeight(), getPixelFormat(), getWidth(), Surface(), and OSDL::Video::Pixels::toString().

Length UprightRectangle::computeRadiusForRoundRectangle ( Length  edgeWidth  )  const [virtual, inherited]

Computes the preferred radius of round corners for this rectangle, with the specified edge width.

Parameters:
edgeWidth the edge width to take into account for the radius.
Returns:
a suitable radius, whose dimension is deemed appropriate.
Exceptions:
VideoException if no radius can fullfill the set of constraints due to this rectangle and the edge width.

Definition at line 770 of file OSDLUprightRectangle.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::getHeight(), OSDL::Video::TwoDimensional::UprightRectangle::getWidth(), OSDL::Video::TwoDimensional::UprightRectangle::toString(), and OSDL::Video::Pixels::toString().

Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().

void Surface::convertFromColorKeyToAlphaChannel (  )  [virtual]

Converts this surface, which must use a color key, so that it uses an alpha channel instead.

This method uses 'convertToDisplay'.

Exceptions:
VideoException if no internal surface is available, if it does not use color key, if the conversion failed or if there is not enough memory.

Definition at line 758 of file OSDLSurface.cc.

References ColorkeyBlit, convertToDisplay(), getFlags(), and toString().

void Surface::convertToDisplay ( bool  alphaChannelWanted = true  )  [virtual]

Converts the internal surface to the pixel format of the display, so that any blit of this surface to the screen is quicker.

The backend must already be initialized.

Parameters:
alphaChannelWanted tells whether this converted surface should have an alpha channel after this call.

This method can be used to convert a colorkey to an alpha channel, if the ColorkeyBlit flag is already set on this surface and if alphaChannelWanted is true. The generated surface will then be transparent (alpha=AlphaTransparent) where the pixels match the colorkey, and opaque (alpha=AlphaOpaque) elsewhere.

Exceptions:
VideoException if no internal surface is available, if the conversion failed or if there is not enough memory.

Definition at line 613 of file OSDLSurface.cc.

References _surface.

Referenced by OSDL::Video::TwoDimensional::BackBufferedWidget::BackBufferedWidget(), OSDL::Video::TwoDimensional::Text::FixedFont::basicRenderLatin1Glyph(), OSDL::Video::TwoDimensional::Text::Font::basicRenderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), convertFromColorKeyToAlphaChannel(), OSDL::Video::TwoDimensional::Text::Font::renderLatin1MultiLineText(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::Font::renderLatin1TextWithWordCached(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text(), and OSDL::Video::TwoDimensional::Widget::Widget().

Surface & Surface::createColorReducedSurfaceFor ( const Palette palette,
bool  manageColorkey = true 
) const

Returns a newly created 8-bit (indexed) color surface, whose pixels have been chosen in the specified palette to match best with the pixel of the surface the method has been called on.

Parameters:
palette the target palette for the color reduction.
manageColorkey tells whether a colorkey should be taken care of: if true, an attempt to guess the colorkey of this surface will be performed. If it succeeds then during color-reduction this guessed colorkey will be matched with the supposedly declared palette colorkey, no matter how different there colors are. This way colorkey information is kept existing and separated from the other colors.
Exceptions:
VideoException if the operation failed, included if manageColorkey is true but no colorkey could be guessed or if it is guessed but there is no colorkey registered in target palette.
Note:
No ownership is taken for the specified palette, the created surface will have its own one.

Definition at line 849 of file OSDLSurface.cc.

References OSDL::Video::Pixels::AlphaOpaque, OSDL::Video::Pixels::areEqual(), OSDL::Video::Pixels::convertPixelColorToColorDefinition(), OSDL::Video::Palette::getClosestColorIndexTo(), OSDL::Video::Palette::getColorKeyIndex(), getHeight(), getPixelColorAt(), getPixelFormat(), getWidth(), guessColorKey(), putPixelColorAt(), setPalette(), Software, and Surface().

string Surface::describePixelAt ( Coordinate  x,
Coordinate  y 
) [virtual]

Returns a textual description of the pixel of this surface located at [x;y].

Parameters:
x the abscissa of the pixel.
y the ordinate of the pixel.
Returns:
a string containing a description (mainly the RGBA coordinates) of this pixel.

Definition at line 1100 of file OSDLSurface.cc.

References getPixelColorAt(), getPixelFormat(), and toString().

Referenced by OSDL::Video::TwoDimensional::drawCircle(), OSDL::Video::TwoDimensional::drawDiscWithEdge(), and OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().

void Surface::displayAt ( const OpenGL::GLTexture texture,
Coordinate  x,
Coordinate  y 
) const [virtual]

Displays the specified texture at the specified location on that surface, supposed to be the screen surface, at natural size (i.e.

one pixel of the texture corresponds exactly to one pixel on the screen).

Parameters:
texture the texture to map.
x the abscissa screen coordinate.
y the ordinate screen coordinate.
Exceptions:
VideoException if the operation failed.
Note:
If the texture is bigger than the surface, then only a part of the texture will be displayed.
Should be used only when in OpenGLFor2D mode.

Definition at line 2104 of file OSDLSurface.cc.

References OSDL::Video::OpenGL::GLTexture::getHeight(), OSDL::Video::OpenGL::GLTexture::getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

void Surface::displayAtCenter ( const OpenGL::GLTexture texture  )  const [virtual]

Displays the specified texture at the center of that surface, supposed to be the screen surface, at natural size (i.e.

one pixel of the texture corresponds exactly to one pixel on the screen).

Parameters:
texture the texture to map.
Exceptions:
VideoException if the operation failed.
Note:
If the texture is bigger than the surface, then only a part of the texture will be displayed.
Should be used only when in OpenGLFor2D mode.

Definition at line 2358 of file OSDLSurface.cc.

References OSDL::Video::OpenGL::GLTexture::getHeight(), getHeight(), OSDL::Video::OpenGL::GLTexture::getWidth(), getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

void Surface::displayAtCenterWithAlpha ( const OpenGL::GLTexture texture,
Pixels::FloatColorElement  alpha 
) const [virtual]

Displays the specified texture at the center of that surface, supposed to be the screen surface, at natural size (i.e.

one pixel of the texture corresponds exactly to one pixel on the screen), blended on the background based on specified alpha component.

Useful to perform fade-in/fade-out.

Parameters:
texture the texture to map.
alpha a floating-point value in [0,1], from invisible to solid.
Exceptions:
VideoException if the operation failed.
Note:
If the texture is bigger than the surface, then only a part of the texture will be displayed.
Should be used only when in OpenGLFor2D mode.

Definition at line 2408 of file OSDLSurface.cc.

References OSDL::Video::OpenGL::GLTexture::getHeight(), getHeight(), OSDL::Video::OpenGL::GLTexture::getWidth(), getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

void Surface::displayAtCenterWithFadeIn ( const OpenGL::GLTexture texture,
Ceylan::System::Millisecond  fadeInDuration = 2000 
) [virtual]

Displays the specified texture at the center of that surface, supposed to be the screen surface, at natural size (i.e.

one pixel of the texture corresponds exactly to one pixel on the screen), with a fade-in of specified duration.

Parameters:
texture the texture to map.
fadeInDuration the number of milliseconds the fade-in should last.
Exceptions:
VideoException if the operation failed.
Note:
If the texture is bigger than the surface, then only a part of the texture will be displayed.
Should be used only when in OpenGLFor2D mode.

Definition at line 2464 of file OSDLSurface.cc.

References clear(), OSDL::Video::OpenGL::GLTexture::getHeight(), getHeight(), OSDL::Video::OpenGL::GLTexture::getWidth(), getWidth(), OSDL::Video::OpenGL::GLTexture::setAsCurrent(), and update().

void Surface::displayAtCenterWithFadeOut ( const OpenGL::GLTexture texture,
Ceylan::System::Millisecond  fadeOutDuration = 1000 
) [virtual]

Displays the specified texture at the center of that surface, supposed to be the screen surface, at natural size (i.e.

one pixel of the texture corresponds exactly to one pixel on the screen), with a fade-out of specified duration.

Parameters:
texture the texture to map.
fadeOutDuration the number of milliseconds the fade-out should last.
Exceptions:
VideoException if the operation failed.
Note:
If the texture is bigger than the surface, then only a part of the texture will be displayed.
Should be used only when in OpenGLFor2D mode.

Definition at line 2557 of file OSDLSurface.cc.

References clear(), OSDL::Video::OpenGL::GLTexture::getHeight(), getHeight(), OSDL::Video::OpenGL::GLTexture::getWidth(), getWidth(), OSDL::Video::OpenGL::GLTexture::setAsCurrent(), and update().

void Surface::displayCenteredHorizontallyAt ( const OpenGL::GLTexture texture,
Coordinate  xOffset,
Coordinate  y 
) const [virtual]

Displays the specified texture at specified ordinate and, horizontally, with a left and right border of width xOffset, scaling accordingly the texture.

Parameters:
texture the texture to map.
xOffset the first abscissa at which the texture should be horizontally displayed at.
y the ordinate the texture will be displayed at.
Exceptions:
VideoException if the operation failed.
Note:
If the texture is bigger than the defined area, it will be scaled appropriately.
Should be used only when in OpenGLFor2D mode.

Definition at line 2305 of file OSDLSurface.cc.

References OSDL::Video::OpenGL::GLTexture::getHeight(), getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

void Surface::displayCenteredHorizontallyAt ( const OpenGL::GLTexture texture,
Coordinate  y 
) const [virtual]

Displays the specified texture at specified ordinate, at original size, horizontally centered.

Parameters:
texture the texture to map.
y the ordinate the texture will be displayed from (i.e. the top ordinate).
Exceptions:
VideoException if the operation failed.
Note:
Should be used only when in OpenGLFor2D mode.

Definition at line 2194 of file OSDLSurface.cc.

References OSDL::Video::OpenGL::GLTexture::getHeight(), OSDL::Video::OpenGL::GLTexture::getWidth(), getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

void Surface::displayCenteredHorizontallyWithAlphaAt ( const OpenGL::GLTexture texture,
Coordinate  y,
Pixels::FloatColorElement  alpha 
) const [virtual]

Displays the specified texture at specified ordinate, at original size, horizontally centered, blended on the background based on specified alpha component.with .

Parameters:
texture the texture to map.
y the ordinate the texture will be displayed at.
alpha a floating-point value in [0,1], from invisible to solid.
Exceptions:
VideoException if the operation failed.
Note:
Should be used only when in OpenGLFor2D mode.

Definition at line 2246 of file OSDLSurface.cc.

References OSDL::Video::OpenGL::GLTexture::getHeight(), OSDL::Video::OpenGL::GLTexture::getWidth(), getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

virtual bool OSDL::Video::Surface::displayData ( const Ceylan::Maths::IntegerData *  dataArray,
Ceylan::Uint32  dataCount,
Pixels::ColorDefinition  pencilColor,
Pixels::ColorDefinition  captionColor,
Pixels::ColorDefinition  backgroundColor,
const std::string &  caption = "",
const UprightRectangle *  inBox = 0 
) [virtual]

Displays specified set of data, defined by dataArray, an array of dataCount IntegerData elements, as a curve drawn with pencilColor, on a background whose color is backgroundColor.

The whole display will be scaled vertically to fit into inBox. On the contrary, the abscissa will be used as is.

Note:
If inBox is a null pointer, then the curve will be drawn in the whole surface.
When choosing the width of the container (inBox), to avoid truncating the graph, add 2*graphAbscissaOffset to the number of samples that describes the curve, and it will fit at best: both left and right boundaries will be taken into account.
void Surface::displayInFullscreen ( const OpenGL::GLTexture texture  )  const [virtual]

Displays the specified texture in the full screen surface, possibly zooming (if the texture has a different size from the viewport) and distorting (if they have different width/height ratio.

Parameters:
texture the texture to map.
Exceptions:
VideoException if the operation failed.
Note:
Should be used only when in OpenGLFor2D mode.

Definition at line 2651 of file OSDLSurface.cc.

References getHeight(), getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

void Surface::displayInFullscreenSizeWithAlphaAt ( const OpenGL::GLTexture texture,
Pixels::FloatColorElement  alpha,
Coordinate  x,
Coordinate  y 
) const [virtual]

Displays the specified texture with a size corresponding to the full screen surface, possibly zooming (if the texture has a different size from the viewport) and distorting (if they have different width/height ratio), blended on the background based on specified alpha component, at specified onscreen location.

Parameters:
texture the texture to map.
x the abscissa screen coordinate.
y the ordinate screen coordinate.
alpha a floating-point value in [0,1], from invisible to solid.
Exceptions:
VideoException if the operation failed.
Note:
If the texture is bigger than the defined area, it will be scaled appropriately.
Should be used only when in OpenGLFor2D mode.

Definition at line 2758 of file OSDLSurface.cc.

References getHeight(), getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

void Surface::displayInFullscreenWithAlpha ( const OpenGL::GLTexture texture,
Pixels::FloatColorElement  alpha 
) const [virtual]

Displays the specified texture in the full screen surface, possibly zooming (if the texture has a different size from the viewport) and distorting (if they have different width/height ratio), blended on the background based on specified alpha component.

Useful to perform fade-in/fade-out. with the specified alphablending.

Parameters:
texture the texture to map.
alpha a floating-point value in [0,1], from invisible to solid.
Exceptions:
VideoException if the operation failed.
Note:
Should be used only when in OpenGLFor2D mode.

Definition at line 2701 of file OSDLSurface.cc.

References getHeight(), getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

void Surface::displayWithAlphaAt ( const OpenGL::GLTexture texture,
Coordinate  x,
Coordinate  y,
Pixels::FloatColorElement  alpha 
) const [virtual]

Displays the specified texture at the specified location on that surface, supposed to be the screen surface, at natural size (i.e.

one pixel of the texture corresponds exactly to one pixel on the screen).

Parameters:
texture the texture to map.
x the abscissa screen coordinate.
y the ordinate screen coordinate.
alpha a floating-point value in [0,1], from invisible to solid.
Exceptions:
VideoException if the operation failed.
Note:
If the texture is bigger than the surface, then only a part of the texture will be displayed.
Should be used only when in OpenGLFor2D mode.

Definition at line 2147 of file OSDLSurface.cc.

References OSDL::Video::OpenGL::GLTexture::getHeight(), OSDL::Video::OpenGL::GLTexture::getWidth(), and OSDL::Video::OpenGL::GLTexture::setAsCurrent().

bool UprightRectangle::draw ( Surface target,
Pixels::ColorDefinition  colorDef = Pixels::White,
bool  filled = true 
) const [virtual, inherited]

Draws this UprightRectangle to specified surface with specified RGBA color.

Parameters:
target the surface to which this rectangle will be rendered.
filled tells whether the drawn rectangle should be filled with specified color, or if only its sides should be drawn.
Note:
Locks surface if needed.

Definition at line 341 of file OSDLUprightRectangle.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::_x, OSDL::Video::TwoDimensional::UprightRectangle::_y, OSDL::Video::Pixels::convertColorDefinitionToRawPixelColor(), OSDL::Video::TwoDimensional::UprightRectangle::getHeight(), getSDLSurface(), OSDL::Video::TwoDimensional::UprightRectangle::getWidth(), and OSDL::Video::Pixels::toString().

virtual bool OSDL::Video::TwoDimensional::UprightRectangle::draw ( Surface target,
Pixels::ColorElement  red,
Pixels::ColorElement  blue,
Pixels::ColorElement  green,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque,
bool  filled = true 
) const [virtual, inherited]

Draws this UprightRectangle to specified surface with specified RGBA color.

Parameters:
target the surface to which this rectangle will be rendered.
filled tells whether the drawn rectangle should be filled with specified color, or if only its sides should be drawn.
Note:
Locks surface if needed.

Referenced by drawLine(), and OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().

virtual bool OSDL::Video::Surface::drawBox ( const UprightRectangle &  rectangle,
Pixels::ColorDefinition  colorDef = Pixels::White,
bool  filled = true 
) [virtual]

Draws a box with specified RGBA color.

Parameters:
rectangle the box to fill
colorDef the fill color
filled tells whether the drawn rectangle should be filled with specified color, or if only its sides should be drawn.
Note:
Locks surface if needed.
virtual bool OSDL::Video::Surface::drawBox ( const UprightRectangle &  rectangle,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque,
bool  filled = true 
) [virtual]

Draws a box with specified RGBA color.

Parameters:
filled tells whether the drawn rectangle should be filled with specified color, or if only its sides should be drawn.
Note:
Locks surface if needed.

Referenced by fill().

bool Surface::drawCircle ( Coordinate  xCenter,
Coordinate  yCenter,
Length  radius,
Pixels::ColorDefinition  colorDef = Pixels::White,
bool  filled = true,
bool  blended = true 
) [virtual]

Draws a circle whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface.

Parameters:
filled tells whether the circle should be filled (disc).
blended tells whether, for each pixel of disc, the specified color should be blended with the one of the target pixel (if true), or if the specified color should replace the former one, regardless of any blending (if false). Note that only discs may be drawn without being blended: circles are always blended.
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
A circle will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1729 of file OSDLSurface.cc.

References drawCircle().

bool Surface::drawCircle ( Coordinate  xCenter,
Coordinate  yCenter,
Length  radius,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque,
bool  filled = true,
bool  blended = true 
) [virtual]

Draws a circle whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface.

Parameters:
filled tells whether the circle should be filled (disc).
blended tells whether, for each pixel of disc, the specified color should be blended with the one of the target pixel (if true), or if the specified color should replace the former one, regardless of any blending (if false). Note that only discs may be drawn without being blended: circles are always blended.
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
A circle will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1716 of file OSDLSurface.cc.

Referenced by drawCircle(), and OSDL::Video::TwoDimensional::drawDiscWithEdge().

bool Surface::drawCross ( Coordinate  xCenter,
Coordinate  yCenter,
Pixels::ColorDefinition  colorDef = Pixels::White,
Length  squareEdge = 5 
) [virtual]

Draws a cross centered in center, included in a square whose length of edge is squareEdge.

Note:
Useful to mark a point.
Locks surface if needed.
Clipping is performed.
This cross will be antialiased if antialias mode is set.

Definition at line 1645 of file OSDLSurface.cc.

References drawCross().

bool Surface::drawCross ( const TwoDimensional::Point2D center,
Pixels::ColorDefinition  colorDef = Pixels::White,
Length  squareEdge = 5 
) [virtual]

Draws a cross centered in center, included in a square whose length of edge is squareEdge.

Note:
Useful to mark a point.
Locks surface if needed.
Clipping is performed.
This cross will be antialiased if antialias mode is set.

Definition at line 1635 of file OSDLSurface.cc.

Referenced by drawCross().

bool Surface::drawDiscWithEdge ( Coordinate  xCenter,
Coordinate  yCenter,
Length  outerRadius,
Length  innerRadius,
Pixels::ColorDefinition  ringColorDef = Pixels::Blue,
Pixels::ColorDefinition  discColorDef = Pixels::White,
bool  blended = true 
) [virtual]

Draws a disc whose center is (xCenter,yCenter), of specified radius (totalRadius), filled with specified color discColorDef, with a ring in it, on its border, i.e.

starting from innerRadius to totalRadius, colored with ringColorDef, on this surface.

Parameters:
xCenter the abscissa of the center of the disc.
yCenter the ordinate of the center of the disc.
outerRadius the overall disc radius, including the border ring.
innerRadius,the radius from which the ring is drawn, until totalRadius is reached.
ringColorDef the ring color, the color of the border of this disk.
discColorDef the inner color of the disc.
blended tells whether, for each pixel of the edged disc, the specified color should be blended with the one of the target pixel (if true), or if the specified color should replace the former one, regardless of any blending (if false).
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
This method is rather expensive (slow), especially if 'discColorDef' is not fully opaque and if 'blended' is false.
Locks surface if needed, cipping is performed, disc will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1741 of file OSDLSurface.cc.

Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().

bool Surface::drawEdges ( Pixels::ColorDefinition  edgeColor = Pixels::White,
Length  edgeWidth = 1 
) [virtual]

Draws the edges of this surface, with specified color and edge width.

Parameters:
edgeColor the color of edges.
edgeWidth the width of edges.
Note:
Locks surface if needed.
Clipping is performed.

Definition at line 1655 of file OSDLSurface.cc.

References drawHorizontalLine(), drawVerticalLine(), getHeight(), and getWidth().

Referenced by OSDL::Video::TwoDimensional::Widget::drawFundamentals().

bool Surface::drawEllipse ( Coordinate  xCenter,
Coordinate  yCenter,
Length  horizontalRadius,
Length  verticalRadius,
Pixels::ColorDefinition  colorDef,
bool  filled = true 
) [virtual]

Draws an ellipse whose center is (xCenter,yCenter), with specified horizontal and vertical radii, with specified RGBA color, on this surface.

Parameters:
filled tells whether the ellipse should be filled.
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
An unfilled ellipse will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1767 of file OSDLSurface.cc.

References drawEllipse().

bool Surface::drawEllipse ( Coordinate  xCenter,
Coordinate  yCenter,
Length  horizontalRadius,
Length  verticalRadius,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque,
bool  filled = true 
) [virtual]

Draws an ellipse whose center is (xCenter,yCenter), with specified horizontal and vertical radii, with specified RGBA color, on this surface.

Parameters:
filled tells whether the ellipse should be filled.
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
An unfilled ellipse will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1754 of file OSDLSurface.cc.

Referenced by drawEllipse().

bool Surface::drawGrid ( Length  columnStride = 20,
Length  rowStride = 20,
Pixels::ColorDefinition  lineColor = Pixels::White,
bool  fillBackground = false,
Pixels::ColorDefinition  backgroundColor = Pixels::Black 
) [virtual]

Draws a grid, with specified space between columns and rows and specified colors.

Parameters:
columnStride the number of pixels between two columns.
rowStride the number of pixels between two rows.
lineColor the color of the grid lines.
fillBackground tells whether a background should be filled.
backgroundColor the color of the background, if activated.
Note:
Useful to check transparency blits for example.
Locks surface if needed.

Definition at line 1881 of file OSDLSurface.cc.

References drawHorizontalLine(), drawVerticalLine(), fill(), getHeight(), and getWidth().

bool Surface::drawHorizontalLine ( Coordinate  xStart,
Coordinate  xStop,
Coordinate  y,
Pixels::ColorDefinition  colorDef = Pixels::White 
) [virtual]

Draws an horizontal line ranging from point (xStart;y), included, to point (xStop;y), included if and only if endpoint drawing mode is set, with specified RGBA color, in this surface.

Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
This line will be antialiased if antialias mode is set.
See also:
drawVertical, draw
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState

Definition at line 1577 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Line::drawHorizontal().

bool Surface::drawHorizontalLine ( Coordinate  xStart,
Coordinate  xStop,
Coordinate  y,
Pixels::PixelColor  actualColor 
) [virtual]

Draws an horizontal line ranging from point (xStart;y), included, to point (xStop;y), included if and only if endpoint drawing mode is set, with specified actual RGBA pixel color, in this surface.

Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
This line will be antialiased if antialias mode is set.
See also:
drawVertical, draw
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState

Definition at line 1567 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Line::drawHorizontal().

bool Surface::drawHorizontalLine ( Coordinate  xStart,
Coordinate  xStop,
Coordinate  y,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque 
) [virtual]

Draws an horizontal line ranging from point (xStart;y), included, to point (xStop;y), included if and only if endpoint drawing mode is set, with specified RGBA color, in this surface.

Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
This line will be antialiased if antialias mode is set.
See also:
drawVertical, draw
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState

Definition at line 1555 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Line::drawHorizontal().

Referenced by OSDL::Video::TwoDimensional::Widget::drawDecorations(), drawEdges(), and drawGrid().

bool Surface::drawLine ( Coordinate  xStart,
Coordinate  yStart,
Coordinate  xStop,
Coordinate  yStop,
Pixels::ColorDefinition  colorDef = Pixels::White 
) [virtual]

Draws a line in this surface, ranging from point (xStart;yStart), included, to point (xStop;yStop), included if and only if endpoint drawing mode is set, with specified RGBA color.

Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
This line will be antialiased if antialias mode is set.
See also:
drawHorizontal, drawVertical
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState

Definition at line 1624 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::draw().

bool Surface::drawLine ( Coordinate  xStart,
Coordinate  yStart,
Coordinate  xStop,
Coordinate  yStop,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque 
) [virtual]

Draws a line in this surface, ranging from point (xStart;yStart), included, to point (xStop;yStop), included if and only if endpoint drawing mode is set, with specified RGBA color.

Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
This line will be antialiased if antialias mode is set.
See also:
drawHorizontal, drawVertical
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState

Definition at line 1611 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::draw().

bool Surface::drawPie ( Coordinate  xCenter,
Coordinate  yCenter,
Length  radius,
Ceylan::Maths::AngleInDegrees  angleStart,
Ceylan::Maths::AngleInDegrees  angleStop,
Pixels::ColorDefinition  colorDef 
) [virtual]

Draws a polygon-based filled pie whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface, starting from angleStart, stopping to angleStop.

Parameters:
xCenter the abscissa of the center of the pie.
yCenter the ordinate of the center of the pie.
radius the radius of the pie.
angleStart the starting angle of the pie, in degrees.
angleStop the stopping angle of the pie, in degrees.
colorDef the color definition of fill color.
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1793 of file OSDLSurface.cc.

References drawPie().

bool Surface::drawPie ( Coordinate  xCenter,
Coordinate  yCenter,
Length  radius,
Ceylan::Maths::AngleInDegrees  angleStart,
Ceylan::Maths::AngleInDegrees  angleStop,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque 
) [virtual]

Draws a polygon-based filled pie whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface, starting from angleStart, stopping to angleStop, both expressed in degrees.

Parameters:
xCenter the abscissa of the center of the pie.
yCenter the ordinate of the center of the pie.
radius the radius of the pie.
angleStart the starting angle of the pie, in degrees.
angleStop the stopping angle of the pie, in degrees.
red the red color coordinate of fill color.
green the green color coordinate of fill color.
blue the blue color coordinate of fill color.
alpha the alpha color coordinate of fill color.
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1779 of file OSDLSurface.cc.

Referenced by drawPie().

bool Surface::drawPolygon ( const std::list< TwoDimensional::Point2D * >  summits,
Coordinate  x,
Coordinate  y,
Pixels::ColorDefinition  colorDef,
bool  filled = true 
) [virtual]

Draws a polygon defined by specified list of points, with specified RGBA color, on specified surface.

Parameters:
summits could be a 'const' list of 'const' Point2D pointers, but the STL would not be able to match it with mostly used argument 'const list of Point2D non-const pointers'.
x the abscissa the polygon should be translated of, on screen.
y the ordinate the polygon should be translated of, on screen.
filled tells whether the polygon should be filled.
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
Will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1856 of file OSDLSurface.cc.

References drawPolygon().

bool Surface::drawPolygon ( const std::list< TwoDimensional::Point2D * >  summits,
Coordinate  x,
Coordinate  y,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque,
bool  filled = true 
) [virtual]

Draws a polygon defined by specified list of points, with specified RGBA color, on specified surface.

Parameters:
summits could be a 'const' list of 'const' Point2D pointers, but the STL would not be able to match it with mostly used argument 'const list of Point2D non-const pointers'.
x the abscissa the polygon should be translated of, on screen.
y the ordinate the polygon should be translated of, on screen.
filled tells whether the polygon should be filled.
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
Will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1868 of file OSDLSurface.cc.

Referenced by drawPolygon().

bool Surface::drawTriangle ( const TwoDimensional::Point2D p1,
const TwoDimensional::Point2D p2,
const TwoDimensional::Point2D p3,
Pixels::ColorDefinition  colorDef,
bool  filled = true 
) [virtual]

Draws a triangle defined by specified three points, with specified RGBA color, on this surface.

Parameters:
filled tells whether the triangle should be filled (disc).
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
Will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1845 of file OSDLSurface.cc.

References drawTriangle().

bool Surface::drawTriangle ( const TwoDimensional::Point2D p1,
const TwoDimensional::Point2D p2,
const TwoDimensional::Point2D p3,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque,
bool  filled = true 
) [virtual]

Draws a triangle defined by specified three points, with specified RGBA color, on this surface.

Parameters:
filled tells whether the triangle should be filled (disc).
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
Will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1832 of file OSDLSurface.cc.

References drawTriangle().

bool Surface::drawTriangle ( Coordinate  x1,
Coordinate  y1,
Coordinate  x2,
Coordinate  y2,
Coordinate  x3,
Coordinate  y3,
Pixels::ColorDefinition  colorDef,
bool  filled = true 
) [virtual]

Draws a triangle defined by specified three points, with specified RGBA color, on this surface.

Parameters:
filled tells whether the triangle should be filled (disc).
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
Will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1820 of file OSDLSurface.cc.

References drawTriangle().

bool Surface::drawTriangle ( Coordinate  x1,
Coordinate  y1,
Coordinate  x2,
Coordinate  y2,
Coordinate  x3,
Coordinate  y3,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque,
bool  filled = true 
) [virtual]

Draws a triangle defined by specified three points, with specified RGBA color, on this surface.

Parameters:
filled tells whether the triangle should be filled (disc).
Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
Will be antialiased if antialias mode is set.
See also:
VideoModule::GetAntiAliasingState

Definition at line 1807 of file OSDLSurface.cc.

Referenced by drawTriangle().

bool Surface::drawVerticalLine ( Coordinate  x,
Coordinate  yStart,
Coordinate  yStop,
Pixels::ColorDefinition  colorDef = Pixels::White 
) [virtual]

Draws a vertical line ranging from point (x;yStart), included, to point (x;yStop), included if and only if endpoint drawing mode is set, with specified RGBA color, in this surface.

Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
This line will be antialiased if antialias mode is set.
See also:
drawHorizontal, draw
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState.

Definition at line 1600 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Line::drawVertical().

bool Surface::drawVerticalLine ( Coordinate  x,
Coordinate  yStart,
Coordinate  yStop,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque 
) [virtual]

Draws a vertical line ranging from point (x;yStart), included, to point (x;yStop), included if and only if endpoint drawing mode is set, with specified RGBA color, in this surface.

Returns:
false if and only if something went wrong (ex: surface lock failed).
Note:
Locks surface if needed.
Clipping is performed.
This line will be antialiased if antialias mode is set.
See also:
drawHorizontal, draw
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState

Definition at line 1588 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Line::drawVertical().

Referenced by drawEdges(), and drawGrid().

bool UprightRectangle::drawWithRoundedCorners ( Surface target,
Length  edgeWidth = 3,
Pixels::ColorDefinition  edgeColorDef = Pixels::White,
Pixels::ColorDefinition  backgroundColorDef = Pixels::Transparent 
) const [virtual, inherited]

Draws this UprightRectangle to specified surface with rounded corners, drawn with specified color, above a background of specified color.

The width of the borders can be chosen, and should not be incompatible with the dimensions of this rectangle.

Parameters:
target the surface to which this rectangle will be rendered.
edgeWidth the width of the edges of this rectangle.
edgeColorDef the color definition of the edges of this rectangle.
backgroundColorDef the color definition of the background of this rectangle.
Note:
Locks surface if needed.

Definition at line 395 of file OSDLUprightRectangle.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::_x, OSDL::Video::TwoDimensional::UprightRectangle::_y, AlphaBlendingBlit, OSDL::Video::Pixels::AlphaOpaque, blitTo(), ColorkeyBlit, OSDL::Video::TwoDimensional::UprightRectangle::computeRadiusForRoundRectangle(), describePixelAt(), OSDL::Video::TwoDimensional::UprightRectangle::draw(), drawDiscWithEdge(), fill(), getBitsPerPixel(), OSDL::Video::Pixels::getCurrentColorMasks(), OSDL::Video::TwoDimensional::UprightRectangle::getHeight(), getPixelFormat(), OSDL::Video::TwoDimensional::UprightRectangle::getWidth(), RLEColorkeyBlit, savePNG(), OSDL::Video::Pixels::selectColorDifferentFrom(), setColorKey(), OSDL::Video::TwoDimensional::UprightRectangle::setUpperLeftAbscissa(), OSDL::Video::TwoDimensional::UprightRectangle::setUpperLeftOrdinate(), OSDL::Video::TwoDimensional::Point2D::setX(), OSDL::Video::TwoDimensional::Point2D::setY(), Software, toString(), and OSDL::Video::Pixels::toString().

Referenced by OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().

bool Surface::fill ( Pixels::ColorDefinition  colorDef = Pixels::Black  )  [virtual]
Surface & Surface::flipHorizontal (  )  const [virtual]

Returns the result of an horizontal flip of this source surface: the result will contain the original image mirrored according to an horizontal line splitting this surface into a top and bottom area of equal size.

Something looking as '^' would be flipped into 'v'.

Returns:
a new surface whose pixels are the ones of this left-untouched surface, the pixels being horizontally flipped.
Note:
The returned surface will have to be deallocated by the caller.
Exceptions:
VideoException if the operation failed or is not supported.

Definition at line 1055 of file OSDLSurface.cc.

References _surface, and Surface().

Surface & Surface::flipVertical (  )  const [virtual]

Returns the result of a vertical flip of this source surface: the result will contain the original image mirrored according to a vertical line splitting this surface into a left and right area of equal size.

Something looking as '>' would be flipped into '<'.

Returns:
a new surface whose pixels are the ones of this left-untouched surface, the pixels being vertically flipped.
Note:
The returned surface will have to be deallocated by the caller.
Exceptions:
VideoException if the operation failed or is not supported.

Definition at line 1003 of file OSDLSurface.cc.

References _surface, and Surface().

void Surface::flush (  )  [protected, virtual]

Releases internal SDL surface.

Definition at line 4173 of file OSDLSurface.cc.

References _displayType, _surface, BackBuffer, and inconsistencyDetected().

Referenced by setSDLSurface(), and ~Surface().

BitsPerPixel Surface::getBitsPerPixel (  )  const [virtual]
BytesPerPixel Surface::getBytesPerPixel (  )  const [virtual]

Returns this surface's overall color depth, bytes per pixel.

Note:
Do not mix up with bits per pixels.
See also:
getBitsPerPixel

Definition at line 1330 of file OSDLSurface.cc.

References _surface.

Referenced by OSDL::Video::Pixels::alternativePutPixelColor(), and OSDL::Video::Pixels::getPixelColor().

UprightRectangle & Surface::getClippingArea (  )  const [virtual]

Returns this surface's clipping area, expressed thanks to an UprightRectangle.

Should not be confused with the actual area corresponding to this surface, which is another UprightRectangle.

Returns:
A new UprightRectangle, whose ownership is transferred to the caller, who therefore has to deallocate it when having finished with it.
Exceptions:
VideoException if the operation failed or is not supported.

Definition at line 2899 of file OSDLSurface.cc.

References _surface, and OSDL::Video::TwoDimensional::UprightRectangle::UprightRectangle().

Pixels::ColorDefinition Surface::getColorDefinitionAt ( Coordinate  x,
Coordinate  y 
) const [virtual]

Returns the color definition of one particular pixel of this surface, located at [x;y].

If this surface has no alpha coordinate, then the fourth color coordinate of the returned definition will be AlphaOpaque.

No clipping is performed, the surface should have been previously locked if necessary.

See also:
OSDL::Video::Pixels::get

Definition at line 1408 of file OSDLSurface.cc.

References OSDL::Video::Pixels::convertPixelColorToColorDefinition(), OSDL::Video::Pixels::getPixelColor(), and getPixelFormat().

Referenced by OSDL::Video::TwoDimensional::Image::SavePNG(), and setAlphaForColor().

UprightRectangle & Surface::getContentArea (  )  const [virtual]

Returns this surface's content area, expressed thanks to an UprightRectangle.

The content area is the smallest upright rectangle which encloses all the image pixels whose color is different from the guessed colorkey.

Returns:
A new UprightRectangle, whose ownership is transferred to the caller, who therefore has to deallocate it when having finished with it.
Exceptions:
VideoException if the operation failed or is not supported.

Definition at line 2936 of file OSDLSurface.cc.

References OSDL::Video::Pixels::areEqual(), getHeight(), getPixelColorAt(), getWidth(), guessColorKey(), and OSDL::Video::TwoDimensional::UprightRectangle::UprightRectangle().

Surface::DisplayType Surface::getDisplayType (  )  const [virtual]

Returns the display type (back-buffer, screen, etc.

) of this Surface.

Definition at line 564 of file OSDLSurface.cc.

References _displayType.

Referenced by OSDL::Video::VideoModule::setScreenSurface().

Ceylan::Flags Surface::getFlags (  )  const [virtual]
Length Surface::getHeight (  )  const [virtual]
Coordinate UprightRectangle::getLowerRightAbscissa (  )  const [virtual, inherited]

Returns directly the abscissa of lower right corner.

Definition at line 243 of file OSDLUprightRectangle.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::_x, and OSDL::Video::TwoDimensional::UprightRectangle::getWidth().

Point2D UprightRectangle::getLowerRightCorner (  )  const [virtual, inherited]
Coordinate UprightRectangle::getLowerRightOrdinate (  )  const [virtual, inherited]

Returns directly the ordinate of lower right corner.

Definition at line 267 of file OSDLUprightRectangle.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::_y, and OSDL::Video::TwoDimensional::UprightRectangle::getHeight().

Offset Surface::getOffset (  )  const [inline, protected]

Returns this surface's offset.

Definition at line 4143 of file OSDLSurface.cc.

References _surface.

Palette & Surface::getPalette (  )  const [virtual]

Returns a palette associated with this surface, if any.

Ownership of the palette is transfered to the caller.

Exceptions:
VideoException if not palette is available.

Definition at line 772 of file OSDLSurface.cc.

References _surface.

Pitch Surface::getPitch (  )  const [virtual]
Pixels::PixelColor Surface::getPixelColorAt ( Coordinate  x,
Coordinate  y 
) const [virtual]

Returns the pixel color of one particular pixel of this surface, located at [x;y], encoded according to the pixel format of this surface.

Returns:
the encoded pixel color of the pixel at [x;y].

No clipping is performed, the surface should have been previously locked if necessary.

See also:
OSDL::Video::Pixels::get

Definition at line 1398 of file OSDLSurface.cc.

References OSDL::Video::Pixels::getPixelColor().

Referenced by createColorReducedSurfaceFor(), describePixelAt(), getContentArea(), and guessColorKey().

Pixels::PixelFormat & Surface::getPixelFormat (  )  const [virtual]
void * Surface::getPixels (  )  const [virtual]

Returns this surface's video buffer, i.e.

its whole set of pixels.

Definition at line 1362 of file OSDLSurface.cc.

References _surface.

Referenced by OSDL::Video::Pixels::alternativePutPixelColor(), OSDL::Video::Pixels::getPixelColor(), and OSDL::Video::TwoDimensional::Image::LoadIcon().

bool Surface::getRedrawState (  )  const [virtual]
LowLevelSurface & Surface::getSDLSurface (  )  const [virtual]

Returns the SDL surface corresponding to that surface.

Note:
The returned surface can be the null pointer.
This surface keeps ownership of the returned SDL surface.
Returns:
the SDL surface corresponding to that surface.

Definition at line 540 of file OSDLSurface.cc.

References _surface.

Referenced by OSDL::Video::TwoDimensional::Text::FixedFont::basicBlitLatin1Glyph(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), blitTo(), OSDL::Video::TwoDimensional::UprightRectangle::draw(), OSDL::Video::TwoDimensional::drawBezierCurve(), OSDL::Video::TwoDimensional::drawCircle(), OSDL::Video::TwoDimensional::drawEllipse(), OSDL::Video::TwoDimensional::Line::drawHorizontal(), OSDL::Video::TwoDimensional::drawPie(), OSDL::Video::TwoDimensional::drawPolygon(), OSDL::Video::TwoDimensional::drawTriangle(), OSDL::Video::TwoDimensional::Image::Load(), OSDL::Video::TwoDimensional::Image::LoadBMP(), OSDL::Video::TwoDimensional::Image::LoadGIF(), OSDL::Video::TwoDimensional::Image::LoadJPG(), OSDL::Video::TwoDimensional::Image::LoadLBM(), OSDL::Video::TwoDimensional::Image::LoadPCX(), OSDL::Video::TwoDimensional::Image::LoadPNG(), OSDL::Video::TwoDimensional::Image::LoadPNM(), OSDL::Video::TwoDimensional::Image::LoadTGA(), OSDL::Video::TwoDimensional::Image::LoadXPM(), OSDL::Video::Overlay::Overlay(), OSDL::Video::TwoDimensional::Text::printBasic(), OSDL::Video::Pixels::putPixelColor(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text(), OSDL::Video::TwoDimensional::Image::SaveBMP(), OSDL::Video::VideoModule::setWindowIcon(), and OSDL::Video::VideoModule::toggleFullscreen().

Ceylan::System::Size Surface::getSizeInMemory (  )  const [virtual]

Returns the approximate size in memory, in bytes, currently taken by this object.

See also:
Ceylan::Measurable interface.

Definition at line 3578 of file OSDLSurface.cc.

References _surface.

Referenced by toString().

UpdateCount Surface::getUpdateCount (  )  const [virtual]

Returns the current number of updates for that surface.

Counts the number of times this surface has been updated once initialized.

Note:
Even with a refresh rate of 100Hz, will not wrap around until more than one year.
This corresponds only to full updates as performed by the update() method.

Definition at line 3240 of file OSDLSurface.cc.

References _updateCount.

Referenced by OSDL::Video::VideoModule::getAverageRefreshRate().

Coordinate UprightRectangle::getUpperLeftAbscissa (  )  const [virtual, inherited]
Point2D UprightRectangle::getUpperLeftCorner (  )  const [virtual, inherited]

Returns this UprightRectangle's upper left corner.

Definition at line 157 of file OSDLUprightRectangle.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::_x, and OSDL::Video::TwoDimensional::UprightRectangle::_y.

Coordinate UprightRectangle::getUpperLeftOrdinate (  )  const [virtual, inherited]
Surface & Surface::getWidgetRenderTarget (  ) 

Returns the surface that should be targeted by widgets having to blit their renderings to their container.

Usually (but not always) the render target is the instance itself.

Reimplemented in OSDL::Video::TwoDimensional::BackBufferedWidget.

Definition at line 3436 of file OSDLSurface.cc.

Referenced by OSDL::Video::TwoDimensional::Widget::redraw().

Length Surface::getWidth (  )  const [virtual]
PixelColor Surface::guessColorKey (  )  const

Returns the pixel color of the colorkey of this surface, as attempted to be guessed from the actual pixel colors (alpha not taken into account).

This is done by checking the corner pixels, supposedly set to this colorkey.

Exceptions:
VideoException if no colorkey could be guessed.

Definition at line 676 of file OSDLSurface.cc.

References OSDL::Video::Pixels::areEqual(), getHeight(), getPixelColorAt(), and getWidth().

Referenced by createColorReducedSurfaceFor(), getContentArea(), and guessColorKeyDefinition().

ColorDefinition Surface::guessColorKeyDefinition (  )  const

Returns the color definition of the colorkey of this surface, as attempted to be guessed from the actual pixel colors (alpha not taken into account).

This is done by checking the corner pixels, supposedly set to this colorkey.

Exceptions:
VideoException if no colorkey could be guessed.

Definition at line 666 of file OSDLSurface.cc.

References OSDL::Video::Pixels::convertPixelColorToColorDefinition(), getPixelFormat(), and guessColorKey().

void Surface::inconsistencyDetected ( const std::string &  message  )  const [protected, virtual]

Triggered when an abnormal inconsistency is detected between OSDL's surface state and its back-end counterpart.

Note:
Those kind of errors, which are detected at runtime, mean that the code misbehaved badly, therefore an emergency stop might help.

Definition at line 4200 of file OSDLSurface.cc.

Referenced by flush().

static std::string OSDL::Video::Surface::InterpretFlags ( Ceylan::Flags  flags  )  [static]

Outputs a textual description of the given surface flags.

These flags are interpreted as surface flags only.

Parameters:
flags the surface video settings to interpret.
Note:
One shall not call this method on flags used with VideoModule::setMode. Use VideoModule::interpretFlags instead, since their meaning is different.

Referenced by toString().

bool Surface::isInternalSurfaceAvailable (  )  const [virtual]
void Surface::loadBMP ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads a BMP image from specified file into this surface.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the BMP file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::loadBMP

Should be inlined.

Definition at line 3024 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Image::LoadBMP().

void Surface::loadGIF ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads a GIF image from specified file into this surface.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the GIF file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::loadGIF

Should be inlined.

Definition at line 3035 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Image::LoadGIF().

Surface & Surface::LoadImage ( const std::string &  filename,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [static]

Surface factory: creates a new Surface instance from specified image file.

Parameters:
filename the file from which the image will be loaded
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
The caller takes ownership of the created Surface, and must deallocate it when necessary.
Image format, if supported, is auto-detected.

Definition at line 3923 of file OSDLSurface.cc.

References loadImage(), and Surface().

Referenced by OSDL::Video::TwoDimensional::Image::load(), OSDL::Video::OpenGL::GLTexture::load(), and OSDL::Video::TwoDimensional::Image::LoadIcon().

void Surface::loadImage ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads an image, whose format will be auto-detected, from specified file, into this surface.

This is a Surface factory.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the image file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::load

Should be inlined.

Definition at line 2991 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Image::Load().

Referenced by LoadImage().

Surface & Surface::LoadJPG ( const std::string &  filename,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [static]

Surface factory: creates a new Surface instance from specified JPG image file.

Parameters:
filename the file from which the image will be loaded
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
The caller takes ownership of the created Surface, and must deallocate it when necessary.
This is a way of enforcing the reading of a JPEG file.

Definition at line 3981 of file OSDLSurface.cc.

References loadJPG(), and Surface().

Referenced by loadJPG().

void Surface::loadJPG ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads a JPEG image from specified file into this surface.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the JPEG file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::loadJPG

Should be inlined.

Definition at line 3002 of file OSDLSurface.cc.

References LoadJPG().

Referenced by LoadJPG().

void Surface::loadLBM ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads a LBM image from specified file into this surface.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the LBM file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::loadLBM

Should be inlined.

Definition at line 3046 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Image::LoadLBM().

void Surface::loadPCX ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads a PCX image from specified file into this surface.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the PCX file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::loadPCX

Should be inlined.

Definition at line 3057 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Image::LoadPCX().

Surface & Surface::LoadPNG ( const std::string &  filename,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [static]

Surface factory: creates a new Surface instance from specified PNG image file.

Parameters:
filename the file from which the image will be loaded
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
The caller takes ownership of the created Surface, and must deallocate it when necessary.
This is a way of enforcing the reading of a PNG file.

Definition at line 3958 of file OSDLSurface.cc.

References loadPNG(), and Surface().

Referenced by loadPNG().

void Surface::loadPNG ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads a PNG image from specified file into this surface.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the PNG file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::loadPNG

Should be inlined.

Definition at line 3013 of file OSDLSurface.cc.

References LoadPNG().

Referenced by LoadPNG().

void Surface::loadPNM ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads a PNM image from specified file into this surface.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the PNM file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::loadPNM

Should be inlined.

Definition at line 3068 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Image::LoadPNM().

void Surface::loadTGA ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads a TGA image from specified file into this surface.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the TGA file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::loadTGA

Should be inlined.

Definition at line 3079 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Image::LoadTGA().

void Surface::loadXPM ( const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [virtual]

Loads a XPM image from specified file into this surface.

Parameters:
targetSurface the surface that should correspond to the loaded image.
filename the name of the XPM file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true), or if this loaded surface should simply replace the former one (if flag is false).
convertToDisplayFormat tells whether this loaded image should have its format converted to the screen's format, in order to offer faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Note:
Specifying a blitOnly option set to true is especially convenient when selecting the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Image::loadXPM

Should be inlined.

Definition at line 3090 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Image::LoadXPM().

bool Surface::mustBeLocked (  )  const [virtual]

Tells whether this surface has to be locked before modifying it.

When using a surface, in general there is no need to use this method because the lock/unlock methods take care of that.

See also:
Ceylan::Lockable.

This method cannot be inlined since it is inherited.

Definition at line 3524 of file OSDLSurface.cc.

References _surface.

Referenced by OSDL::Video::Pixels::putPixelColor().

Surface& OSDL::Video::Surface::operator= ( const Surface source  )  [private]

Assignment operator made private to ensure that it will never be called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void Surface::postLock (  )  [protected, virtual]

Effective locking of the surface.

Nevertheless, only lock/unlock pair should be used by user programs.

See also:
Ceylan::Lockable

Definition at line 3560 of file OSDLSurface.cc.

References _surface.

void Surface::preUnlock (  )  [protected, virtual]

Effective unlocking of the surface.

Nevertheless, only lock/unlock pair should be used by user programs.

See also:
Ceylan::Lockable

Definition at line 3542 of file OSDLSurface.cc.

References _surface.

virtual bool OSDL::Video::Surface::printText ( const std::string &  text,
Coordinate  x,
Coordinate  y,
Pixels::ColorDefinition  colorDef = Pixels::White 
) [virtual]

Prints specified string on this surface, with specified color, taking as upper left corner specified coordinates.

Basic font will be used.

See also:
Font class for far better text rendering, including fixed and TrueType fonts.
bool Surface::printText ( const std::string &  text,
Coordinate  x,
Coordinate  y,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque 
) [virtual]

Prints specified string on this surface, with specified color, taking as upper left corner specified coordinates.

Basic font will be used.

See also:
Font class for far better text rendering, including fixed and TrueType fonts.

Definition at line 1922 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Text::printBasic().

Referenced by OSDL::Video::TwoDimensional::Widget::drawDecorations().

virtual void OSDL::Video::Surface::putColorDefinitionAt ( Coordinate  x,
Coordinate  y,
Pixels::ColorDefinition  colorDef,
bool  blending = true,
bool  clipping = true,
bool  locking = false 
) [virtual]

Sets the pixel at [x;y] of this surface to the given color, specified as a color definition (set of RGBA coordinates).

Parameters:
x the abscissa of the point to change.
y the ordinate of the point to change.
colorDef the RGBA color definition of the put pixel.
blending tells whether the alpha channel must be taken into account, resulting to alpha blending with the destination pixel. If false, the exact specified color will be put in target pixel, instead of being blended with it.
clipping tells whether point location is checked against surface bounds. If clipping is activated and the pixel is outside, nothing is done.
locking tells whether this primitive should take care of locking / unlocking the surface (not recommended on a per pixel basis because of lock overhead)
Exceptions:
VideoException if a problem occurs with a lock operation.
Note:
The four RGBA coordinates will be automatically mapped according to the target surface's pixel format.
See also:
getPixel
OSDL::Video::Pixels::put

Referenced by setAlphaForColor().

virtual void OSDL::Video::Surface::putPixelColorAt ( Coordinate  x,
Coordinate  y,
Pixels::PixelColor  convertedColor,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque,
bool  blending = true,
bool  clipping = true,
bool  locking = false 
) [virtual]

Sets the pixel at [x;y] of this surface to the given color, specified as an already converted RGBA color.

Parameters:
alpha the alpha coordinate of the pixel to be put with full precision: the alpha encoded in the converted color may not be reliable.
blending tells whether the alpha channel must be taken into account, resulting to alpha blending with the destination pixel. If false, the exact specified color will be put in target pixel, instead of being blended with it.
clipping tells whether point location is checked against surface bounds. If clipping is activated and the pixel is outside, nothing is done.
locking tells whether this primitive should take care of locking / unlocking the surface (not recommended on a per pixel basis, because of lock overhead).

Referenced by createColorReducedSurfaceFor().

virtual void OSDL::Video::Surface::putRGBAPixelAt ( Coordinate  x,
Coordinate  y,
Pixels::ColorElement  red,
Pixels::ColorElement  green,
Pixels::ColorElement  blue,
Pixels::ColorElement  alpha = Pixels::AlphaOpaque,
bool  blending = true,
bool  clipping = true,
bool  locking = false 
) [virtual]

Sets the pixel at [x;y] of this surface to the given color, specified as separate RGBA coordinates.

Parameters:
x the abscissa of the point to change.
y the ordinate of the point to change.
red the red color coordinate.
green the green color coordinate.
blue the blue color coordinate.
alpha the alpha color coordinate.
blending tells whether the alpha channel must be taken into account, resulting to alpha blending with the destination pixel. If false, the exact specified color will be put in target pixel, instead of being blended with it.
clipping tells whether point location is checked against surface bounds. If clipping is activated and the pixel is outside, nothing is done.
locking tells whether this primitive should take $ care of locking / unlocking the surface (not recommended on a per pixel basis, because of lock overhead)
Exceptions:
VideoException if a problem occurs with a lock operation.
Note:
The four RGBA coordinates will be automatically mapped according to the target surface's pixel format.
See also:
getPixel.
OSDL::Video::Pixels::put.
void Surface::putWidgetToBack ( TwoDimensional::Widget widget  )  [virtual]

Changes stacking inside this container surface so that specified widget is put to back.

Note:
Specified widget must already be registered to this surface.
Exceptions:
VideoException if the widget is not a registered one.

Definition at line 3469 of file OSDLSurface.cc.

void Surface::putWidgetToFront ( TwoDimensional::Widget widget  )  [virtual]

Changes stacking inside this container surface so that specified widget is put to front.

Note:
Specified widget must already be registered to this surface.
Exceptions:
VideoException if the widget is not a registered one.

Definition at line 3450 of file OSDLSurface.cc.

void Surface::redraw (  )  [virtual]

Redraws this surface if needed, and handles automatically its tree of widgets so that it gets fully up-to-date and ready to be blitted.

Returns:
true if and only if the whole redraw was performed without any problem.

Reimplemented in OSDL::Video::TwoDimensional::BackBufferedWidget, and OSDL::Video::TwoDimensional::Widget.

Definition at line 3340 of file OSDLSurface.cc.

References getRedrawState(), redrawInternal(), and setRedrawState().

Referenced by OSDL::Video::VideoModule::redraw(), and update().

void Surface::redrawInternal (  )  [virtual]

Basic do-nothing redraw method for internal rendering.

Note:
This method is meant to be overridden, so that this surface is able to paint itself, i.e. only its background, its widgets excluded.

Reimplemented in OSDL::Video::TwoDimensional::BackBufferedWidget, and OSDL::Video::TwoDimensional::Widget.

Definition at line 3382 of file OSDLSurface.cc.

Referenced by redraw().

void Surface::resize ( Length  newWidth,
Length  newHeight,
bool  scaleContent = false 
) [virtual]

Resizes this surface so that its new dimensions are the specified ones.

If the new dimensions are the same as the current ones, then nothing special will be done, surface stays as is. Otherwise, the surface will be resized and, depending of the 'scaleContent' flag, its content will be scaled (if true) or lost and replaced by a pure black surface, with the 'needs redraw' state set to true (if false).

Parameters:
newWidth the new surface width.
newHeight the new surface height;
scaleContent tells whether content should be scaled, or lost. If true, current content will be scaled, and antialiased if the Video module state machine says so.
Exceptions:
VideoException if the operation failed or is not supported.

Reimplemented in OSDL::Video::TwoDimensional::BackBufferedWidget, and OSDL::Video::TwoDimensional::Widget.

Definition at line 1200 of file OSDLSurface.cc.

References _surface, blitTo(), ColorkeyBlit, OSDL::Video::VideoModule::GetAntiAliasingState(), OSDL::Utils::getBackendLastError(), getBitsPerPixel(), OSDL::Video::Pixels::getCurrentColorMasks(), getFlags(), getHeight(), getPixelFormat(), getWidth(), RLEColorkeyBlit, setColorKey(), setRedrawState(), and zoom().

Referenced by OSDL::Video::TwoDimensional::BackBufferedWidget::resize(), setHeight(), and setWidth().

Surface & Surface::rotoZoom ( Ceylan::Maths::AngleInDegrees  angle,
Ceylan::Maths::Real  abscissaZoomFactor,
Ceylan::Maths::Real  ordinateZoomFactor,
bool  antialiasing = true 
) const [virtual]

Returns a newly created surface, obtained from this surface after a rotation of given angle and zooms of given factors.

If, for this surface, pixel color is not 8 bit or 32 bit, then a 32-bit surface will be internally created and used for the rotozoom.

Ownership of the returned surface is transferred to the caller, who will have to deallocate it when finish with it.

The final rendering speed depends first on antialiasing being requested or not, then on resulting surface size.

A surface is returned instead of rotating this surface to avoid accumulating rounding errors when rotozooming multiple times the same image: better use a constant source surface from which rotozoomed ones are created with various angles and zoom factors than changing the same surface again and again.

Parameters:
angle the angle of rotation, in degrees.
abscissaZoomFactor the zoom factor to be applied on the abscissa axis. If negative, the surface is flipped against this axis. No antialiasing will be performed in this case.
ordinateZoomFactor the zoom factor to be applied on the ordinate axis. If negative, the surface is flipped against this axis. No antialiasing will be performed in this case.
antialiasing if true and if zoom factors are positive, requests antialiasing (fine and expensive interpolation). 8-bit surfaces will never be antialiased.

Definition at line 2864 of file OSDLSurface.cc.

References _surface, and Surface().

Surface & Surface::rotoZoom ( Ceylan::Maths::AngleInDegrees  angle,
Ceylan::Maths::Real  zoomFactor,
bool  antialiasing = true 
) const [virtual]

Returns a newly created surface, obtained from this surface after a rotation of given angle and a zoom of given factor.

If, for this surface, pixel color is not 8 bit or 32 bit, then a 32-bit surface will be internally created and used for the rotozoom.

Ownership of the returned surface is transferred to the caller, who will have to deallocate it when having finished with it.

The final rendering speed depends first on antialiasing being requested or not, then on resulting surface size.

A surface is returned instead of rotating this surface to avoid accumulating rounding errors when rotozooming multiple times the same image: better use a constant source surface from which rotozoomed ones are created with various angles and zoom factors than changing the same surface again and again.

Parameters:
angle the angle of rotation, in degrees.
zoomFactor the zoom factor to be applied on both surface dimensions. If negative, the surface is rotated of Pi before the angle is applied. No antialiasing will be performed in this case.
antialiasing if true and if zoom factor is positive, requests antialiasing (fine and expensive interpolation). 8-bit surfaces will never be antialiased.

Definition at line 2855 of file OSDLSurface.cc.

void Surface::saveBMP ( const std::string &  filename,
bool  overwrite = true 
) [virtual]

Saves the current content of this surface into a BMP file.

Parameters:
filename the name of the BMP file to create (ex: 'screenshot.bmp')
overwrite tells whether an existing file filename should be overwritten, or if an exception should be raised.
Note:
The savePNG method should be preferred to this one.
See also:
savePNG, Video::makeScreenshot, loadBMP.

This method cannot be 'const' since this surface may have to be locked in order to access the pixels that are to be saved.

Definition at line 3110 of file OSDLSurface.cc.

References _surface, and OSDL::Utils::getBackendLastError().

Referenced by OSDL::Video::VideoModule::makeBMPScreenshot().

void Surface::savePNG ( const std::string &  filename,
bool  overwrite = true 
) [virtual]

Saves the current content of this surface into a PNG file.

Parameters:
filename the name of the PNG file to be created (ex: 'screenshot.png')
overwrite tells whether an existing file filename should be overwritten, or if an exception should be raised.
Note:
This method is especially useful for screenshots.
See also:
saveBMP, Video::makeScreenshot, loadPNG.

This method cannot be 'const' since this surface may have to be locked in order to access the pixels that are to be saved.

Definition at line 3101 of file OSDLSurface.cc.

References OSDL::Video::TwoDimensional::Image::SavePNG().

Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().

virtual void OSDL::Video::Surface::setAlpha ( Ceylan::Flags  flags,
Pixels::ColorElement  newAlpha 
) [virtual]

Adjusts the alpha properties of the surface: sets the per-surface alpha value and/or enables or disables alpha blending.

Parameters:
flags can be an OR'd combination of the following two options, one of these options, or 0 (none):

newAlpha is the per-surface alpha value. A surface needs not to have an alpha channel to use per-surface alpha, and blitting can still be accelerated with Surface::RLEColorkeyBlit.
Note:
0 (AlphaTransparent) is considered fully transparent and 255 (AlphaOpaque) is considered fully opaque.
The per-surface alpha value of 128 is considered a special case and is optimised, so it is much faster than other per-surface values.

Referenced by OSDL::Video::OpenGL::GLTexture::setUpInternalSurfaceFrom().

bool Surface::setAlphaForColor ( Pixels::ColorDefinition  colorDef,
Pixels::ColorElement  newAlpha 
) [virtual]
void Surface::setBitsPerPixel ( BitsPerPixel  newBitsPerPixel  )  [virtual]

Sets this surface's color depth, bits per pixel.

Note:
This method does not update the BytesPerPixel settings.

Definition at line 1315 of file OSDLSurface.cc.

References _surface.

void Surface::setBytesPerPixel ( BytesPerPixel  newBytesPerPixel  )  [virtual]

Sets this surface's color depth, bytes per pixel.

Note:
This method does not update the BytesPerPixel settings.

Definition at line 1347 of file OSDLSurface.cc.

References _surface.

virtual void OSDL::Video::Surface::setClippingArea ( UprightRectangle &  newClippingArea  )  [virtual]

Sets this surface's clipping area, expressed thanks to an UprightRectangle, whose ownership is left to the caller.

Should not be confused with the actual area corresponding to this surface, which is another UprightRectangle.

virtual void OSDL::Video::Surface::setColorKey ( Ceylan::Flags  flags,
Pixels::ColorDefinition  keyColorDef 
) [virtual]

Sets the color key (transparent pixel) in a blittable surface, and enables or disables RLE blit acceleration.

RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels (i.e. pixels that match the key value). The key must be defined accoring to the same pixel format as the surface.

Parameters:
flag can be a OR'ed combination:

  • if Surface::ColorkeyBlit is set, then the key is the transparent pixel value in the source image of a blit.
  • if Surface::RLEColorkeyBlit is set, RLE acceleration will be used when blitting this surface. The RLE encoding will be performed the first time the surface is blitted or when it will be converted to display format.

If flag is 0, this function clears any current color key.

Parameters:
keyColorDef the color definition of the color key.
Exceptions:
VideoException if the operation failed or is not supported.
virtual void OSDL::Video::Surface::setColorKey ( Ceylan::Flags  flags,
Pixels::PixelColor  keyPixelColor 
) [virtual]

Sets the color key (transparent pixel) in a blittable surface, and enables or disables RLE blit acceleration.

RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels (i.e. pixels that match the key value). The key must be defined accoring to the same pixel format as the surface.

Parameters:
flag can be a OR'ed combination:

  • if Surface::ColorkeyBlit is set, then the key is the transparent pixel value in the source image of a blit.
  • if Surface::RLEColorkeyBlit is set, RLE acceleration will be used when blitting this surface. The RLE encoding will be performed the first time the surface is blitted or when it will be converted to display format.

If flag is 0, this function clears any current color key.

Parameters:
keyPixelColor,the pixel color of the key. Pixels::convertColorDefinitionToPixelColor is often useful for obtaining a correct value for the color key.

Referenced by OSDL::Video::TwoDimensional::Text::FixedFont::basicRenderLatin1Glyph(), OSDL::Video::TwoDimensional::Text::Font::basicRenderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Image::LoadIcon(), OSDL::Video::TwoDimensional::Text::Font::renderLatin1MultiLineText(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::Font::renderLatin1TextWithWordCached(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text(), resize(), OSDL::Video::TwoDimensional::Widget::setBaseColorMode(), and OSDL::Video::TwoDimensional::BackBufferedWidget::setBaseColorMode().

void Surface::setDisplayType ( DisplayType  newDisplayType  )  [virtual]

Sets the new display type (back-buffer, screen, etc.

) of this surface.

Definition at line 573 of file OSDLSurface.cc.

References _displayType.

virtual void OSDL::Video::Surface::setFlags ( Ceylan::Flags  newFlags  )  [virtual]

Sets the flags caracterizing this surface.

Note:
Does not change anything to the surface, though.
See also:
the static Flags defined in this class.
void Surface::setHeight ( Length  newHeight  )  [virtual]

Sets this Surface's height.

If the new height is different from the current one, triggers a resize that will blank (in pure black) this surface and set its 'needs redraw' state to true.

Reimplemented from OSDL::Video::TwoDimensional::UprightRectangle.

Reimplemented in OSDL::Video::TwoDimensional::Widget.

Definition at line 1191 of file OSDLSurface.cc.

References getWidth(), and resize().

void UprightRectangle::setLowerRightAbscissa ( Coordinate  newAbscissa  )  [virtual, inherited]

Sets directly the abscissa of the lower right corner of this rectangle.

Exceptions:
VideoException if width or height would become negative.

Definition at line 252 of file OSDLUprightRectangle.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::_width, OSDL::Video::TwoDimensional::UprightRectangle::_x, OSDL::Video::TwoDimensional::UprightRectangle::toString(), and OSDL::Video::Pixels::toString().

void UprightRectangle::setLowerRightCorner ( Point2D newLowerRightCorner  )  [virtual, inherited]
void UprightRectangle::setLowerRightOrdinate ( Coordinate  newOrdinate  )  [virtual, inherited]

Sets directly the ordinate of the lower right corner of this rectangle.

Exceptions:
VideoException if width or height would become negative.

Definition at line 276 of file OSDLUprightRectangle.cc.

References OSDL::Video::TwoDimensional::UprightRectangle::_height, OSDL::Video::TwoDimensional::UprightRectangle::_y, OSDL::Video::TwoDimensional::UprightRectangle::toString(), and OSDL::Video::Pixels::toString().

void Surface::setMousePosition ( Coordinate  newX = 0,
Coordinate  newY = 0 
) [virtual]

Sets the position of the mouse cursor, by generating a mouse motion event.

Note:
Must be called on a screen surface, with mouse enabled of course.
Exceptions:
VideoException if the operation failed or is not supported.

Definition at line 3498 of file OSDLSurface.cc.

References _displayType, and BackBuffer.

Referenced by centerMousePosition().

void Surface::setOffset ( Offset  offset  )  [inline, protected]

Sets this surface's offset.

Definition at line 4160 of file OSDLSurface.cc.

References _surface.

virtual bool OSDL::Video::Surface::setPalette ( const Palette newPalette,
ColorCount  startingColorIndex = 0,
ColorCount  numberOfColors = 0,
Ceylan::Flags  targetedPalettes = Palette::Logical|Palette::Physical 
) [virtual]

Sets this surface's palette thanks to specified one.

Parameters:
newPalette the palette from which new color definitions should be copied (ownership not taken)
startingColorIndex the color-definition index in newPalette from which color definitions will be taken.
numberOfColors the number of colors that should be copied, starting from startingColorIndex. If zero, all remaining color definitions from newPalette will be taken.
targetedPalettes a flag which tells whether logical palette, physical one or both (OR'ed) should be updated.
Returns:
true if all colours were set exactly as requested, false otherwise (not all the color entries were set exactly as given).
Exceptions:
VideoException if the operation failed.

Referenced by createColorReducedSurfaceFor().

void Surface::setPitch ( Pitch  newPitch  )  [virtual]

Sets this surface's pitch.

Definition at line 1135 of file OSDLSurface.cc.

References _surface.

void Surface::setPixelFormat ( Pixels::PixelFormat newFormat  )  [virtual]

Sets this surface's pixel format.

Definition at line 933 of file OSDLSurface.cc.

References _surface.

void Surface::setPixels ( void *  newPixels  )  [virtual]

Sets this surface's video buffer, i.e.

its whole set of pixels.

Definition at line 1379 of file OSDLSurface.cc.

References _surface.

void Surface::setRedrawState ( bool  needsToBeRedrawn  )  [virtual]

Sets the need for redraw state.

Note:
Meant to be overriden by widget class. Public since a widget has to be able to call it on its container.

Reimplemented in OSDL::Video::TwoDimensional::Widget.

Definition at line 3322 of file OSDLSurface.cc.

References _needsRedraw.

Referenced by redraw(), resize(), OSDL::Video::TwoDimensional::Widget::setRedrawState(), and OSDL::Video::TwoDimensional::Widget::Widget().

void Surface::setSDLSurface ( LowLevelSurface newSurface,
DisplayType  displayType = BackBuffer 
) [virtual]

Sets this surface so that it corresponds to the supplied SDL surface.

Parameters:
newSurface the new surface to be managed
displayType tells whether this new surface is a backbuffer or a screen surface.
Note:
Deallocates any previously held surface.

Definition at line 550 of file OSDLSurface.cc.

References _displayType, _surface, and flush().

Referenced by OSDL::Video::TwoDimensional::Image::Load(), OSDL::Video::TwoDimensional::Image::LoadBMP(), OSDL::Video::TwoDimensional::Image::LoadGIF(), OSDL::Video::TwoDimensional::Image::LoadJPG(), OSDL::Video::TwoDimensional::Image::LoadLBM(), OSDL::Video::TwoDimensional::Image::LoadPCX(), OSDL::Video::TwoDimensional::Image::LoadPNG(), OSDL::Video::TwoDimensional::Image::LoadPNM(), OSDL::Video::TwoDimensional::Image::LoadTGA(), and OSDL::Video::TwoDimensional::Image::LoadXPM().

void UprightRectangle::setUpperLeftAbscissa ( Coordinate  newAbscissa  )  [virtual, inherited]
void UprightRectangle::setUpperLeftCorner ( Point2D newUpperLeftCorner  )  [virtual, inherited]
void UprightRectangle::setUpperLeftOrdinate ( Coordinate  newOrdinate  )  [virtual, inherited]
void Surface::setWidth ( Length  newWidth  )  [virtual]

Sets this Surface's width.

If the new width is different from the current one, triggers a resize that will blank (in pure black) this surface and set its 'needs redraw' state to true.

Reimplemented from OSDL::Video::TwoDimensional::UprightRectangle.

Reimplemented in OSDL::Video::TwoDimensional::Widget.

Definition at line 1165 of file OSDLSurface.cc.

References getHeight(), and resize().

LowLevelRect * UprightRectangle::toLowLevelRect (  )  const [virtual, inherited]
const string Surface::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]
void Surface::update (  )  [virtual]

Updates the display with this surface, which will be automatically set in an up-to-date state if necessary, so that it is fully redrawn, including its widgets.

If it is a screen surface (either OpenGL or not), it will be updated in order to have the display match the surface buffer. Does nothing more if this surface is not a screen surface.

Note:
When this method is called, the surface is supposed not to be locked.
  • on hardware that supports double-buffering, this method sets up a flip and returns. The hardware will wait for vertical retrace, and then swap video buffers before the next video surface blit or lock will return.

on hardware that does not support double-buffering, this is equivalent to calling the updateRectangle method with all arguments to zero.

Note:
The Surface::DoubleBuffered flag must have been passed to setMode, when setting the video mode, for this function to have a chance to perform hardware flipping.
See also:
SDL_Flip
Exceptions:
VideoException if the operation failed, including if this surface is not a screen surface.

Definition at line 3136 of file OSDLSurface.cc.

References _displayType, _surface, _updateCount, BackBuffer, ClassicalScreenSurface, OSDL::Utils::getBackendLastError(), OpenGLScreenSurface, and redraw().

Referenced by displayAtCenterWithFadeIn(), and displayAtCenterWithFadeOut().

void Surface::updateRectangle ( Coordinate  x,
Coordinate  y,
Length  width,
Length  height 
) [virtual]

Updates the part of this surface corresponding to specified rectangle.

Note:
The rectangle must be confined within the screen boundaries (no clipping is done).
If all arguments are equal to zero, the entire surface will be updated.
The surface must not be locked when this method is called.
Exceptions:
VideoException if the operation failed, including if this surface is not a screen surface.

Definition at line 3289 of file OSDLSurface.cc.

References _displayType, _surface, and BackBuffer.

virtual void OSDL::Video::Surface::updateRectangle ( const UprightRectangle &  rect  )  [virtual]

Updates the part of this surface corresponding to specified rectangle.

Note:
The rectangle must be confined within the screen boundaries (no clipping is done).
The surface must not be locked when this method is called.
Exceptions:
VideoException if the operation failed, including if this surface is not a screen surface.
virtual void OSDL::Video::Surface::updateRectangles ( const std::list< UprightRectangle * > &  listRects  )  [virtual]

Updates the part of this surface corresponding to the specified list of rectangles.

Note:
The rectangles must be confined within the screen boundaries (no clipping is done).
The surface must not be locked when this method is called.
It is advised to call this method only once per frame, since each call has some processing overhead. This is no restriction, since you can pass any number of rectangles each time.

The rectangles are not automatically merged or checked for overlap. In general, the programmer can use his knowledge about his particular rectangles to merge them in an efficient way, to avoid overdraw.

Note:
STL too clumsy to understand list<const UprightRectangle const *> etc. (would require conversion by copy)
Exceptions:
VideoException if the operation failed, including if this surface is not a screen surface.
Surface & Surface::zoom ( Ceylan::Maths::Real  abscissaZoomFactor,
Ceylan::Maths::Real  ordinateZoomFactor,
bool  antialiasing = true 
) const [virtual]

Returns a newly created surface, obtained from this surface after a zoom of given factors.

If, for this surface, pixel color is not 8 bit or 32 bit, then a 32-bit surface will be internally created and used for the zoom.

Ownership of the returned surface is transferred to the caller, who will have to deallocate it when having finished with it.

The final rendering speed depends first on antialiasing being requested or not, then on resulting surface size.

A surface is returned instead of zooming directly this surface to avoid accumulating rounding errors when zooming multiple times the same image: better use a constant source surface from which zoomed ones are created with various zoom factors than changing the same surface again and again.

Parameters:
abscissaZoomFactor the zoom factor to be applied on the abscissa axis. If negative, the surface is flipped against this axis. No antialiasing will be performed in this case.
ordinateZoomFactor the zoom factor to be applied on the ordinate axis. If negative, the surface is flipped against this axis. No antialiasing will be performed in this case.
antialiasing if true and if zoom factors are positive, requests antialiasing (fine and expensive interpolation). 8-bit surfaces will never be antialiased.

Definition at line 2822 of file OSDLSurface.cc.

References _surface, and Surface().

Referenced by resize().


Member Data Documentation

Tells what is the display type of this surface.

The display type has to be recorded since:

  • screen surfaces are not managed like backbuffers, since the formers have to update the screen
  • classical screen surfaces and OpenGL ones must be distinguished, since they update the screen differently (flip in double-buffering)

Definition at line 3815 of file OSDLSurface.h.

Referenced by clear(), flush(), getDisplayType(), setDisplayType(), setMousePosition(), setSDLSurface(), toString(), update(), updateRectangle(), and ~Surface().

Tells whether this surface must be locked before modifying it.

Definition at line 3824 of file OSDLSurface.h.

Tells whether the surface would need to be redrawn.

Private to force all child classes to use a get/set method for safe overloading (no unexpected shortcut due to faulty assignment).

Definition at line 3851 of file OSDLSurface.h.

Referenced by getRedrawState(), and setRedrawState().

Counts the number of updates for this surface.

Note:
Useful for the screen surface to compute the number of frames per second.

Definition at line 3835 of file OSDLSurface.h.

Referenced by getUpdateCount(), and update().

const Ceylan::Flags Surface::AlphaBlendingBlit = 0x00010000 [static]
const Ceylan::Flags Surface::AnyPixelFormat = 0x10000000 [static]

Indicates that a display surface may use any pixel format.

Definition at line 373 of file OSDLSurface.h.

const Ceylan::Flags Surface::AsynchronousBlit = 0x00000004 [static]

Indicates that a surface should use asynchronous blits if possible.

Definition at line 308 of file OSDLSurface.h.

Offset used when printing caption in a container.

Definition at line 3702 of file OSDLSurface.h.

Offset used when printing caption in a container.

Definition at line 3706 of file OSDLSurface.h.

const Ceylan::Flags Surface::ColorkeyBlit = 0x00001000 [static]
const Ceylan::Flags Surface::DoubleBuffered = 0x40000000 [static]

Indicates that a display surface is to be double buffered.

Definition at line 381 of file OSDLSurface.h.

const Ceylan::Flags Surface::ExclusivePalette = 0x20000000 [static]

Indicates that a surface should have an exclusive palette.

Definition at line 313 of file OSDLSurface.h.

const Ceylan::Flags Surface::FullScreen = 0x80000000 [static]

Indicates that a display surface is to be full screen, not windowed.

Definition at line 390 of file OSDLSurface.h.

const Length Surface::graphAbscissaOffset = 10 [static]

Offset used when drawing curve in a container.

Definition at line 3693 of file OSDLSurface.h.

const Length Surface::graphOrdinateOffset = 15 [static]

Offset used when drawing curve in a container.

Definition at line 3697 of file OSDLSurface.h.

const Ceylan::Flags Surface::Hardware = 0x00000001 [static]
const Ceylan::Flags Surface::HardwareAcceleratedBlit = 0x00000100 [static]

Indicates that a surface is to use hardware-accelerated blits.

Definition at line 321 of file OSDLSurface.h.

const Ceylan::Flags Surface::OpenGL = 0x00000002 [static]

Indicates that a display surface should have an OpenGL context.

Definition at line 399 of file OSDLSurface.h.

const Ceylan::Flags Surface::Preallocated = 0x01000000 [static]

Indicates that a surface is to use preallocated memory.

Definition at line 345 of file OSDLSurface.h.

const Ceylan::Flags Surface::Resizable = 0x00000010 [static]

Indicates that a display surface is to be resizable.

Definition at line 408 of file OSDLSurface.h.

const Ceylan::Flags Surface::RLEColorkeyBlit = 0x00004000 [static]
const Ceylan::Flags Surface::RLEColorkeyBlitAvailable = 0x00002000 [static]

Indicates that RLE colorkey blit is actually accelerated (read-only).

Note:
The meaning of this private internal flag is an hypothesis, this flag should not be used externally anyway.

Definition at line 356 of file OSDLSurface.h.

const Ceylan::Flags Surface::Software = 0x00000000 [static]

Indicates that a surface is to be stored in system memory.

Definition at line 294 of file OSDLSurface.h.

Referenced by createColorReducedSurfaceFor(), OSDL::Video::TwoDimensional::drawDiscWithEdge(), and OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 14:06:03 2010 for OSDL by  doxygen 1.6.3