ManaPlus
Public Member Functions | Protected Attributes
ImegeGraphics Class Reference

#include <imagegraphics.h>

Inheritance diagram for ImegeGraphics:
Graphics

Public Member Functions

 ImegeGraphics ()
 
 ~ImegeGraphics ()
 
void setTarget (Image *const target)
 
ImagegetTarget () const
 
void beginDraw ()
 
void endDraw ()
 
void pushClipArea (const Rect &rect)
 
void popClipArea ()
 
void drawRescaledImage (const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight)
 
void drawPattern (const Image *const image, const int x, const int y, const int w, const int h)
 
void drawRescaledPattern (const Image *const image, const int x, const int y, const int w, const int h, const int scaledWidth, const int scaledHeight)
 
void calcPattern (ImageVertexes *const vert, const Image *const image, const int x, const int y, const int w, const int h) const
 
void calcPattern (ImageCollection *const vert, const Image *const image, const int x, const int y, const int w, const int h) const
 
void calcTileVertexes (ImageVertexes *const vert, const Image *const image, int x, int y) const
 
void calcTileSDL (ImageVertexes *const vert, int x, int y) const
 
void calcTileCollection (ImageCollection *const vertCol, const Image *const image, int x, int y)
 
void drawTileVertexes (const ImageVertexes *const vert)
 
void drawTileCollection (const ImageCollection *const vertCol)
 
void updateScreen ()
 
void drawNet (const int x1, const int y1, const int x2, const int y2, const int width, const int height)
 
void calcWindow (ImageCollection *const vertCol, const int x, const int y, const int w, const int h, const ImageRect &imgRect)
 
void fillRectangle (const Rect &rect)
 
void drawRectangle (const Rect &rect)
 
void drawPoint (int x, int y)
 
void drawLine (int x1, int y1, int x2, int y2)
 
bool setVideoMode (const int w, const int h, const int scale, const int bpp, const bool fs, const bool hwaccel, const bool resize, const bool noFrame, const bool allowHighDPI)
 
void drawImage (const Image *const image, int dstX, int dstY)
 
void copyImage (const Image *const image, int dstX, int dstY)
 
void drawImageCached (const Image *const image, int x, int y)
 
void drawPatternCached (const Image *const image, const int x, const int y, const int w, const int h)
 
void completeCache ()
 
void drawImageRect (const int x, const int y, const int w, const int h, const ImageRect &imgRect)
 
- Public Member Functions inherited from Graphics
virtual ~Graphics ()
 
void setWindow (SDL_Surface *const window, const int width, const int height)
 
SDL_Surface * getWindow () const
 
void setSync (const bool sync)
 
bool getSync () const
 
bool setFullscreen (const bool fs)
 
virtual bool resizeScreen (const int width, const int height)
 
virtual void restoreContext ()
 
void setWindowSize (const int width, const int height)
 
int getWidth () const
 
int getHeight () const
 
int getMemoryUsage () const
 
ClipRectgetTopClip () const
 
void setRedraw (const bool n)
 
bool getRedraw () const
 
void setSecure (const bool n)
 
bool getSecure () const
 
int getBpp () const
 
bool getFullScreen () const
 
bool getHWAccel () const
 
bool getDoubleBuffer () const
 
RenderType getOpenGL () const
 
void setNoFrame (const bool n)
 
const std::string & getName () const
 
virtual void initArrays (const int vertCount)
 
virtual void setColor (const Color &color)
 
const ColorgetColor () const
 
int getScale () const
 
virtual bool isAllowScale () const
 
void setScale (int scale)
 
virtual void createGLContext (const bool custom)
 
virtual void clearScreen () const
 
virtual void deleteArrays ()
 
virtual void postInit ()
 
virtual void finalize (ImageCollection *const col)
 
virtual void finalize (ImageVertexes *const vert)
 
virtual void testDraw ()
 
virtual void removeArray (const uint32_t sz, uint32_t *const arr)
 
