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 40 of file imagegraphics.h.

Constructor & Destructor Documentation

◆ ImegeGraphics()

ImegeGraphics::ImegeGraphics ( )

Definition at line 30 of file imagegraphics.cpp.

30  :
31  Graphics(),
32  mTarget(nullptr)
33 {
35  mName = "Image";
36 }
RenderType mOpenGL
Definition: graphics.h:545
std::string mName
Definition: graphics.h:549
@ RENDER_SOFTWARE
Definition: rendertype.h:27

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

◆ ~ImegeGraphics()

ImegeGraphics::~ImegeGraphics ( )

Definition at line 38 of file imagegraphics.cpp.

39 {
40 }

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 55 of file imagegraphics.h.

56  { }

◆ calcPattern() [1/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 100 of file imagegraphics.h.

106  { }

◆ calcPattern() [2/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 92 of file imagegraphics.h.

98  { }

◆ calcTileCollection()

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

Implements Graphics.

Definition at line 120 of file imagegraphics.h.

125  { }

◆ calcTileSDL()

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

Reimplemented from Graphics.

Definition at line 115 of file imagegraphics.h.

118  { }

◆ calcTileVertexes()

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

Implements Graphics.

Definition at line 108 of file imagegraphics.h.

113  { }

◆ 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 146 of file imagegraphics.h.

151  { }

◆ completeCache()

void ImegeGraphics::completeCache ( )
virtual

Implements Graphics.

Definition at line 61 of file imagegraphics.cpp.

62 {
63 }

◆ copyImage()

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

Implements Graphics.

Definition at line 48 of file imagegraphics.cpp.

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

◆ 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 42 of file imagegraphics.cpp.

44 {
45  // for now not implemented
46 }

◆ drawImageCached()

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

Implements Graphics.

Definition at line 55 of file imagegraphics.cpp.

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

References drawImage(), x, and y.

◆ 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 199 of file imagegraphics.h.

202  { }

◆ 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 162 of file imagegraphics.h.

165  { }

◆ 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 138 of file imagegraphics.h.

144  { }

◆ 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 75 of file imagegraphics.h.

80  { }

◆ 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 186 of file imagegraphics.h.

191  { }

◆ 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 159 of file imagegraphics.h.

160  { }

◆ 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 156 of file imagegraphics.h.

157  { }

◆ 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 68 of file imagegraphics.h.

73  { }

◆ 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 82 of file imagegraphics.h.

90  { }

◆ drawTileCollection()

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

Implements Graphics.

Definition at line 131 of file imagegraphics.h.

133  { }

◆ drawTileVertexes()

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

Implements Graphics.

Definition at line 127 of file imagegraphics.h.

129  { }

◆ 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 58 of file imagegraphics.h.

59  { }

◆ fillRectangle()

void ImegeGraphics::fillRectangle ( const Rect rect)
inlinevirtual

Implements Graphics.

Definition at line 153 of file imagegraphics.h.

154  { }

◆ getTarget()

Image* ImegeGraphics::getTarget ( ) const
inline

Definition at line 52 of file imagegraphics.h.

53  { return mTarget; }

References 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 65 of file imagegraphics.h.

66  { }

◆ 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 61 of file imagegraphics.h.

63  { }

◆ setTarget()

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

Definition at line 49 of file imagegraphics.h.

50  { mTarget = target; }

References mTarget.

◆ 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 167 of file imagegraphics.h.

175  { 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 135 of file imagegraphics.h.

136  { }

Field Documentation

◆ mTarget

Image* ImegeGraphics::mTarget
protected

Definition at line 205 of file imagegraphics.h.

Referenced by getTarget(), and setTarget().


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