#include <OSDLSurface.h>
Inheritance diagram for OSDL::Video::Surface:
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.
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.
testOSDLVideo.cc
Definition at line 178 of file OSDLSurface.h.
Public Types | |
enum | DisplayType { BackBuffer, ClassicalScreenSurface, OpenGLScreenSurface } |
Describes the display type of a surface :. More... | |
Public Member Functions | |
Surface (SDL_Surface &surface, DisplayType displayType=BackBuffer) throw () | |
Constructs an OSDL Surface from a SDL 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) throw ( VideoException ) | |
Creates an empty surface, whose display type is back-buffer. | |
virtual | ~Surface () throw () |
Surface virtual destructor, frees internal buffer if needed. | |
virtual Clonable & | clone () const throw ( Ceylan::ClonableException ) |
Clones this Surface : creates a new Surface, exact copy of this Surface, but with no data shared with it at all. | |
virtual SDL_Surface & | getSDLSurface () const throw () |
Returns the SDL surface corresponding to that surface. | |
virtual void | setSDLSurface (SDL_Surface &newSurface, DisplayType displayType=BackBuffer) throw () |
Sets this surface so that it corresponds to the supplied SDL surface. | |
virtual DisplayType | getDisplayType () const throw () |
Returns the display type (back-buffer, screen, etc. | |
virtual void | setDisplayType (DisplayType newDisplayType) throw () |
Sets the new display type (back-buffer, screen, etc. | |
virtual Ceylan::Flags | getFlags () const throw () |
Returns the flags caracterizing this surface. | |
virtual void | setFlags (Ceylan::Flags newFlags) throw () |
Sets the flags caracterizing this surface. | |
virtual void | convertToDisplay (bool alphaChannelWanted=true) throw ( VideoException ) |
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) throw ( VideoException ) |
Adjusts the alpha properties of the surface : sets the per-surface alpha value and/or enables or disables alpha blending. | |
virtual void | setColorKey (Ceylan::Flags flags, Pixels::PixelColor keyPixelColor) throw ( VideoException ) |
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) throw ( VideoException ) |
Sets the color key (transparent pixel) in a blittable surface, and enables or disables RLE blit acceleration. | |
virtual void | convertFromColorKeyToAlphaChannel () throw ( VideoException ) |
Converts this surface, which must use a color key, so that it uses an alpha channel instead. | |
virtual bool | setPalette (Palette &newPalette, ColorCount startingColorIndex=0, ColorCount numberOfColors=0, Ceylan::Flags targettedPalettes=Palette::Logical|Palette::Physical) throw () |
Sets this surface's palette thanks to specified one. | |
virtual PixelFormat & | getPixelFormat () const throw () |
Returns this surface's pixel format. | |
virtual void | setPixelFormat (PixelFormat &newFormat) throw () |
Sets this surface's pixel format. | |
virtual Pitch | getPitch () const throw () |
Returns this surface's pitch. | |
virtual void | setPitch (Pitch newPitch) throw () |
Sets this surface's pitch. | |
virtual Length | getWidth () const throw () |
Returns this Surface's width. | |
virtual void | setWidth (Length newWidth) throw () |
Sets this Surface's width. | |
virtual Length | getHeight () const throw () |
Returns this Surface's height. | |
virtual void | setHeight (Length newHeight) throw () |
Sets this Surface's height. | |
virtual void | resize (Length newWidth, Length newHeight, bool scaleContent=false) throw () |
Resizes this surface so that its new dimensions are the specified ones. | |
virtual BitsPerPixel | getBitsPerPixel () const throw () |
Returns this surface's color depth, bits per pixel. | |
virtual void | setBitsPerPixel (BitsPerPixel newBitsPerPixel) throw () |
Sets this surface's color depth, bits per pixel. | |
virtual BytesPerPixel | getBytesPerPixel () const throw () |
Returns this surface's overall color depth, bytes per pixel. | |
virtual void | setBytesPerPixel (BytesPerPixel newBytesPerPixel) throw () |
Sets this surface's color depth, bytes per pixel. | |
virtual void * | getPixels () const throw () |
Returns this surface's video buffer, i.e. | |
virtual void | setPixels (void *newPixels) throw () |
Sets this surface's video buffer, i.e. | |
virtual bool | fill (Pixels::ColorDefinition colorDef=Pixels::Black) throw () |
Fills this surface with specified color. | |
virtual bool | clear () throw () |
Clears the screen. | |
virtual Surface & | flipVertical () const throw () |
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 Surface & | flipHorizontal () const throw () |
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) throw () |
Returns a textual description of the pixel of this surface located at [x;y]. | |
virtual Pixels::PixelColor | getPixelColorAt (Coordinate x, Coordinate y) const throw ( VideoException ) |
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 throw ( VideoException ) |
Returns the color definition of one particular pixel of this surface, located at [x;y]. | |
virtual void | putRGBAPixelAt (Coordinate x, Coordinate y, ColorElement red, ColorElement green, ColorElement blue, ColorElement alpha=AlphaOpaque, bool blending=true, bool clipping=true, bool locking=false) throw ( VideoException ) |
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, ColorDefinition colorDef, bool blending=true, bool clipping=true, bool locking=false) throw ( VideoException ) |
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, PixelColor convertedColor, ColorElement alpha, bool blending=true, bool clipping=true, bool locking=false) throw ( VideoException ) |
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) throw () |
virtual bool | drawHorizontalLine (Coordinate xStart, Coordinate xStop, Coordinate y, Pixels::ColorElement red, Pixels::ColorElement green, Pixels::ColorElement blue, Pixels::ColorElement alpha=Pixels::AlphaOpaque) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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 ¢er, Pixels::ColorDefinition colorDef=Pixels::White, Length squareEdge=5) throw () |
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) throw () |
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) throw () |
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) throw () |
Draws a box with specified RGBA color. | |
virtual bool | drawBox (const UprightRectangle &rectangle, Pixels::ColorDefinition colorDef=Pixels::White, bool filled=true) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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) throw () |
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, ColorDefinition colorDef=Pixels::White) throw () |
Prints specified string on this surface, with specified color, taking as upper left corner specified coordinates. | |
virtual bool | blitTo (Surface &targetSurface) const throw ( VideoException ) |
Blits this surface onto specified surface. | |
virtual bool | blitTo (Surface &targetSurface, Coordinate x, Coordinate y) const throw ( VideoException ) |
Blits this surface onto specified surface. | |
virtual bool | blitTo (Surface &targetSurface, const TwoDimensional::Point2D &location) const throw ( VideoException ) |
Blits this surface onto specified surface. | |
virtual bool | blitTo (Surface &targetSurface, const TwoDimensional::UprightRectangle &sourceRectangle, const TwoDimensional::Point2D &destinationLocation) const throw ( VideoException ) |
Blits this surface onto specified surface. | |
virtual Surface & | zoom (Ceylan::Maths::Real abscissaZoomFactor, Ceylan::Maths::Real ordinateZoomFactor, bool antialiasing=true) const throw ( VideoException ) |
Returns a newly created surface, obtained from this surface after a zoom of given factors. | |
virtual Surface & | rotoZoom (Ceylan::Maths::AngleInDegrees angle, Ceylan::Maths::Real zoomFactor, bool antialiasing=true) const throw ( VideoException ) |
Returns a newly created surface, obtained from this surface after a rotation of given angle and a zoom of given factor. | |
virtual Surface & | rotoZoom (Ceylan::Maths::AngleInDegrees angle, Ceylan::Maths::Real abscissaZoomFactor, Ceylan::Maths::Real ordinateZoomFactor, bool antialiasing=true) const throw ( VideoException ) |
Returns a newly created surface, obtained from this surface after a rotation of given angle and zooms of given factors. | |
virtual UprightRectangle & | getClippingArea () const throw () |
Returns this surface's clipping area, expressed thanks to an UprightRectangle. | |
virtual void | setClippingArea (UprightRectangle &newClippingArea) throw () |
Sets this surface's clipping area, expressed thanks to an UprightRectangle, whose ownership is left to the caller. | |
virtual void | loadImage (const std::string &filename, bool blitOnly=false, bool convertToDisplayFormat=true, bool convertWithAlpha=true) throw ( TwoDimensional::ImageException ) |
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) throw ( TwoDimensional::ImageException ) |
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) throw ( TwoDimensional::ImageException ) |
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) throw ( TwoDimensional::ImageException ) |
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) throw ( TwoDimensional::ImageException ) |
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) throw ( TwoDimensional::ImageException ) |
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) throw ( TwoDimensional::ImageException ) |
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) throw ( TwoDimensional::ImageException ) |
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) throw ( TwoDimensional::ImageException ) |
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) throw ( TwoDimensional::ImageException ) |
Loads a XPM image from specified file into this surface. | |
virtual void | savePNG (const std::string &filename, bool overwrite=true) throw ( TwoDimensional::ImageException ) |
Saves the current content of this surface into a PNG file. | |
virtual void | saveBMP (const std::string &filename, bool overwrite=true) throw ( TwoDimensional::ImageException ) |
Saves the current content of this surface into a BMP file. | |
virtual void | update () throw ( VideoException ) |
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 void | updateRectangles (const std::list< UprightRectangle * > &listRects) throw ( VideoException ) |
Updates the part of this surface corresponding to the specified list of rectangles. | |
virtual void | updateRectangle (const UprightRectangle &rect) throw ( VideoException ) |
Updates the part of this surface corresponding to specified rectangle. | |
virtual void | updateRectangle (Coordinate x, Coordinate y, Length width, Length height) throw ( VideoException ) |
Updates the part of this surface corresponding to specified rectangle. | |
virtual void | setRedrawState (bool needsToBeRedrawn) throw () |
Sets the need for redraw state. | |
virtual bool | getRedrawState () const throw () |
Returns the current need for redraw state. | |
virtual void | redraw () throw () |
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 () throw () |
Basic do-nothing redraw method for internal rendering. | |
virtual bool | isInternalSurfaceAvailable () const throw () |
Tells whether the internal SDL surface is void or not. | |
virtual void | addWidget (TwoDimensional::Widget &widget) throw ( VideoException ) |
Registers specified widget to this surface, and put it at top level. | |
Surface & | getWidgetRenderTarget () throw () |
Returns the surface that should be targeted by widgets having to blit their renderings to their container. | |
virtual void | putWidgetToFront (TwoDimensional::Widget &widget) throw ( VideoException ) |
Changes stacking inside this container surface so that specified widget is put to front. | |
virtual void | putWidgetToBack (TwoDimensional::Widget &widget) throw ( VideoException ) |
Changes stacking inside this container surface so that specified widget is put to back. | |
virtual void | centerMousePosition () throw () |
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) throw () |
Sets the position of the mouse cursor, by generating a mouse motion event. | |
virtual bool | mustBeLocked () const throw () |
Tells whether this surface has to be locked before modifying it. | |
virtual Ceylan::System::Size | getSizeInMemory () const throw () |
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) throw () |
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 throw () |
Returns an user-friendly description of the state of this object. | |
virtual Point2D | getUpperLeftCorner () const throw () |
Returns this UprightRectangle's upper left corner. | |
virtual void | setUpperLeftCorner (Point2D &newUpperLeftCorner) throw () |
Sets this UprightRectangle's upper left corner, width and height do not change. | |
virtual Coordinate | getUpperLeftAbscissa () const throw () |
Returns directly the abscissa of upper left corner. | |
virtual void | setUpperLeftAbscissa (Coordinate newAbscissa) throw () |
Sets directly the abscissa of the upper left corner of this rectangle. | |
virtual Coordinate | getUpperLeftOrdinate () const throw () |
Returns directly the ordinate of upper left corner. | |
virtual void | setUpperLeftOrdinate (Coordinate newOrdinate) throw () |
Sets directly the ordinate of the upper left corner of this rectangle. | |
virtual Point2D | getLowerRightCorner () const throw () |
Returns this UprightRectangle's lower right corner. | |
virtual void | setLowerRightCorner (Point2D &newLowerRightCorner) throw ( VideoException) |
Sets directly the lower right corner of this rectangle. | |
virtual Coordinate | getLowerRightAbscissa () const throw () |
Returns directly the abscissa of lower right corner. | |
virtual void | setLowerRightAbscissa (Coordinate newAbscissa) throw ( VideoException ) |
Sets directly the abscissa of the lower right corner of this rectangle. | |
virtual Coordinate | getLowerRightOrdinate () const throw () |
Returns directly the ordinate of lower right corner. | |
virtual void | setLowerRightOrdinate (Coordinate newOrdinate) throw ( VideoException ) |
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 throw () |
Draws this UprightRectangle to specified surface with specified RGBA color. | |
virtual bool | draw (Surface &target, Pixels::ColorDefinition colorDef=Pixels::White, bool filled=true) const throw () |
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 throw () |
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 throw ( VideoException ) |
Computes the preferred radius of round corners for this rectangle, with the specified edge width. | |
virtual SDL_Rect * | toSDLRect () const throw ( VideoException ) |
Static Public Member Functions | |
static Surface & | LoadImage (const std::string &filename, bool convertToDisplayFormat=true, bool convertWithAlpha=true) throw ( TwoDimensional::ImageException ) |
Surface factory : creates a new Surface instance from specified image file. | |
static std::string | InterpretFlags (Ceylan::Flags flags) throw () |
Outputs a textual description of the given surface flags. | |
Static Public Attributes | |
static const Ceylan::Flags | Software |
Indicates that a surface is to be stored in system memory. | |
static const Ceylan::Flags | Hardware |
Indicates that a surface is to be stored in video memory. | |
static const Ceylan::Flags | AsynchronousBlit |
Indicates that a surface should use asynchronous blits if possible. | |
static const Ceylan::Flags | ExclusivePalette |
Indicates that a surface should have an exclusive palette. | |
static const Ceylan::Flags | HardwareAcceleratedBlit |
Indicates that a surface is to use hardware-accelerated blits. | |
static const Ceylan::Flags | ColorkeyBlit |
Indicates that a surface is to use colorkey blits. | |
static const Ceylan::Flags | RLEColorkeyBlit |
Indicates that a surface is to use RLE-accelerated colorkey blits. | |
static const Ceylan::Flags | AlphaBlendingBlit |
Indicates that a surface is to use alpha blending blits. | |
static const Ceylan::Flags | Preallocated |
Indicates that a surface is to use preallocated memory. | |
static const Ceylan::Flags | RLEColorkeyBlitAvailable |
Indicates that RLE colorkey blit is actually accelerated (read-only). | |
static const Ceylan::Flags | AnyPixelFormat |
Indicates that a display surface may use any pixel format. | |
static const Ceylan::Flags | DoubleBuffered |
Indicates that a display surface is to be double buffered. | |
static const Ceylan::Flags | FullScreen |
Indicates that a display surface is to be full screen, not windowed. | |
static const Ceylan::Flags | OpenGL |
Indicates that a display surface should have an OpenGL context. | |
static const Ceylan::Flags | Resizable |
Indicates that a display surface is to be resizable. | |
static const Length | graphAbscissaOffset |
Offset used when drawing curve in a container. | |
static const Length | graphOrdinateOffset |
Offset used when drawing curve in a container. | |
static const Length | captionAbscissaOffset |
Offset used when printing caption in a container. | |
static const Length | captionOrdinateOffset |
Offset used when printing caption in a container. | |
Protected Types | |
typedef Ceylan::Sint16 | Offset |
Offset of a Surface. | |
Protected Member Functions | |
virtual void | preUnlock () throw () |
Effective unlocking of the surface. | |
virtual void | postLock () throw () |
Effective locking of the surface. | |
Surface () throw () | |
Creates a completely void surface, whose display type is back-buffer. | |
Offset | getOffset () const throw () |
Returns this surface's offset. | |
void | setOffset (Offset offset) throw () |
Sets this surface's offset. | |
virtual void | flush () throw () |
Releases internal SDL surface. | |
virtual void | inconsistencyDetected (const std::string &message) const throw () |
Triggered when an abnormal inconsistency is detected between OSDL's surface state and its back-end counterpart. | |
Protected Attributes | |
SDL_Surface * | _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. | |
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) throw () | |
Copy constructor made private to ensure that it will never be called. | |
Surface & | operator= (const Surface &source) throw () |
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. |
typedef Ceylan::Sint16 OSDL::Video::Surface::Offset [protected] |
Describes the display type of a surface :.
Definition at line 197 of file OSDLSurface.h.
Surface::Surface | ( | SDL_Surface & | surface, | |
DisplayType | displayType = BackBuffer | |||
) | throw () [explicit] |
Constructs an OSDL Surface from a SDL surface.
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. |
Definition at line 144 of file OSDLSurface.cc.
References CHECKPOINT.
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 | |||
) | throw ( VideoException ) |
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.
flags | specify the type of Surface that should be created. This can be any combination of : |
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. |
VideoException | if an error occurred. |
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 | ( | ) | throw () [virtual] |
Surface virtual destructor, frees internal buffer if needed.
Definition at line 268 of file OSDLSurface.cc.
References _displayType, BackBuffer, CHECKPOINT, flush(), and OSDL::Video::Pixels::toString().
Surface::Surface | ( | ) | throw () [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.
Definition at line 248 of file OSDLSurface.cc.
References CHECKPOINT.
Referenced by clone(), flipHorizontal(), and flipVertical().
Surface::Surface | ( | const Surface & | source | ) | throw () [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 2672 of file OSDLSurface.cc.
Clonable & Surface::clone | ( | ) | const throw ( Ceylan::ClonableException ) [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.
VideoException | on failure, such as the impossibility of creating the new surface, or to blit the former one. |
Definition at line 316 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().
SDL_Surface & Surface::getSDLSurface | ( | ) | const throw () [virtual] |
Returns the SDL surface corresponding to that surface.
This surface keeps ownership of the returned SDL surface.
Definition at line 387 of file OSDLSurface.cc.
References _surface.
Referenced by OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), OSDL::Video::Overlay::Overlay(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text(), OSDL::Video::VideoModule::setWindowIcon(), and OSDL::Video::VideoModule::toggleFullscreen().
void Surface::setSDLSurface | ( | SDL_Surface & | newSurface, | |
DisplayType | displayType = BackBuffer | |||
) | throw () [virtual] |
Sets this surface so that it corresponds to the supplied SDL surface.
newSurface | the new surface to be managed | |
displayType | tells whether this new surface is a backbuffer or a screen surface. |
Definition at line 396 of file OSDLSurface.cc.
Surface::DisplayType Surface::getDisplayType | ( | ) | const throw () [virtual] |
Returns the display type (back-buffer, screen, etc.
) of this Surface.
Definition at line 409 of file OSDLSurface.cc.
References _displayType.
void Surface::setDisplayType | ( | DisplayType | newDisplayType | ) | throw () [virtual] |
Sets the new display type (back-buffer, screen, etc.
) of this surface.
Definition at line 417 of file OSDLSurface.cc.
Ceylan::Flags Surface::getFlags | ( | ) | const throw () [virtual] |
Returns the flags caracterizing this surface.
Definition at line 425 of file OSDLSurface.cc.
References _surface.
Referenced by clone(), and convertFromColorKeyToAlphaChannel().
virtual void OSDL::Video::Surface::setFlags | ( | Ceylan::Flags | newFlags | ) | throw () [virtual] |
Sets the flags caracterizing this surface.
void Surface::convertToDisplay | ( | bool | alphaChannelWanted = true |
) | throw ( VideoException ) [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.
alphaChannelWanted | tells whether this converted surface should have an alpha channel after this call. |
VideoException | if no internal surface is available, if the conversion failed or if there is not enough memory. |
Definition at line 442 of file OSDLSurface.cc.
Referenced by OSDL::Video::TwoDimensional::Text::FixedFont::basicRenderLatin1Glyph(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), convertFromColorKeyToAlphaChannel(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), and OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text().
virtual void OSDL::Video::Surface::setAlpha | ( | Ceylan::Flags | flags, | |
Pixels::ColorElement | newAlpha | |||
) | throw ( VideoException ) [virtual] |
Adjusts the alpha properties of the surface : sets the per-surface alpha value and/or enables or disables alpha blending.
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. |
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.
virtual void OSDL::Video::Surface::setColorKey | ( | Ceylan::Flags | flags, | |
Pixels::PixelColor | keyPixelColor | |||
) | throw ( VideoException ) [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.
flag | can be a OR'ed combination :
|
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::TrueTypeFont::basicRenderUnicodeGlyph(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), and OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text().
virtual void OSDL::Video::Surface::setColorKey | ( | Ceylan::Flags | flags, | |
Pixels::ColorDefinition | keyColorDef | |||
) | throw ( VideoException ) [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.
flag | can be a OR'ed combination :
|
keyColorDef | the color definition of the color key. |
void Surface::convertFromColorKeyToAlphaChannel | ( | ) | throw ( VideoException ) [virtual] |
Converts this surface, which must use a color key, so that it uses an alpha channel instead.
This method uses 'convertToDisplay'.
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 504 of file OSDLSurface.cc.
References ColorkeyBlit, convertToDisplay(), getFlags(), and toString().
virtual bool OSDL::Video::Surface::setPalette | ( | Palette & | newPalette, | |
ColorCount | startingColorIndex = 0 , |
|||
ColorCount | numberOfColors = 0 , |
|||
Ceylan::Flags | targettedPalettes = Palette::Logical|Palette::Physical | |||
) | throw () [virtual] |
Sets this surface's palette thanks to specified one.
newPalette | the palette from which new color definitions should be 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. | |
targettedPalettes | a flag which tells whether logical palette, physical one or both (OR'ed) should be updated. |
Pixels::PixelFormat & Surface::getPixelFormat | ( | ) | const throw () [virtual] |
Returns this surface's pixel format.
Definition at line 552 of file OSDLSurface.cc.
References _surface.
Referenced by OSDL::Video::TwoDimensional::Text::FixedFont::basicRenderLatin1Glyph(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), clone(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), and OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text().
void Surface::setPixelFormat | ( | PixelFormat & | newFormat | ) | throw () [virtual] |
Pitch Surface::getPitch | ( | ) | const throw () [virtual] |
void Surface::setPitch | ( | Pitch | newPitch | ) | throw () [virtual] |
Length Surface::getWidth | ( | ) | const throw () [virtual] |
Returns this Surface's width.
Reimplemented from OSDL::Video::TwoDimensional::UprightRectangle.
Definition at line 708 of file OSDLSurface.cc.
References _surface.
Referenced by centerMousePosition(), clone(), OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer(), OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
void Surface::setWidth | ( | Length | newWidth | ) | throw () [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 716 of file OSDLSurface.cc.
Length Surface::getHeight | ( | ) | const throw () [virtual] |
Returns this Surface's height.
Reimplemented from OSDL::Video::TwoDimensional::UprightRectangle.
Definition at line 724 of file OSDLSurface.cc.
References _surface.
Referenced by centerMousePosition(), clone(), OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer(), OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
void Surface::setHeight | ( | Length | newHeight | ) | throw () [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 732 of file OSDLSurface.cc.
void Surface::resize | ( | Length | newWidth, | |
Length | newHeight, | |||
bool | scaleContent = false | |||
) | throw () [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).
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. |
Reimplemented in OSDL::Video::TwoDimensional::BackBufferedWidget, and OSDL::Video::TwoDimensional::Widget.
Definition at line 740 of file OSDLSurface.cc.
References blitTo(), OSDL::Video::VideoModule::GetAntiAliasingState(), OSDL::Utils::getBackendLastError(), and OSDL::Video::Pixels::getCurrentColorMasks().
Referenced by OSDL::Video::TwoDimensional::Widget::resize().
BitsPerPixel Surface::getBitsPerPixel | ( | ) | const throw () [virtual] |
Returns this surface's color depth, bits per pixel.
Definition at line 830 of file OSDLSurface.cc.
References _surface.
Referenced by clone().
void Surface::setBitsPerPixel | ( | BitsPerPixel | newBitsPerPixel | ) | throw () [virtual] |
Sets this surface's color depth, bits per pixel.
Definition at line 838 of file OSDLSurface.cc.
BytesPerPixel Surface::getBytesPerPixel | ( | ) | const throw () [virtual] |
Returns this surface's overall color depth, bytes per pixel.
Definition at line 848 of file OSDLSurface.cc.
References _surface.
void Surface::setBytesPerPixel | ( | BytesPerPixel | newBytesPerPixel | ) | throw () [virtual] |
Sets this surface's color depth, bytes per pixel.
Definition at line 856 of file OSDLSurface.cc.
void * Surface::getPixels | ( | ) | const throw () [virtual] |
Returns this surface's video buffer, i.e.
its whole set of pixels.
Definition at line 866 of file OSDLSurface.cc.
References _surface.
void Surface::setPixels | ( | void * | newPixels | ) | throw () [virtual] |
Sets this surface's video buffer, i.e.
its whole set of pixels.
Definition at line 875 of file OSDLSurface.cc.
bool Surface::fill | ( | Pixels::ColorDefinition | colorDef = Pixels::Black |
) | throw () [virtual] |
Fills this surface with specified color.
Can be used for blanking a surface, if the background color is chosen.
colorDef | the color definition of the fill color. |
Definition at line 570 of file OSDLSurface.cc.
References OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::TwoDimensional::Text::FixedFont::basicRenderLatin1Glyph(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), OSDL::Video::TwoDimensional::Widget::clean(), clear(), OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer(), OSDL::Video::TwoDimensional::BackBufferedWidget::redrawInternal(), OSDL::Video::TwoDimensional::Text::Font::renderLatin1MultiLineText(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), and OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text().
bool Surface::clear | ( | ) | throw () [virtual] |
Clears the screen.
This method performs a mere 'fill' with pure black.
Definition at line 590 of file OSDLSurface.cc.
References OSDL::Video::Pixels::Black, and fill().
Surface & Surface::flipVertical | ( | ) | const throw () [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 '<'.
Definition at line 598 of file OSDLSurface.cc.
Surface & Surface::flipHorizontal | ( | ) | const throw () [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'.
Definition at line 640 of file OSDLSurface.cc.
string Surface::describePixelAt | ( | Coordinate | x, | |
Coordinate | y | |||
) | throw () [virtual] |
Returns a textual description of the pixel of this surface located at [x;y].
x | the abscissa of the pixel. | |
y | the ordinate of the pixel. |
Definition at line 675 of file OSDLSurface.cc.
References OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::TwoDimensional::drawDiscWithEdge().
Pixels::PixelColor Surface::getPixelColorAt | ( | Coordinate | x, | |
Coordinate | y | |||
) | const throw ( VideoException ) [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.
Definition at line 888 of file OSDLSurface.cc.
References OSDL::Video::Pixels::getPixelColor().
Pixels::ColorDefinition Surface::getColorDefinitionAt | ( | Coordinate | x, | |
Coordinate | y | |||
) | const throw ( VideoException ) [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.
Definition at line 897 of file OSDLSurface.cc.
References OSDL::Video::Pixels::convertPixelColorToColorDefinition(), and OSDL::Video::Pixels::getPixelColor().
void Surface::putRGBAPixelAt | ( | Coordinate | x, | |
Coordinate | y, | |||
ColorElement | red, | |||
ColorElement | green, | |||
ColorElement | blue, | |||
ColorElement | alpha = AlphaOpaque , |
|||
bool | blending = true , |
|||
bool | clipping = true , |
|||
bool | locking = false | |||
) | throw ( VideoException ) [virtual] |
Sets the pixel at [x;y] of this surface to the given color, specified as separate RGBA coordinates.
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) |
VideoException | if a problem occurs with a lock operation. |
OSDL::Video::Pixels::put.
Definition at line 908 of file OSDLSurface.cc.
References OSDL::Video::Pixels::putRGBAPixel().
void Surface::putColorDefinitionAt | ( | Coordinate | x, | |
Coordinate | y, | |||
ColorDefinition | colorDef, | |||
bool | blending = true , |
|||
bool | clipping = true , |
|||
bool | locking = false | |||
) | throw ( VideoException ) [virtual] |
Sets the pixel at [x;y] of this surface to the given color, specified as a color definition (set of RGBA coordinates).
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) |
VideoException | if a problem occurs with a lock operation. |
OSDL::Video::Pixels::put
Definition at line 921 of file OSDLSurface.cc.
References OSDL::Video::Pixels::putRGBAPixel().
void Surface::putPixelColorAt | ( | Coordinate | x, | |
Coordinate | y, | |||
PixelColor | convertedColor, | |||
ColorElement | alpha, | |||
bool | blending = true , |
|||
bool | clipping = true , |
|||
bool | locking = false | |||
) | throw ( VideoException ) [virtual] |
Sets the pixel at [x;y] of this surface to the given color, specified as an already converted RGBA color.
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). |
Definition at line 932 of file OSDLSurface.cc.
References OSDL::Video::Pixels::putPixelColor().
bool Surface::setAlphaForColor | ( | Pixels::ColorDefinition | colorDef, | |
Pixels::ColorElement | newAlpha | |||
) | throw () [virtual] |
Definition at line 944 of file OSDLSurface.cc.
References OSDL::Video::Pixels::areEqual(), OSDL_DEBUG_PIXEL, and OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::TwoDimensional::drawDiscWithEdge().
bool Surface::drawHorizontalLine | ( | Coordinate | xStart, | |
Coordinate | xStop, | |||
Coordinate | y, | |||
Pixels::ColorElement | red, | |||
Pixels::ColorElement | green, | |||
Pixels::ColorElement | blue, | |||
Pixels::ColorElement | alpha = Pixels::AlphaOpaque | |||
) | throw () [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.
Clipping is performed.
This line will be antialiased if antialias mode is set.
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState
Definition at line 1041 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Line::drawHorizontal().
bool Surface::drawHorizontalLine | ( | Coordinate | xStart, | |
Coordinate | xStop, | |||
Coordinate | y, | |||
Pixels::PixelColor | actualColor | |||
) | throw () [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.
Clipping is performed.
This line will be antialiased if antialias mode is set.
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState
Definition at line 1052 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Line::drawHorizontal().
bool Surface::drawHorizontalLine | ( | Coordinate | xStart, | |
Coordinate | xStop, | |||
Coordinate | y, | |||
Pixels::ColorDefinition | colorDef = Pixels::White | |||
) | throw () [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.
Clipping is performed.
This line will be antialiased if antialias mode is set.
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState
Definition at line 1061 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Line::drawHorizontal().
bool Surface::drawVerticalLine | ( | Coordinate | x, | |
Coordinate | yStart, | |||
Coordinate | yStop, | |||
Pixels::ColorElement | red, | |||
Pixels::ColorElement | green, | |||
Pixels::ColorElement | blue, | |||
Pixels::ColorElement | alpha = Pixels::AlphaOpaque | |||
) | throw () [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.
Clipping is performed.
This line will be antialiased if antialias mode is set.
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState
Definition at line 1071 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Line::drawVertical().
bool Surface::drawVerticalLine | ( | Coordinate | x, | |
Coordinate | yStart, | |||
Coordinate | yStop, | |||
Pixels::ColorDefinition | colorDef = Pixels::White | |||
) | throw () [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.
Clipping is performed.
This line will be antialiased if antialias mode is set.
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState.
Definition at line 1082 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Line::drawVertical().
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 | |||
) | throw () [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.
Clipping is performed.
This line will be antialiased if antialias mode is set.
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState
Definition at line 1092 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Line::draw().
bool Surface::drawLine | ( | Coordinate | xStart, | |
Coordinate | yStart, | |||
Coordinate | xStop, | |||
Coordinate | yStop, | |||
Pixels::ColorDefinition | = Pixels::White | |||
) | throw () [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.
Clipping is performed.
This line will be antialiased if antialias mode is set.
VideoModule::GetEndPointDrawState, VideoModule::GetAntiAliasingState
Definition at line 1104 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Line::draw().
bool Surface::drawCross | ( | const TwoDimensional::Point2D & | center, | |
Pixels::ColorDefinition | colorDef = Pixels::White , |
|||
Length | squareEdge = 5 | |||
) | throw () [virtual] |
Draws a cross centered in center, included in a square whose length of edge is squareEdge.
Locks surface if needed.
Clipping is performed.
This cross will be antialiased if antialias mode is set.
Definition at line 1114 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Line::drawCross().
bool Surface::drawCross | ( | Coordinate | xCenter, | |
Coordinate | yCenter, | |||
Pixels::ColorDefinition | colorDef = Pixels::White , |
|||
Length | squareEdge = 5 | |||
) | throw () [virtual] |
Draws a cross centered in center, included in a square whose length of edge is squareEdge.
Locks surface if needed.
Clipping is performed.
This cross will be antialiased if antialias mode is set.
Definition at line 1123 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Line::drawCross().
bool Surface::drawEdges | ( | Pixels::ColorDefinition | edgeColor = Pixels::White , |
|
Length | edgeWidth = 1 | |||
) | throw () [virtual] |
Draws the edges of this surface, with specified color and edge width.
edgeColor | the color of edges. | |
edgeWidth | the width of edges. |
Clipping is performed.
Definition at line 1132 of file OSDLSurface.cc.
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 | |||
) | throw () [virtual] |
Draws a box with specified RGBA color.
filled | tells whether the drawn rectangle should be filled with specified color, or if only its sides should be drawn. |
virtual bool OSDL::Video::Surface::drawBox | ( | const UprightRectangle & | rectangle, | |
Pixels::ColorDefinition | colorDef = Pixels::White , |
|||
bool | filled = true | |||
) | throw () [virtual] |
Draws a box with specified RGBA color.
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. |
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 | |||
) | throw () [virtual] |
Draws a circle whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface.
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. |
Clipping is performed.
A circle will be antialiased if antialias mode is set.
Definition at line 1192 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawCircle().
Referenced by OSDL::Video::TwoDimensional::drawDiscWithEdge().
bool Surface::drawCircle | ( | Coordinate | xCenter, | |
Coordinate | yCenter, | |||
Length | radius, | |||
Pixels::ColorDefinition | colorDef = Pixels::White , |
|||
bool | filled = true , |
|||
bool | blended = true | |||
) | throw () [virtual] |
Draws a circle whose center is (xCenter,yCenter) of specified radius, with specified RGBA color, on this surface.
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. |
Clipping is performed.
A circle will be antialiased if antialias mode is set.
Definition at line 1204 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawCircle().
bool Surface::drawDiscWithEdge | ( | Coordinate | xCenter, | |
Coordinate | yCenter, | |||
Length | outerRadius, | |||
Length | innerRadius, | |||
Pixels::ColorDefinition | ringColorDef = Pixels::Blue , |
|||
Pixels::ColorDefinition | discColorDef = Pixels::White , |
|||
bool | blended = true | |||
) | throw () [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.
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). |
Locks surface if needed, cipping is performed, disc will be antialiased if antialias mode is set.
Definition at line 1215 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawDiscWithEdge().
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 | |||
) | throw () [virtual] |
Draws an ellipse whose center is (xCenter,yCenter), with specified horizontal and vertical radii, with specified RGBA color, on this surface.
filled | tells whether the ellipse should be filled. |
Clipping is performed.
An unfilled ellipse will be antialiased if antialias mode is set.
Definition at line 1227 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawEllipse().
bool Surface::drawEllipse | ( | Coordinate | xCenter, | |
Coordinate | yCenter, | |||
Length | horizontalRadius, | |||
Length | verticalRadius, | |||
Pixels::ColorDefinition | colorDef, | |||
bool | filled = true | |||
) | throw () [virtual] |
Draws an ellipse whose center is (xCenter,yCenter), with specified horizontal and vertical radii, with specified RGBA color, on this surface.
filled | tells whether the ellipse should be filled. |
Clipping is performed.
An unfilled ellipse will be antialiased if antialias mode is set.
Definition at line 1239 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawEllipse().
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 | |||
) | throw () [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.
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. |
Clipping is performed.
Definition at line 1251 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawPie().
bool Surface::drawPie | ( | Coordinate | xCenter, | |
Coordinate | yCenter, | |||
Length | radius, | |||
Ceylan::Maths::AngleInDegrees | angleStart, | |||
Ceylan::Maths::AngleInDegrees | angleStop, | |||
Pixels::ColorDefinition | colorDef | |||
) | throw () [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.
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. |
Clipping is performed.
Definition at line 1264 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawPie().
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 | |||
) | throw () [virtual] |
Draws a triangle defined by specified three points, with specified RGBA color, on this surface.
filled | tells whether the triangle should be filled (disc). |
Clipping is performed.
Will be antialiased if antialias mode is set.
Definition at line 1277 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawTriangle().
bool Surface::drawTriangle | ( | Coordinate | x1, | |
Coordinate | y1, | |||
Coordinate | x2, | |||
Coordinate | y2, | |||
Coordinate | x3, | |||
Coordinate | y3, | |||
Pixels::ColorDefinition | colorDef, | |||
bool | filled = true | |||
) | throw () [virtual] |
Draws a triangle defined by specified three points, with specified RGBA color, on this surface.
filled | tells whether the triangle should be filled (disc). |
Clipping is performed.
Will be antialiased if antialias mode is set.
Definition at line 1291 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::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 | |||
) | throw () [virtual] |
Draws a triangle defined by specified three points, with specified RGBA color, on this surface.
filled | tells whether the triangle should be filled (disc). |
Clipping is performed.
Will be antialiased if antialias mode is set.
Definition at line 1303 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawTriangle().
bool Surface::drawTriangle | ( | const TwoDimensional::Point2D & | p1, | |
const TwoDimensional::Point2D & | p2, | |||
const TwoDimensional::Point2D & | p3, | |||
Pixels::ColorDefinition | colorDef, | |||
bool | filled = true | |||
) | throw () [virtual] |
Draws a triangle defined by specified three points, with specified RGBA color, on this surface.
filled | tells whether the triangle should be filled (disc). |
Clipping is performed.
Will be antialiased if antialias mode is set.
Definition at line 1317 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::drawTriangle().
virtual bool OSDL::Video::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 | |||
) | throw () [virtual] |
Draws a polygon defined by specified list of points, with specified RGBA color, on specified surface.
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. |
Clipping is performed.
Will be antialiased if antialias mode is set.
virtual bool OSDL::Video::Surface::drawPolygon | ( | const std::list< TwoDimensional::Point2D * > | summits, | |
Coordinate | x, | |||
Coordinate | y, | |||
Pixels::ColorDefinition | colorDef, | |||
bool | filled = true | |||
) | throw () [virtual] |
Draws a polygon defined by specified list of points, with specified RGBA color, on specified surface.
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. |
Clipping is performed.
Will be antialiased if antialias mode is set.
bool Surface::drawGrid | ( | Length | columnStride = 20 , |
|
Length | rowStride = 20 , |
|||
Pixels::ColorDefinition | lineColor = Pixels::White , |
|||
bool | fillBackground = false , |
|||
Pixels::ColorDefinition | backgroundColor = Pixels::Black | |||
) | throw () [virtual] |
Draws a grid, with specified space between columns and rows and specified colors.
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. |
Locks surface if needed.
Definition at line 1353 of file OSDLSurface.cc.
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 | |||
) | throw () [virtual] |
Prints specified string on this surface, with specified color, taking as upper left corner specified coordinates.
Basic font will be used.
Definition at line 1398 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Text::printBasic().
bool Surface::printText | ( | const std::string & | text, | |
Coordinate | x, | |||
Coordinate | y, | |||
ColorDefinition | colorDef = Pixels::White | |||
) | throw () [virtual] |
Prints specified string on this surface, with specified color, taking as upper left corner specified coordinates.
Basic font will be used.
Definition at line 1409 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Text::printBasic().
bool Surface::blitTo | ( | Surface & | targetSurface | ) | const throw ( VideoException ) [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.
targetSurface | the destination surface this surface will be blitted to, starting at [0;0] in the destination surface : both upper left corners will correspond. |
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. |
Definition at line 1418 of file OSDLSurface.cc.
Referenced by OSDL::Video::TwoDimensional::Text::TrueTypeFont::blitLatin1Glyph(), OSDL::Video::TwoDimensional::Text::Font::blitLatin1Text(), OSDL::Video::TwoDimensional::drawDiscWithEdge(), OSDL::Video::TwoDimensional::Widget::redraw(), OSDL::Video::TwoDimensional::BackBufferedWidget::redraw(), OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer(), OSDL::Video::TwoDimensional::BackBufferedWidget::redrawInternal(), and resize().
bool Surface::blitTo | ( | Surface & | targetSurface, | |
Coordinate | x, | |||
Coordinate | y | |||
) | const throw ( VideoException ) [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.
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 |
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. |
Definition at line 1426 of file OSDLSurface.cc.
References OSDL::Utils::getBackendLastError(), and OSDL::Video::Pixels::toString().
bool Surface::blitTo | ( | Surface & | targetSurface, | |
const TwoDimensional::Point2D & | location | |||
) | const throw ( VideoException ) [virtual] |
Blits this surface onto specified surface.
targetSurface | the destination surface this surface will be blitted to. | |
location | the point of the destination surface where this surface will be blitted. |
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. |
Definition at line 1489 of file OSDLSurface.cc.
bool Surface::blitTo | ( | Surface & | targetSurface, | |
const TwoDimensional::UprightRectangle & | sourceRectangle, | |||
const TwoDimensional::Point2D & | destinationLocation | |||
) | const throw ( VideoException ) [virtual] |
Blits this surface onto specified surface.
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. |
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. |
Definition at line 1499 of file OSDLSurface.cc.
References OSDL::Utils::getBackendLastError().
Surface & Surface::zoom | ( | Ceylan::Maths::Real | abscissaZoomFactor, | |
Ceylan::Maths::Real | ordinateZoomFactor, | |||
bool | antialiasing = true | |||
) | const throw ( VideoException ) [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.
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 1561 of file OSDLSurface.cc.
Surface & Surface::rotoZoom | ( | Ceylan::Maths::AngleInDegrees | angle, | |
Ceylan::Maths::Real | zoomFactor, | |||
bool | antialiasing = true | |||
) | const throw ( VideoException ) [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.
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 1585 of file OSDLSurface.cc.
Surface & Surface::rotoZoom | ( | Ceylan::Maths::AngleInDegrees | angle, | |
Ceylan::Maths::Real | abscissaZoomFactor, | |||
Ceylan::Maths::Real | ordinateZoomFactor, | |||
bool | antialiasing = true | |||
) | const throw ( VideoException ) [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.
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 1595 of file OSDLSurface.cc.
UprightRectangle & Surface::getClippingArea | ( | ) | const throw () [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.
Definition at line 1621 of file OSDLSurface.cc.
References _surface, and OSDL::Video::TwoDimensional::UprightRectangle::UprightRectangle().
virtual void OSDL::Video::Surface::setClippingArea | ( | UprightRectangle & | newClippingArea | ) | throw () [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::loadImage | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads an image, whose format will be auto-detected, from specified file, into this surface.
This is a Surface factory.
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. |
Referenced by LoadImage().
virtual void OSDL::Video::Surface::loadJPG | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads a JPEG image from specified file into this surface.
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. |
virtual void OSDL::Video::Surface::loadPNG | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads a PNG image from specified file into this surface.
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. |
virtual void OSDL::Video::Surface::loadBMP | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads a BMP image from specified file into this surface.
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. |
virtual void OSDL::Video::Surface::loadGIF | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads a GIF image from specified file into this surface.
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. |
virtual void OSDL::Video::Surface::loadLBM | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads a LBM image from specified file into this surface.
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. |
virtual void OSDL::Video::Surface::loadPCX | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads a PCX image from specified file into this surface.
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. |
virtual void OSDL::Video::Surface::loadPNM | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads a PNM image from specified file into this surface.
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. |
virtual void OSDL::Video::Surface::loadTGA | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads a TGA image from specified file into this surface.
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. |
virtual void OSDL::Video::Surface::loadXPM | ( | const std::string & | filename, | |
bool | blitOnly = false , |
|||
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Loads a XPM image from specified file into this surface.
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. |
void Surface::savePNG | ( | const std::string & | filename, | |
bool | overwrite = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Saves the current content of this surface into a PNG file.
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. |
Definition at line 1757 of file OSDLSurface.cc.
References OSDL::Video::TwoDimensional::Image::SavePNG().
void Surface::saveBMP | ( | const std::string & | filename, | |
bool | overwrite = true | |||
) | throw ( TwoDimensional::ImageException ) [virtual] |
Saves the current content of this surface into a BMP file.
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. |
Definition at line 1766 of file OSDLSurface.cc.
References OSDL::Utils::getBackendLastError().
void Surface::update | ( | ) | throw ( VideoException ) [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.
on hardware that does not support double-buffering, this is equivalent to calling the updateRectangle method with all arguments to zero.
VideoException | if the operation failed, including if this surface is not a screen surface. |
Definition at line 1782 of file OSDLSurface.cc.
References _displayType, _surface, BackBuffer, ClassicalScreenSurface, OSDL::Utils::getBackendLastError(), OpenGLScreenSurface, and redraw().
virtual void OSDL::Video::Surface::updateRectangles | ( | const std::list< UprightRectangle * > & | listRects | ) | throw ( VideoException ) [virtual] |
Updates the part of this surface corresponding to the specified list of rectangles.
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.
VideoException | if the operation failed, including if this surface is not a screen surface. |
virtual void OSDL::Video::Surface::updateRectangle | ( | const UprightRectangle & | rect | ) | throw ( VideoException ) [virtual] |
Updates the part of this surface corresponding to specified rectangle.
The surface must not be locked when this method is called.
VideoException | if the operation failed, including if this surface is not a screen surface. |
void Surface::updateRectangle | ( | Coordinate | x, | |
Coordinate | y, | |||
Length | width, | |||
Length | height | |||
) | throw ( VideoException ) [virtual] |
Updates the part of this surface corresponding to specified rectangle.
If all arguments are equal to zero, the entire surface will be updated.
The surface must not be locked when this method is called.
VideoException | if the operation failed, including if this surface is not a screen surface. |
Definition at line 1901 of file OSDLSurface.cc.
void Surface::setRedrawState | ( | bool | needsToBeRedrawn | ) | throw () [virtual] |
Sets the need for redraw state.
Reimplemented in OSDL::Video::TwoDimensional::Widget.
Definition at line 1924 of file OSDLSurface.cc.
Referenced by redraw(), and OSDL::Video::TwoDimensional::Widget::setRedrawState().
bool Surface::getRedrawState | ( | ) | const throw () [virtual] |
Returns the current need for redraw state.
Definition at line 1932 of file OSDLSurface.cc.
References _needsRedraw.
Referenced by OSDL::Video::TwoDimensional::Widget::redraw(), redraw(), and OSDL::Video::TwoDimensional::BackBufferedWidget::redraw().
void Surface::redraw | ( | ) | throw () [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.
Reimplemented in OSDL::Video::TwoDimensional::BackBufferedWidget, and OSDL::Video::TwoDimensional::Widget.
Definition at line 1940 of file OSDLSurface.cc.
References getRedrawState(), redrawInternal(), and setRedrawState().
Referenced by OSDL::Video::TwoDimensional::Widget::redraw(), OSDL::Video::VideoModule::redraw(), OSDL::Video::TwoDimensional::BackBufferedWidget::redraw(), and update().
void Surface::redrawInternal | ( | ) | throw () [virtual] |
Basic do-nothing redraw method for internal rendering.
Reimplemented in OSDL::Video::TwoDimensional::BackBufferedWidget, and OSDL::Video::TwoDimensional::Widget.
Definition at line 1981 of file OSDLSurface.cc.
Referenced by redraw().
bool Surface::isInternalSurfaceAvailable | ( | ) | const throw () [virtual] |
Tells whether the internal SDL surface is void or not.
May be inline.
Definition at line 1997 of file OSDLSurface.cc.
References _surface.
void Surface::addWidget | ( | TwoDimensional::Widget & | widget | ) | throw ( VideoException ) [virtual] |
Registers specified widget to this surface, and put it at top level.
Definition at line 2005 of file OSDLSurface.cc.
Surface & Surface::getWidgetRenderTarget | ( | ) | throw () |
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 2033 of file OSDLSurface.cc.
Referenced by OSDL::Video::TwoDimensional::Widget::redraw().
void Surface::putWidgetToFront | ( | TwoDimensional::Widget & | widget | ) | throw ( VideoException ) [virtual] |
Changes stacking inside this container surface so that specified widget is put to front.
VideoException | if the widget is not a registered one. |
Definition at line 2046 of file OSDLSurface.cc.
void Surface::putWidgetToBack | ( | TwoDimensional::Widget & | widget | ) | throw ( VideoException ) [virtual] |
Changes stacking inside this container surface so that specified widget is put to back.
VideoException | if the widget is not a registered one. |
Definition at line 2063 of file OSDLSurface.cc.
void Surface::centerMousePosition | ( | ) | throw () [virtual] |
Centers in the middle of the screen the position of the mouse cursor, by generating a mouse motion event.
Definition at line 2081 of file OSDLSurface.cc.
References getHeight(), getWidth(), and setMousePosition().
void Surface::setMousePosition | ( | Coordinate | newX = 0 , |
|
Coordinate | newY = 0 | |||
) | throw () [virtual] |
Sets the position of the mouse cursor, by generating a mouse motion event.
Definition at line 2089 of file OSDLSurface.cc.
Referenced by centerMousePosition().
bool Surface::mustBeLocked | ( | ) | const throw () [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.
Definition at line 2107 of file OSDLSurface.cc.
References _surface.
Ceylan::System::Size Surface::getSizeInMemory | ( | ) | const throw () [virtual] |
Returns the approximate size in memory, in bytes, currently taken by this object.
Definition at line 2142 of file OSDLSurface.cc.
References _surface.
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 | |||
) | throw () [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.
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.
const string Surface::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const throw () [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Reimplemented from OSDL::Video::TwoDimensional::UprightRectangle.
Reimplemented in OSDL::Video::TwoDimensional::BackBufferedWidget, OSDL::Video::TwoDimensional::TextWidget, and OSDL::Video::TwoDimensional::Widget.
Definition at line 2395 of file OSDLSurface.cc.
References OSDL::Video::Pixels::toString().
Referenced by convertFromColorKeyToAlphaChannel(), and OSDL::Video::TwoDimensional::Widget::toString().
Surface & Surface::LoadImage | ( | const std::string & | filename, | |
bool | convertToDisplayFormat = true , |
|||
bool | convertWithAlpha = true | |||
) | throw ( TwoDimensional::ImageException ) [static] |
Surface factory : creates a new Surface instance from specified image file.
Image format, if supported, is auto-detected.
Definition at line 2463 of file OSDLSurface.cc.
References loadImage().
Referenced by OSDL::Video::OpenGL::GLTexture::GLTexture().
static std::string OSDL::Video::Surface::InterpretFlags | ( | Ceylan::Flags | flags | ) | throw () [static] |
Outputs a textual description of the given surface flags.
These flags are interpreted as surface flags only.
flags | the surface video settings to interpret. |
void Surface::preUnlock | ( | ) | throw () [protected, virtual] |
Effective unlocking of the surface.
Nevertheless, only lock/unlock pair should be used by user programs.
Definition at line 2116 of file OSDLSurface.cc.
References _surface.
void Surface::postLock | ( | ) | throw () [protected, virtual] |
Effective locking of the surface.
Nevertheless, only lock/unlock pair should be used by user programs.
Definition at line 2129 of file OSDLSurface.cc.
References _surface.
Offset Surface::getOffset | ( | ) | const throw () [inline, protected] |
void Surface::setOffset | ( | Offset | offset | ) | throw () [inline, protected] |
void Surface::flush | ( | ) | throw () [protected, virtual] |
Releases internal SDL surface.
Definition at line 2641 of file OSDLSurface.cc.
References _displayType, _surface, BackBuffer, and inconsistencyDetected().
Referenced by ~Surface().
virtual void OSDL::Video::Surface::inconsistencyDetected | ( | const std::string & | message | ) | const throw () [protected, virtual] |
Triggered when an abnormal inconsistency is detected between OSDL's surface state and its back-end counterpart.
Referenced by flush().
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.
Point2D UprightRectangle::getUpperLeftCorner | ( | ) | const throw () [virtual, inherited] |
Returns this UprightRectangle's upper left corner.
Definition at line 98 of file OSDLUprightRectangle.cc.
References OSDL::Video::TwoDimensional::UprightRectangle::_x, and OSDL::Video::TwoDimensional::UprightRectangle::_y.
void UprightRectangle::setUpperLeftCorner | ( | Point2D & | newUpperLeftCorner | ) | throw () [virtual, inherited] |
Sets this UprightRectangle's upper left corner, width and height do not change.
Definition at line 106 of file OSDLUprightRectangle.cc.
Coordinate UprightRectangle::getUpperLeftAbscissa | ( | ) | const throw () [virtual, inherited] |
Returns directly the abscissa of upper left corner.
Definition at line 117 of file OSDLUprightRectangle.cc.
References OSDL::Video::TwoDimensional::UprightRectangle::_x.
Referenced by OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().
void UprightRectangle::setUpperLeftAbscissa | ( | Coordinate | newAbscissa | ) | throw () [virtual, inherited] |
Sets directly the abscissa of the upper left corner of this rectangle.
Definition at line 125 of file OSDLUprightRectangle.cc.
Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
Coordinate UprightRectangle::getUpperLeftOrdinate | ( | ) | const throw () [virtual, inherited] |
Returns directly the ordinate of upper left corner.
Definition at line 134 of file OSDLUprightRectangle.cc.
References OSDL::Video::TwoDimensional::UprightRectangle::_y.
Referenced by OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().
void UprightRectangle::setUpperLeftOrdinate | ( | Coordinate | newOrdinate | ) | throw () [virtual, inherited] |
Sets directly the ordinate of the upper left corner of this rectangle.
Definition at line 142 of file OSDLUprightRectangle.cc.
Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
Point2D UprightRectangle::getLowerRightCorner | ( | ) | const throw () [virtual, inherited] |
Returns this UprightRectangle's lower right corner.
Definition at line 155 of file OSDLUprightRectangle.cc.
References OSDL::Video::TwoDimensional::UprightRectangle::_x, OSDL::Video::TwoDimensional::UprightRectangle::_y, OSDL::Video::TwoDimensional::UprightRectangle::getHeight(), and OSDL::Video::TwoDimensional::UprightRectangle::getWidth().
void UprightRectangle::setLowerRightCorner | ( | Point2D & | newLowerRightCorner | ) | throw ( VideoException) [virtual, inherited] |
Sets directly the lower right corner of this rectangle.
VideoException | if width or height would become negative. |
Definition at line 164 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
Coordinate UprightRectangle::getLowerRightAbscissa | ( | ) | const throw () [virtual, inherited] |
Returns directly the abscissa of lower right corner.
Definition at line 181 of file OSDLUprightRectangle.cc.
References OSDL::Video::TwoDimensional::UprightRectangle::_x, and OSDL::Video::TwoDimensional::UprightRectangle::getWidth().
void UprightRectangle::setLowerRightAbscissa | ( | Coordinate | newAbscissa | ) | throw ( VideoException ) [virtual, inherited] |
Sets directly the abscissa of the lower right corner of this rectangle.
VideoException | if width or height would become negative. |
Definition at line 189 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
Coordinate UprightRectangle::getLowerRightOrdinate | ( | ) | const throw () [virtual, inherited] |
Returns directly the ordinate of lower right corner.
Definition at line 205 of file OSDLUprightRectangle.cc.
References OSDL::Video::TwoDimensional::UprightRectangle::_y, and OSDL::Video::TwoDimensional::UprightRectangle::getHeight().
void UprightRectangle::setLowerRightOrdinate | ( | Coordinate | newOrdinate | ) | throw ( VideoException ) [virtual, inherited] |
Sets directly the ordinate of the lower right corner of this rectangle.
VideoException | if width or height would become negative. |
Definition at line 213 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
bool UprightRectangle::draw | ( | Surface & | target, | |
Pixels::ColorElement | red, | |||
Pixels::ColorElement | blue, | |||
Pixels::ColorElement | green, | |||
Pixels::ColorElement | alpha = Pixels::AlphaOpaque , |
|||
bool | filled = true | |||
) | const throw () [virtual, inherited] |
Draws this UprightRectangle to specified surface with specified RGBA color.
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. |
Definition at line 265 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::convertRGBAToColorDefinition(), and OSDL::Video::TwoDimensional::Line::draw().
Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().
bool UprightRectangle::draw | ( | Surface & | target, | |
Pixels::ColorDefinition | colorDef = Pixels::White , |
|||
bool | filled = true | |||
) | const throw () [virtual, inherited] |
Draws this UprightRectangle to specified surface with specified RGBA color.
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. |
Definition at line 276 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::convertColorDefinitionToRawPixelColor(), and OSDL::Video::Pixels::toString().
bool UprightRectangle::drawWithRoundedCorners | ( | Surface & | target, | |
Length | edgeWidth = 3 , |
|||
Pixels::ColorDefinition | edgeColorDef = Pixels::White , |
|||
Pixels::ColorDefinition | backgroundColorDef = Pixels::Transparent | |||
) | const throw () [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.
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. |
Definition at line 323 of file OSDLUprightRectangle.cc.
References AlphaBlendingBlit, OSDL::Video::Pixels::AlphaOpaque, ColorkeyBlit, OSDL::Video::TwoDimensional::UprightRectangle::draw(), OSDL::Video::Pixels::getCurrentColorMasks(), RLEColorkeyBlit, OSDL::Video::Pixels::selectColorDifferentFrom(), OSDL::Video::TwoDimensional::UprightRectangle::setUpperLeftAbscissa(), OSDL::Video::TwoDimensional::UprightRectangle::setUpperLeftOrdinate(), OSDL::Video::TwoDimensional::Point2D::setX(), OSDL::Video::TwoDimensional::Point2D::setY(), Software, and OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().
Length UprightRectangle::computeRadiusForRoundRectangle | ( | Length | edgeWidth | ) | const throw ( VideoException ) [virtual, inherited] |
Computes the preferred radius of round corners for this rectangle, with the specified edge width.
edgeWidth | the edge width to take into account for the radius. |
VideoException | if no radius can fullfill the set of constraints due to this rectangle and the edge width. |
Definition at line 694 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
SDL_Rect * UprightRectangle::toSDLRect | ( | ) | const throw ( VideoException ) [virtual, inherited] |
const Ceylan::Flags Surface::Software [static] |
Indicates that a surface is to be stored in system memory.
Definition at line 212 of file OSDLSurface.h.
Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().
const Ceylan::Flags Surface::Hardware [static] |
Indicates that a surface is to be stored in video memory.
Definition at line 216 of file OSDLSurface.h.
Referenced by OSDL::Video::TwoDimensional::Text::FixedFont::basicRenderLatin1Glyph(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), OSDL::Video::TwoDimensional::Text::Font::renderLatin1MultiLineText(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), and OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text().
const Ceylan::Flags Surface::AsynchronousBlit [static] |
Indicates that a surface should use asynchronous blits if possible.
Definition at line 224 of file OSDLSurface.h.
const Ceylan::Flags Surface::ExclusivePalette [static] |
Indicates that a surface should have an exclusive palette.
Definition at line 228 of file OSDLSurface.h.
const Ceylan::Flags Surface::HardwareAcceleratedBlit [static] |
Indicates that a surface is to use hardware-accelerated blits.
Definition at line 236 of file OSDLSurface.h.
const Ceylan::Flags Surface::ColorkeyBlit [static] |
Indicates that a surface is to use colorkey blits.
Definition at line 240 of file OSDLSurface.h.
Referenced by OSDL::Video::TwoDimensional::Text::FixedFont::basicRenderLatin1Glyph(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), convertFromColorKeyToAlphaChannel(), OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Text::Font::renderLatin1MultiLineText(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), and OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text().
const Ceylan::Flags Surface::RLEColorkeyBlit [static] |
Indicates that a surface is to use RLE-accelerated colorkey blits.
Definition at line 248 of file OSDLSurface.h.
Referenced by OSDL::Video::TwoDimensional::Text::FixedFont::basicRenderLatin1Glyph(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::basicRenderUnicodeGlyph(), OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderLatin1Text(), OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUnicodeText(), and OSDL::Video::TwoDimensional::Text::TrueTypeFont::renderUTF8Text().
const Ceylan::Flags Surface::AlphaBlendingBlit [static] |
Indicates that a surface is to use alpha blending blits.
Definition at line 252 of file OSDLSurface.h.
Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners(), and OSDL::Video::OpenGL::GLTexture::upload().
const Ceylan::Flags Surface::Preallocated [static] |
Indicates that a surface is to use preallocated memory.
Definition at line 255 of file OSDLSurface.h.
const Ceylan::Flags Surface::RLEColorkeyBlitAvailable [static] |
Indicates that RLE colorkey blit is actually accelerated (read-only).
Definition at line 266 of file OSDLSurface.h.
Referenced by OSDL::Video::OpenGL::GLTexture::upload().
const Ceylan::Flags Surface::AnyPixelFormat [static] |
Indicates that a display surface may use any pixel format.
Definition at line 281 of file OSDLSurface.h.
const Ceylan::Flags Surface::DoubleBuffered [static] |
Indicates that a display surface is to be double buffered.
Definition at line 289 of file OSDLSurface.h.
const Ceylan::Flags Surface::FullScreen [static] |
Indicates that a display surface is to be full screen, not windowed.
Definition at line 297 of file OSDLSurface.h.
const Ceylan::Flags Surface::OpenGL [static] |
Indicates that a display surface should have an OpenGL context.
Definition at line 305 of file OSDLSurface.h.
const Ceylan::Flags Surface::Resizable [static] |
const Length Surface::graphAbscissaOffset [static] |
const Length Surface::graphOrdinateOffset [static] |
const Length Surface::captionAbscissaOffset [static] |
const Length Surface::captionOrdinateOffset [static] |
SDL_Surface* OSDL::Video::Surface::_surface [protected] |
This internal structure also contains private fields not used here.
Definition at line 3132 of file OSDLSurface.h.
Referenced by clone(), flipHorizontal(), flipVertical(), flush(), getBitsPerPixel(), getBytesPerPixel(), getClippingArea(), getFlags(), getHeight(), getOffset(), getPitch(), getPixelFormat(), getPixels(), getSDLSurface(), getSizeInMemory(), getWidth(), isInternalSurfaceAvailable(), mustBeLocked(), postLock(), preUnlock(), and update().
DisplayType OSDL::Video::Surface::_displayType [protected] |
Tells what is the display type of this surface.
The display type has to be recorded since :
Definition at line 3146 of file OSDLSurface.h.
Referenced by flush(), getDisplayType(), update(), and ~Surface().
bool OSDL::Video::Surface::_mustBeLocked [protected] |
Tells whether this surface must be locked before modifying it.
Definition at line 3154 of file OSDLSurface.h.
bool OSDL::Video::Surface::_needsRedraw [private] |
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 3169 of file OSDLSurface.h.
Referenced by getRedrawState().
Coordinate OSDL::Video::TwoDimensional::UprightRectangle::_x [protected, inherited] |
Upper left corner's abscissa (horizontal coordinate).
Definition at line 404 of file OSDLUprightRectangle.h.
Referenced by OSDL::Video::TwoDimensional::UprightRectangle::getLowerRightAbscissa(), OSDL::Video::TwoDimensional::UprightRectangle::getLowerRightCorner(), OSDL::Video::TwoDimensional::UprightRectangle::getUpperLeftAbscissa(), OSDL::Video::TwoDimensional::UprightRectangle::getUpperLeftCorner(), and OSDL::Video::TwoDimensional::UprightRectangle::toSDLRect().
Coordinate OSDL::Video::TwoDimensional::UprightRectangle::_y [protected, inherited] |
Upper left corner's ordinate (vertical coordinate).
Definition at line 408 of file OSDLUprightRectangle.h.
Referenced by OSDL::Video::TwoDimensional::UprightRectangle::getLowerRightCorner(), OSDL::Video::TwoDimensional::UprightRectangle::getLowerRightOrdinate(), OSDL::Video::TwoDimensional::UprightRectangle::getUpperLeftCorner(), OSDL::Video::TwoDimensional::UprightRectangle::getUpperLeftOrdinate(), and OSDL::Video::TwoDimensional::UprightRectangle::toSDLRect().