virtual void screenResized ()
 

Protected Attributes

ImagemTarget
 
- Protected Attributes inherited from Graphics
MStack< ClipRectmClipStack
 
SDL_Surface * mWindow
 
int mBpp
 
bool mAlpha
 
bool mFullscreen
 
bool mHWAccel
 
bool mRedraw
 
bool mDoubleBuffer
 
SDL_Rect mRect
 
bool mSecure
 
RenderType mOpenGL
 
bool mEnableResize
 
bool mNoFrame
 
bool mAllowHighDPI
 
std::string mName
 
int mStartFreeMem
 
bool mSync
 
int mScale
 
Color mColor
 

Additional Inherited Members

- Public Types inherited from Graphics
enum  Alignment { LEFT = 0, CENTER, RIGHT }
 
- Static Public Member Functions inherited from Graphics
static void cleanUp ()
 
- Data Fields inherited from Graphics
int mWidth
 
int mHeight
 
int mActualWidth
 
int mActualHeight
 
- Protected Member Functions inherited from Graphics
 Graphics ()
 
void setMainFlags (const int w, const int h, const int scale, const int bpp, const bool fs, const bool hwaccel, const bool resize, const bool noFrame, const bool allowHighDPI)
 
int getOpenGLFlags () const
 
int getSoftwareFlags () const
 
bool setOpenGLMode ()
 
void updateMemoryInfo ()
 
bool videoInfo ()
 
void setOpenGLFlags ()
 
- Static Protected Attributes inherited from Graphics
static void * mGLContext = 0
 

Detailed Description

A central point of control for graphics.

Definition at line 39 of file imagegraphics.h.

Constructor & Destructor Documentation

◆ ImegeGraphics()

ImegeGraphics::ImegeGraphics ( )

Definition at line 29 of file imagegraphics.cpp.

References Graphics::mName, Graphics::mOpenGL, and RENDER_SOFTWARE.

29  :
30  Graphics(),
31  mTarget(nullptr)
32 {
34  mName = "Image";
35 }
std::string mName
Definition: graphics.h:548
RenderType mOpenGL
Definition: graphics.h:544

◆ ~ImegeGraphics()

ImegeGraphics::~ImegeGraphics ( )

Definition at line 37 of file imagegraphics.cpp.

38 {
39 }

Member Function Documentation

◆ beginDraw()

void ImegeGraphics::beginDraw ( )
inlinevirtual

Initializes drawing. Called by the Gui when Gui::draw() is called. It is needed by some implementations of Graphics to perform preparations before drawing. An example of such an implementation is the OpenGLGraphics.

NOTE: You will never need to call this function yourself, unless you use a Graphics object outside of Guichan.

See also
endDraw, Gui::draw

Reimplemented from Graphics.

Definition at line 54 of file imagegraphics.h.

55  { }

◆ calcPattern() [1/2]

void ImegeGraphics::calcPattern ( ImageVertexes *const  vert,
const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h 
) const
inlinevirtual

Implements Graphics.

Definition at line 91 of file imagegraphics.h.

97  { }

◆ calcPattern() [2/2]

void ImegeGraphics::calcPattern ( ImageCollection *const  vert,
const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h 
) const
inlinevirtual

Implements Graphics.

Definition at line 99 of file imagegraphics.h.

105  { }

◆ calcTileCollection()

void ImegeGraphics::calcTileCollection ( ImageCollection *const  vertCol,
const Image *const  image,
int  x,
int  y 
)
inlinevirtual

Implements Graphics.

Definition at line 119 of file imagegraphics.h.

124  { }

◆ calcTileSDL()

void ImegeGraphics::calcTileSDL ( ImageVertexes *const  vert,
int  x,
int  y 
) const
inlinevirtual

Reimplemented from Graphics.

Definition at line 114 of file imagegraphics.h.

117  { }

◆ calcTileVertexes()

