Maps SDK for C++ 1.0.0
Loading...
Searching...
No Matches
gem::Canvas Class Reference

Drawing surface used by MapView for rendering. More...

Inheritance diagram for gem::Canvas:
Collaboration diagram for gem::Canvas:

Classes

struct  __allow_private_constructor

Public Member Functions

StrongPointer< ScreengetScreen () const noexcept
 Get the parent screen.
Rect getViewport () const noexcept
 Get view viewport in parent screen coordinates.
RectF getViewportF () const noexcept
 Get screen viewport in parent screen ratio.
bool handleKeyboardEvent (EKey key, EKeyAction action) noexcept
 Handles a keyboard event.
Canvasresize (const RectF &screenRatio) noexcept
 Resize the view.
int captureAsImage (const String &filePath, Rect const &rect=Rect(), EImageFileFormat format=IFF_Jpeg) const noexcept
 Make a screen region capture of the current map in JPEG format.
int captureAsImage (DataBuffer &buffer, Rect const &rect=Rect(), EImageFileFormat format=IFF_Jpeg) const noexcept
 Make a screen region capture of the current map in JPEG format.
Image captureAsImage (Rect const &rect=Rect()) const noexcept
 Make a screen region capture of the current map in JPEG format.
bool isView () const noexcept
 Deprecated.
bool isMapView () const noexcept
 Check if canvas is a MapView object.
void detach () noexcept
 Detach canvas from rendering process.

Static Public Member Functions

static StrongPointer< Canvasproduce (StrongPointer< Screen > screen, const RectF &screenRatio, CanvasListener listener) noexcept
 Create a canvas object on the given screen.

Protected Types

using Base = ApiObject<ICanvas, false>
 Base.

Detailed Description

Drawing surface used by MapView for rendering.

Represents the surface where shapes, overlays, and custom graphics can be drawn.Acts as the foundation for rendering in a MapView.

Member Function Documentation

◆ captureAsImage() [1/3]

int gem::Canvas::captureAsImage ( const String & filePath,
Rect const & rect = Rect(),
EImageFileFormat format = IFF_Jpeg ) const
inlinenoexcept

Make a screen region capture of the current map in JPEG format.

No cursor/on-screen info is included.

Parameters
[in]filePathFile path.
[in]rectThe screen rectangle to capture. If ( 0, 0, 0, 0) is provided then the entire map screen is captured.
[in]formatThe image format, default Jpeg
Returns
0 if successful, otherwise an error code

◆ captureAsImage() [2/3]

int gem::Canvas::captureAsImage ( DataBuffer & buffer,
Rect const & rect = Rect(),
EImageFileFormat format = IFF_Jpeg ) const
inlinenoexcept

Make a screen region capture of the current map in JPEG format.

No cursor/on-screen info is included.

Parameters
[in]bufferThe buffer in which the capture is made.
[in]rectThe screen rectangle to capture. If ( 0, 0, 0, 0) is provided then the entire map screen is captured.
[in]formatThe image format, default Jpeg
Returns
0 if successful, otherwise an error code

◆ captureAsImage() [3/3]

Image gem::Canvas::captureAsImage ( Rect const & rect = Rect()) const
inlinenoexcept

Make a screen region capture of the current map in JPEG format.

No cursor/on-screen info is included.

Parameters
[in]rectThe screen rectangle to capture. If ( 0, 0, 0, 0) is provided then the entire map screen is captured.
Returns
The captured image

◆ detach()

void gem::Canvas::detach ( )
inlinenoexcept

Detach canvas from rendering process.

If OpenGL context is not available anymore during canvas destruction, this method should be called when the context is still valid in order to do all needed cleanups

◆ getScreen()

StrongPointer< Screen > gem::Canvas::getScreen ( ) const
inlinenoexcept

Get the parent screen.

Returns
The parent screen

◆ getViewport()

Rect gem::Canvas::getViewport ( ) const
inlinenoexcept

Get view viewport in parent screen coordinates.

origin is always 0, 0

Returns
The view viewport

◆ getViewportF()

RectF gem::Canvas::getViewportF ( ) const
inlinenoexcept

Get screen viewport in parent screen ratio.

origin is always 0, 0

Returns
The view viewport

◆ handleKeyboardEvent()

bool gem::Canvas::handleKeyboardEvent ( EKey key,
EKeyAction action )
inlinenoexcept

Handles a keyboard event.

Parameters
keyType of key that was interacted with.
actionType of action that was performed on key.
Returns
True if the canvas used the key action, in which case the UI should stop forwarding the key to other UI elements

◆ isMapView()

bool gem::Canvas::isMapView ( ) const
inlinenoexcept

Check if canvas is a MapView object.

Returns
True if the canvas is a MapView object

◆ isView()

bool gem::Canvas::isView ( ) const
inlinenoexcept

Deprecated.

Deprecated
Replaced by isMapView.
Returns
True if the canvas is a view

◆ produce()

StrongPointer< Canvas > gem::Canvas::produce ( StrongPointer< Screen > screen,
const RectF & screenRatio,
CanvasListener listener )
inlinestaticnoexcept

Create a canvas object on the given screen.

Parameters
[in]screenThe view's parent screen (reference to it held internally)
[in]screenRatioThe viewport expressed in parent screen ratio
[in]listenerThe canvas listener
Returns
The canvas object

◆ resize()

Canvas & gem::Canvas::resize ( const RectF & screenRatio)
inlinenoexcept

Resize the view.

Parameters
[in]screenRatioThe new viewport expressed in parent screen ratio
Returns
The view object