Skip to content

Class endstone::MapCanvas

ClassList > endstone > MapCanvas

Represents a canvas for drawing to a map. More...

  • #include <endstone/map/map_canvas.h>

Public Functions

Type Name
virtual void drawImage (int x, int y, const Image & image) = 0
Draw an image to the map. The image will be clipped if necessary.
virtual std::uint32_t getBasePixel (int x, int y) const = 0
Get a pixel from the layers below this canvas.
virtual Result< Color > getBasePixelColor (int x, int y) const = 0
Get a pixel from the layers below this canvas.
virtual std::vector< MapCursor > getCursors () const = 0
Get the cursors associated with this canvas.
virtual MapView & getMapView () const = 0
Get the map this canvas is attached to.
virtual std::uint32_t getPixel (int x, int y) const = 0
Get a pixel from the canvas.
virtual Result< Color > getPixelColor (int x, int y) const = 0
Get a pixel from the canvas.
virtual void setCursors (const std::vector< MapCursor > & cursors) = 0
Set the cursors associated with this canvas.
virtual void setPixel (int x, int y, std::uint32_t color) = 0
Draw a pixel to the canvas.
virtual void setPixelColor (int x, int y, Color color) = 0
Draw a pixel to the canvas.
virtual ~MapCanvas () = default

Detailed Description

Note:

Each canvas is associated with a specific MapRenderer and represents that renderer's layer on the map.

Public Functions Documentation

function drawImage

Draw an image to the map. The image will be clipped if necessary.

virtual void endstone::MapCanvas::drawImage (
    int x,
    int y,
    const Image & image
) = 0

Parameters:

  • x The x coordinate of the image.
  • y The y coordinate of the image.
  • image The Image to draw.

function getBasePixel

Get a pixel from the layers below this canvas.

virtual std::uint32_t endstone::MapCanvas::getBasePixel (
    int x,
    int y
) const = 0

Parameters:

  • x The x coordinate, from 0 to 127.
  • y The y coordinate, from 0 to 127.

Returns:

The color.


function getBasePixelColor

Get a pixel from the layers below this canvas.

virtual Result< Color > endstone::MapCanvas::getBasePixelColor (
    int x,
    int y
) const = 0

Parameters:

  • x The x coordinate, from 0 to 127.
  • y The y coordinate, from 0 to 127.

Returns:

The color


function getCursors

Get the cursors associated with this canvas.

virtual std::vector< MapCursor > endstone::MapCanvas::getCursors () const = 0

Returns:

The MapCursorCollection associated with this canvas.


function getMapView

Get the map this canvas is attached to.

virtual MapView & endstone::MapCanvas::getMapView () const = 0

Returns:

The MapView this canvas is attached to.


function getPixel

Get a pixel from the canvas.

virtual std::uint32_t endstone::MapCanvas::getPixel (
    int x,
    int y
) const = 0

Parameters:

  • x The x coordinate, from 0 to 127.
  • y The y coordinate, from 0 to 127.

Returns:

The color.


function getPixelColor

Get a pixel from the canvas.

virtual Result< Color > endstone::MapCanvas::getPixelColor (
    int x,
    int y
) const = 0

Parameters:

  • x The x coordinate, from 0 to 127.
  • y The y coordinate, from 0 to 127.

Returns:

The color


function setCursors

Set the cursors associated with this canvas.

virtual void endstone::MapCanvas::setCursors (
    const std::vector< MapCursor > & cursors
) = 0

Parameters:

  • cursors The MapCursorCollection to associate with this canvas.

function setPixel

Draw a pixel to the canvas.

virtual void endstone::MapCanvas::setPixel (
    int x,
    int y,
    std::uint32_t color
) = 0

Parameters:

  • x The x coordinate, from 0 to 127.
  • y The y coordinate, from 0 to 127.
  • color The color.

function setPixelColor

Draw a pixel to the canvas.

virtual void endstone::MapCanvas::setPixelColor (
    int x,
    int y,
    Color color
) = 0

Parameters:

  • x The x coordinate, from 0 to 127.
  • y The y coordinate, from 0 to 127.
  • color The color

function ~MapCanvas

virtual endstone::MapCanvas::~MapCanvas () = default


The documentation for this class was generated from the following file include/endstone/map/map_canvas.h