void ImegeGraphics::calcTileVertexes ( ImageVertexes *const  vert,
const Image *const  image,
int  x,
int  y 
) const
inlinevirtual

Implements Graphics.

Definition at line 107 of file imagegraphics.h.

112  { }

◆ calcWindow()

void ImegeGraphics::calcWindow ( ImageCollection *const  vertCol,
const int  x,
const int  y,
const int  w,
const int  h,
const ImageRect imgRect 
)
inlinevirtual

Implements Graphics.

Definition at line 145 of file imagegraphics.h.

150  { }

◆ completeCache()

void ImegeGraphics::completeCache ( )
virtual

Implements Graphics.

Definition at line 60 of file imagegraphics.cpp.

Referenced by drawPatternCached().

61 {
62 }

◆ copyImage()

void ImegeGraphics::copyImage ( const Image *const  image,
int  dstX,
int  dstY 
)
virtual

Implements Graphics.

Definition at line 47 of file imagegraphics.cpp.

References mTarget.

Referenced by setVideoMode().

49 {
50  if ((mTarget == nullptr) || (image == nullptr))
51  return;
52 }

◆ drawImage()

void ImegeGraphics::drawImage ( const Image *const  image,
int  dstX,
int  dstY 
)
virtual

Blits an image onto the screen.

Returns
true if the image was blitted properly false otherwise.

Implements Graphics.

Definition at line 41 of file imagegraphics.cpp.

Referenced by drawImageCached(), and setVideoMode().

43 {
44  // for now not implemented
45 }

◆ drawImageCached()

void ImegeGraphics::drawImageCached ( const Image *const  image,
int  x,
int  y 
)
virtual

Implements Graphics.

Definition at line 54 of file imagegraphics.cpp.

References drawImage(), x, and y.

Referenced by setVideoMode().

56 {
57  drawImage(image, x, y);
58 }
void drawImage(const Image *const image, int dstX, int dstY)

◆ drawImageRect()

void ImegeGraphics::drawImageRect ( const int  x,
const int  y,
const int  w,
const int  h,
const ImageRect imgRect 
)
inlinevirtual

Draws a rectangle using images. 4 corner images, 4 side images and 1 image for the inside.

Implements Graphics.

Definition at line 198 of file imagegraphics.h.

201  { }

◆ drawLine()

void ImegeGraphics::drawLine ( int  x1,
int  y1,
int  x2,
int  y2 
)
inlinevirtual

Ddraws a line.

Parameters
x1The first x coordinate.
y1The first y coordinate.
x2The second x coordinate.
y2The second y coordinate.

Implements Graphics.

Definition at line 161 of file imagegraphics.h.

164  { }

◆ drawNet()

void ImegeGraphics::drawNet ( const int  x1,
const int  y1,
const int  x2,
const int  y2,
const int  width,
const int  height 
)
inlinevirtual

Reimplemented from Graphics.

Definition at line 137 of file imagegraphics.h.

143  { }

◆ drawPattern()

void ImegeGraphics::drawPattern ( const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h 
)
inlinevirtual

Implements Graphics.

Definition at line 74 of file imagegraphics.h.

79  { }

◆ drawPatternCached()

void ImegeGraphics::drawPatternCached ( const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h 
)
inlinevirtual

Implements Graphics.

Definition at line 185 of file imagegraphics.h.

References completeCache().

190  { }

◆ drawPoint()

void ImegeGraphics::drawPoint ( int  x,
int  y 
)
inlinevirtual

Draws a single point/pixel.

Parameters
xThe x coordinate.
yThe y coordinate.

Implements Graphics.

Definition at line 158 of file imagegraphics.h.

159  { }

◆ drawRectangle()

void ImegeGraphics::drawRectangle ( const Rect rectangle)
inlinevirtual

Draws a simple, non-filled, rectangle with a one pixel width.

Parameters
rectangleThe rectangle to draw.

Implements Graphics.

Definition at line 155 of file imagegraphics.h.

