Drawing functions to annotate debug information. More...
Data Structures | |
| class | Font |
| The Font class provides text drawing. More... | |
Functions | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawLine (View< A > &canvas, ptrdiff_t x1, ptrdiff_t y1, ptrdiff_t x2, ptrdiff_t y2, const Color &color, size_t width=1) |
| Draws a clipped line segment on an image. More... | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawLine (View< A > &canvas, const Point< ptrdiff_t > &p1, const Point< ptrdiff_t > &p2, const Color &color, size_t width=1) |
| Draws a clipped line segment on an image. More... | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawRectangle (View< A > &canvas, ptrdiff_t left, ptrdiff_t top, ptrdiff_t right, ptrdiff_t bottom, const Color &color, size_t width=1) |
| Draws a clipped rectangle frame on an image. More... | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawRectangle (View< A > &canvas, const Rectangle< ptrdiff_t > &rect, const Color &color, size_t width=1) |
| Draws a clipped rectangle frame on an image. More... | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawRectangle (View< A > &canvas, const Point< ptrdiff_t > &topLeft, const Point< ptrdiff_t > &bottomRight, const Color &color, size_t width=1) |
| Draws a clipped rectangle frame on an image. More... | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawFilledRectangle (View< A > &canvas, Rectangle< ptrdiff_t > rect, const Color &color) |
| Draws a filled rectangle on an image. More... | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawPolygon (View< A > &canvas, const std::vector< Simd::Point< ptrdiff_t > > &polygon, const Color &color, size_t width=1) |
| Draws a clipped polygon frame on an image. More... | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawFilledPolygon (View< A > &canvas, const std::vector< Simd::Point< ptrdiff_t > > &polygon, const Color &color) |
| Draws a filled polygon on an image. More... | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawEllipse (View< A > &canvas, const Point< ptrdiff_t > ¢er, const Point< ptrdiff_t > &axes, double slope, const Color &color, size_t width=1) |
| Draws a clipped ellipse frame on an image. More... | |
| template<template< class > class A, class Color > | |
| SIMD_INLINE void | DrawCircle (View< A > &canvas, const Point< ptrdiff_t > ¢er, ptrdiff_t radius, const Color &color, size_t width=1) |
| Draws a clipped circle frame on an image. More... | |
Detailed Description
Drawing functions to annotate debug information.
Function Documentation
◆ DrawLine() [1/2]
| void DrawLine | ( | View< A > & | canvas, |
| ptrdiff_t | x1, | ||
| ptrdiff_t | y1, | ||
| ptrdiff_t | x2, | ||
| ptrdiff_t | y2, | ||
| const Color & | color, | ||
| size_t | width = 1 |
||
| ) |
Draws a clipped line segment on an image.
The function draws a line from (x1, y1) to (x2, y2) into canvas. Coordinates use the usual image coordinate system: X grows to the right and Y grows downward. The segment is clipped to the canvas bounds; if it is completely outside, the function does nothing. Pixel size of canvas must be equal to sizeof(Color). Only colors with 1, 2, 3 or 4 bytes are supported.
- Note
- This function is a C++ wrapper for function SimdDrawLine.
- Parameters
-
[out] canvas - a canvas image. [in] x1 - X coordinate of the first point of the line. [in] y1 - Y coordinate of the first point of the line. [in] x2 - X coordinate of the second point of the line. [in] y2 - Y coordinate of the second point of the line. [in] color - a color of the line. [in] width - a line width (in pixels). By default it is equal to 1.
◆ DrawLine() [2/2]
| void DrawLine | ( | View< A > & | canvas, |
| const Point< ptrdiff_t > & | p1, | ||
| const Point< ptrdiff_t > & | p2, | ||
| const Color & | color, | ||
| size_t | width = 1 |
||
| ) |
Draws a clipped line segment on an image.
The function draws a line from p1 to p2 into canvas. Coordinates use the usual image coordinate system: X grows to the right and Y grows downward. The segment is clipped to the canvas bounds; if it is completely outside, the function does nothing. Pixel size of canvas must be equal to sizeof(Color). Only colors with 1, 2, 3 or 4 bytes are supported.
- Note
- This function calls Simd::DrawLine(View & canvas, ptrdiff_t x1, ptrdiff_t y1, ptrdiff_t x2, ptrdiff_t y2, const Color & color, size_t width = 1).
- Parameters
-
[out] canvas - a canvas image. [in] p1 - the first point of the line. [in] p2 - the second point of the line. [in] color - a color of the line. [in] width - a line width (in pixels). By default it is equal to 1.
◆ DrawRectangle() [1/3]
| void DrawRectangle | ( | View< A > & | canvas, |
| ptrdiff_t | left, | ||
| ptrdiff_t | top, | ||
| ptrdiff_t | right, | ||
| ptrdiff_t | bottom, | ||
| const Color & | color, | ||
| size_t | width = 1 |
||
| ) |
Draws a clipped rectangle frame on an image.
The function draws four clipped line segments: (left, top)-(right, top), (right, top)-(right, bottom), (right, bottom)-(left, bottom) and (left, bottom)-(left, top). Coordinates use the usual image coordinate system: X grows to the right and Y grows downward. Pixel size of canvas must be equal to sizeof(Color). Only colors with 1, 2, 3 or 4 bytes are supported.
- Note
- This function is a C++ wrapper for function SimdDrawRectangle.
- Parameters
-
[out] canvas - a canvas image. [in] left - X coordinate of the left side of the rectangle. [in] top - Y coordinate of the top side of the rectangle. [in] right - X coordinate of the right side of the rectangle. [in] bottom - Y coordinate of the bottom side of the rectangle. [in] color - a color of the rectangle frame. [in] width - a width of the rectangle frame (in pixels). By default it is equal to 1.
◆ DrawRectangle() [2/3]
| void DrawRectangle | ( | View< A > & | canvas, |
| const Rectangle< ptrdiff_t > & | rect, | ||
| const Color & | color, | ||
| size_t | width = 1 |
||
| ) |
Draws a clipped rectangle frame on an image.
The function draws the rectangle frame using rect.left, rect.top, rect.right and rect.bottom as side coordinates. The frame sides are clipped to the canvas bounds. Pixel size of canvas must be equal to sizeof(Color). Only colors with 1, 2, 3 or 4 bytes are supported.
- Note
- This function is a C++ wrapper for function SimdDrawRectangle.
- Parameters
-
[out] canvas - a canvas image. [in] rect - a rectangle frame. [in] color - a color of the rectangle frame. [in] width - a width of the rectangle frame (in pixels). By default it is equal to 1.
◆ DrawRectangle() [3/3]
| void DrawRectangle | ( | View< A > & | canvas, |
| const Point< ptrdiff_t > & | topLeft, | ||
| const Point< ptrdiff_t > & | bottomRight, | ||
| const Color & | color, | ||
| size_t | width = 1 |
||
| ) |
Draws a clipped rectangle frame on an image.
The function draws the rectangle frame using topLeft and bottomRight as side coordinates. The frame sides are clipped to the canvas bounds. Pixel size of canvas must be equal to sizeof(Color). Only colors with 1, 2, 3 or 4 bytes are supported.
- Note
- This function calls Simd::DrawRectangle(View & canvas, const Rectangle<ptrdiff_t> & rect, const Color & color, size_t width = 1).
- Parameters
-
[out] canvas - a canvas image. [in] topLeft - a top-left corner of the rectangle. [in] bottomRight - a bottom-right corner of the rectangle. [in] color - a color of the rectangle frame. [in] width - a width of the rectangle frame (in pixels). By default it is equal to 1.
◆ DrawFilledRectangle()
Draws a filled rectangle on an image.
The function fills the rectangle area [rect.left, rect.right) x [rect.top, rect.bottom) with the specified color. The filled area is clipped to the canvas bounds. Pixel size of canvas must be equal to sizeof(Color).
- Parameters
-
[out] canvas - a canvas image. [in] rect - a rectangle area to fill. [in] color - a color of the filled rectangle.
◆ DrawPolygon()
| void DrawPolygon | ( | View< A > & | canvas, |
| const std::vector< Simd::Point< ptrdiff_t > > & | polygon, | ||
| const Color & | color, | ||
| size_t | width = 1 |
||
| ) |
Draws a clipped polygon frame on an image.
The function draws a closed polyline through all polygon points. The last point is connected with the first one. Each polygon side is drawn by Simd::DrawLine and clipped to the canvas bounds. Pixel size of canvas must be equal to sizeof(Color). Only colors with 1, 2, 3 or 4 bytes are supported.
- Parameters
-
[out] canvas - a canvas image. [in] polygon - polygon vertices in drawing order. [in] color - a color of the polygon frame. [in] width - a width of the polygon frame (in pixels). By default it is equal to 1.
◆ DrawFilledPolygon()
| void DrawFilledPolygon | ( | View< A > & | canvas, |
| const std::vector< Simd::Point< ptrdiff_t > > & | polygon, | ||
| const Color & | color | ||
| ) |
Draws a filled polygon on an image.
The function fills a polygon with a scanline algorithm. For every canvas row intersecting the polygon, edge intersections are sorted and paired, then pixels between each pair are filled. Parts outside the canvas bounds are clipped. Pixel size of canvas must be equal to sizeof(Color).
- Parameters
-
[out] canvas - a canvas image. [in] polygon - polygon vertices in drawing order. [in] color - a color of the filled polygon.
◆ DrawEllipse()
| void DrawEllipse | ( | View< A > & | canvas, |
| const Point< ptrdiff_t > & | center, | ||
| const Point< ptrdiff_t > & | axes, | ||
| double | slope, | ||
| const Color & | color, | ||
| size_t | width = 1 |
||
| ) |
Draws a clipped ellipse frame on an image.
The function approximates the ellipse by short line segments and draws them by Simd::DrawLine. Axes contain ellipse radii along local X and Y directions. Slope is the rotation angle in radians. The resulting frame is clipped to the canvas bounds. Pixel size of canvas must be equal to sizeof(Color). Only colors with 1, 2, 3 or 4 bytes are supported.
- Parameters
-
[out] canvas - a canvas image. [in] center - a center of the ellipse. [in] axes - ellipse radii along local X and Y directions. [in] slope - a rotation angle of the ellipse (in radians). [in] color - a color of the ellipse frame. [in] width - a width of the ellipse frame (in pixels). By default it is equal to 1.
◆ DrawCircle()
| void DrawCircle | ( | View< A > & | canvas, |
| const Point< ptrdiff_t > & | center, | ||
| ptrdiff_t | radius, | ||
| const Color & | color, | ||
| size_t | width = 1 |
||
| ) |
Draws a clipped circle frame on an image.
The function approximates the circle by short line segments and draws them by Simd::DrawLine. The resulting frame is clipped to the canvas bounds. Pixel size of canvas must be equal to sizeof(Color). Only colors with 1, 2, 3 or 4 bytes are supported.
- Parameters
-
[out] canvas - a canvas image. [in] center - a center of the circle. [in] radius - a radius of the circle. [in] color - a color of the circle frame. [in] width - a width of the circle frame (in pixels). By default it is equal to 1.