Skip to content

Drawing primitives

Martijn Koopman edited this page Jun 13, 2019 · 3 revisions

Required include for drawing:

#include <spatium/gfx2d/Drawing.h>

Supported primitives:

  • Line
  • Circle
  • Rectangle

Line

Draw a red line in an RGB image from coordinates (20,10) to (80,70).

Image<unsigned char, 3> image(100, 100);
gfx2d::Drawing::drawLine(image, {20, 10}, {80, 70}, {255, 0, 0});

Circle

Draw a white circle in a grayscale image with center (50,50) and radius 20.

Image<unsigned char, 1> image(100, 100);
gfx2d::Drawing::drawCircle(image, {50, 50}, 20, {255});

Clone this wiki locally