156  { }

◆ drawRescaledImage()

void ImegeGraphics::drawRescaledImage ( const Image *const  image,
int  dstX,
int  dstY,
const int  desiredWidth,
const int  desiredHeight 
)
inlinevirtual

Draws a resclaled version of the image

Implements Graphics.

Definition at line 67 of file imagegraphics.h.

72  { }

◆ drawRescaledPattern()

void ImegeGraphics::drawRescaledPattern ( const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h,
const int  scaledWidth,
const int  scaledHeight 
)
inlinevirtual

Draw a pattern based on a rescaled version of the given image...

Implements Graphics.

Definition at line 81 of file imagegraphics.h.

89  { }

◆ drawTileCollection()

void ImegeGraphics::drawTileCollection ( const ImageCollection *const  vertCol)
inlinevirtual

Implements Graphics.

Definition at line 130 of file imagegraphics.h.

132  { }

◆ drawTileVertexes()

void ImegeGraphics::drawTileVertexes ( const ImageVertexes *const  vert)
inlinevirtual

Implements Graphics.

Definition at line 126 of file imagegraphics.h.

128  { }

◆ endDraw()

void ImegeGraphics::endDraw ( )
inlinevirtual

Deinitializes drawing. Called by the Gui when a Gui::draw() is done. done. It should reset any state changes made by beginDraw().

NOTE: You will never need to call this function yourself, unless you use a Graphics object outside of Guichan.

See also
beginDraw, Gui::draw

Reimplemented from Graphics.

Definition at line 57 of file imagegraphics.h.

58  { }

◆ fillRectangle()

void ImegeGraphics::fillRectangle ( const Rect rect)
inlinevirtual

Implements Graphics.

Definition at line 152 of file imagegraphics.h.

153  { }

◆ getTarget()

Image* ImegeGraphics::getTarget ( ) const
inline

Definition at line 51 of file imagegraphics.h.

References mTarget.

52  { return mTarget; }

◆ popClipArea()

void ImegeGraphics::popClipArea ( )
inlinevirtual

Removes the top most clip area from the stack.

Exceptions
Exceptionif the stack is empty.

Reimplemented from Graphics.

Definition at line 64 of file imagegraphics.h.

65  { }

◆ pushClipArea()

void ImegeGraphics::pushClipArea ( const Rect area)
inlinevirtual

Pushes a clip area onto the stack. The x and y coordinates in the rectangle is relative to the last pushed clip area. If the new area falls outside the current clip area, it will be clipped as necessary.

If a clip area is outside of the top clip area a clip area with zero width and height will be pushed.

Parameters
areaThe clip area to be pushed onto the stack.

Reimplemented from Graphics.

Definition at line 60 of file imagegraphics.h.

62  { }

◆ setTarget()

void ImegeGraphics::setTarget ( Image *const  target)
inline

Definition at line 48 of file imagegraphics.h.

References mTarget.

49  { mTarget = target; }

◆ setVideoMode()

bool ImegeGraphics::setVideoMode ( const int  w,
const int  h,
const int  scale,
const int  bpp,
const bool  fs,
const bool  hwaccel,
const bool  resize,
const bool  noFrame,
const bool  allowHighDPI 
)
inlinevirtual

Try to create a window with the given settings.

Implements Graphics.

Definition at line 166 of file imagegraphics.h.

References copyImage(), drawImage(), drawImageCached(), restrict2, x, and y.

174  { return false; }

◆ updateScreen()

void ImegeGraphics::updateScreen ( )
inlinevirtual

Updates the screen. This is done by either copying the buffer to the screen or swapping pages.

Implements Graphics.

Definition at line 134 of file imagegraphics.h.

135  { }

Field Documentation

◆ mTarget

Image* ImegeGraphics::mTarget
protected

Definition at line 204 of file imagegraphics.h.

Referenced by copyImage(), getTarget(), and setTarget().


The documentation for this class was generated from the following files: