![]() |
Vivoe Lite 0.5.0
Lightweight GVA like HMI for military displays.
|
Class definition of the Renderer Cairo. More...
#include <renderer_cairo.h>


Public Member Functions | |
| RendererCairo (uint32_t width, uint32_t height) | |
| Construct a new Renderer Cairo object. | |
| ~RendererCairo () override | |
| Destroy the Renderer Cairo object. | |
| HandleType * | Init (uint32_t width, uint32_t height, bool fullscreen=false) |
| Initalise the renderer with display parameters. | |
| void | SetPixel (uint32_t x, uint32_t y) override |
| void | SetColour (uint8_t red, uint8_t green, uint8_t blue) override |
| Set the Colour object. | |
| void | SetColour (uint32_t rgb) |
| Set the Colour object. | |
| void | SetColourForeground (ColourType colour) |
| Set the Colour Foreground object. | |
| void | SetColourForeground (uint8_t red, uint8_t green, uint8_t blue) override |
| Set the Colour Foreground object. | |
| void | SetColourForeground (uint32_t rgb) |
| Set the Colour Foreground object. | |
| void | SetColourBackground (ColourType colour) |
| Set the Colour Background attribute. | |
| void | SetColourBackground (uint8_t red, uint8_t green, uint8_t blue) override |
| Set the Colour Background object. | |
| void | SetColourBackground (uint32_t rgb) |
| Set the Colour Background object. | |
| void | SetLineType (uint32_t type) |
| Set the Line Type object. | |
| void | SetLineThickness (uint32_t thickness, LineType fill) |
| Set the Line Thickness object. | |
| void | SetLineThickness (uint32_t thickness, LineType fill, LineCapEnd end) |
| Set the Line Thickness object. | |
| uint32_t | MovePen (int32_t x, int32_t y) |
| uint32_t | DrawPen (uint32_t x, uint32_t y, bool close) |
| uint32_t | DrawPen (uint32_t x, uint32_t y) |
| uint32_t | MovePenRaw (int32_t x, int32_t y) |
| uint32_t | DrawPenRaw (int32_t x, int32_t y) |
| void | DrawArcRaw (uint32_t x, uint32_t y, uint32_t radius, uint32_t angle1, uint32_t angle2) |
| uint32_t | DrawLine (uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) override |
| void | Save () |
| Save the current state of the renderer. | |
| void | Restore () |
| Restore the last saved state of the renderer. | |
| void | Scale (double x, double y) |
| Scale the renderer. | |
| void | Translate (uint32_t x, uint32_t y) |
| Translate the renderer. | |
| void | Rotate (double radians) |
| Rotate the renderer. | |
| uint32_t | ClosePath (bool fill) |
| Close drawing path. | |
| void | DrawCircle (uint32_t x, uint32_t y, uint32_t radius, bool fill) override |
| Draw a circle. | |
| void | DrawRectangle (uint32_t x, uint32_t y, uint32_t width, uint32_t height, bool fill) override |
| Draw a rectangle. | |
| void | DrawRoundedRectangle (uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t corner, bool fill) |
| Draw a rounded rectangle. | |
| void | DrawTriangle (uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t x3, uint32_t y3, bool fill) |
| Draw a triangle. | |
| uint32_t | DrawColor (ColourType colour) |
| Set the Colour object to draw with. | |
| uint32_t | DrawColor (uint8_t r, uint8_t g, uint8_t b) override |
| Set the Colour object to draw with. | |
| uint32_t | CurveTo (uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t x3, uint32_t y3) |
| Adds a cubic Bézier spline to the path from the current point to position (x3 , y3 ) in user-space coordinates, using (x1 , y1 ) and (x2 , y2 ) as the control points. After this call the current point will be (x3 , y3 ). | |
| uint32_t | DrawColor (uint32_t rgb) |
| Set the draw colour. | |
| void | SetTextFont (uint32_t slope, widget::WeightType weight, std::string_view font_name, double size) |
| Set the Text Font object. | |
| void | Push () |
| Push the current state of the renderer. | |
| void | Pop () |
| Pop the last saved state of the renderer. | |
| uint32_t | GetTextWidth (std::string_view str, uint32_t fontSize) const |
| Get the Text Width object. | |
| uint32_t | GetTextHeight (std::string_view str, uint32_t fontSize) const |
| Get the Text Height object. | |
| void | DrawString (uint32_t x, uint32_t y, std::string_view text) |
| Draw some text on the screen. | |
| void | DrawLabel (uint32_t x, uint32_t y, std::string_view text) |
| Draw an on screen label. | |
| void | DrawTextCentre (uint32_t x, std::string_view text, uint32_t size) |
| Draw some text on the screen and centre it. | |
| uint32_t | TextureRGB (uint32_t x, uint32_t y, unsigned char *buffer, std::string_view file) override |
| Set a texture (file) to use as a bitmap. | |
| uint32_t | TextureRGB (uint32_t x, uint32_t y, unsigned char *buffer) |
| Set a texture (file) to use as a bitmap. | |
| uint32_t | TextureRGB (uint32_t x, uint32_t y, cairo_surface_t *surface) |
| Set a texture (cairo surface) to use as a bitmap. | |
| void | Draw () |
| Redraw the screen. | |
| void | Reset () |
| Redraw the screen. | |
| void | SetHeight (uint32_t height) const |
| Set the Height object. | |
| void | SetWidth (uint32_t width) const |
| Set the Width object. | |
| uint32_t | GetHeight () const |
| Get the Height object. | |
| uint32_t | GetWidth () const |
| Get the Width object. | |
| void | SetSurface (cairo_surface_t *surface) |
| Set the Surface attribute, used by application. | |
| void | DrawSurface (cairo_t *cr) |
| Draw the new cairo surface to the screen. | |
| void | Configure (uint32_t height, uint32_t width) |
| Configure the surface to use new dimensions. | |
Public Member Functions inherited from gva::Renderer | |
| Renderer (uint32_t width, uint32_t height) | |
| Construct a new Renderer object. | |
| virtual | ~Renderer ()=default |
| Destroy the Renderer object. | |
| uint32_t | UnpackRed (uint32_t rgb) const |
| Unpack a red value. | |
| uint32_t | UnpackGreen (uint32_t rgb) const |
| Unpack a green value. | |
| uint32_t | UnpackBlue (uint32_t rgb) const |
| Unpack a blue value. | |
| RgbUnpackedType | UnpackRgb (uint64_t rgb) const |
| Unpack red, green and blue values. | |
Static Public Member Functions | |
| static void | DestroySurface () |
| Destroy the current cairo surface, usually called during shutdown. | |
Static Public Member Functions inherited from gva::Renderer | |
| static uint32_t | GetWidth () |
| Get the Width attribute. | |
| static uint32_t | GetHeight () |
| Get the Height attribute. | |
| static void | SetWidth (uint32_t width) |
| Set the Width attribute. | |
| static void | SetHeight (uint32_t height) |
| Set the Height attribute. | |
| static uint32_t | PackRgb (ColourType colour) |
| Pack the colour to RGB. | |
| static uint32_t | PackRgb (uint8_t r, uint8_t g, uint8_t b) |
| Pack three red, green, blue values. | |
Static Public Attributes | |
| static HandleType | render_ |
| Class definition of the HandleType. | |
Additional Inherited Members | |
Static Protected Attributes inherited from gva::Renderer | |
| static uint32_t | height_ = kMinimumHeight |
| The height of the renderer. | |
| static uint32_t | width_ = kMinimumWidth |
| The width of the renderer. | |
Class definition of the Renderer Cairo.
| gva::RendererCairo::RendererCairo | ( | uint32_t | width, |
| uint32_t | height | ||
| ) |
Construct a new Renderer Cairo object.
| width | |
| height |
| uint32_t gva::RendererCairo::ClosePath | ( | bool | fill | ) |
Close drawing path.
| fill | Fill if true |
| void gva::RendererCairo::Configure | ( | uint32_t | height, |
| uint32_t | width | ||
| ) |
Configure the surface to use new dimensions.
| height | |
| width |
| uint32_t gva::RendererCairo::CurveTo | ( | uint32_t | x1, |
| uint32_t | y1, | ||
| uint32_t | x2, | ||
| uint32_t | y2, | ||
| uint32_t | x3, | ||
| uint32_t | y3 | ||
| ) |
Adds a cubic Bézier spline to the path from the current point to position (x3 , y3 ) in user-space coordinates, using (x1 , y1 ) and (x2 , y2 ) as the control points. After this call the current point will be (x3 , y3 ).
| x1 | first point of x in pixels |
| y1 | first point of y in pixels |
| x2 | second point of x in pixels |
| y2 | second point of y in pixels |
| x3 | third point of x in pixels |
| y3 | third point of y in pixels |
| void gva::RendererCairo::DrawArcRaw | ( | uint32_t | x, |
| uint32_t | y, | ||
| uint32_t | radius, | ||
| uint32_t | angle1, | ||
| uint32_t | angle2 | ||
| ) |
| x | |
| y | |
| radius | |
| angle1 | |
| angle2 |
|
overridevirtual |
Draw a circle.
| x | The x position |
| y | The y position |
| radius | The radius in pixels |
| fill | Fill if true |
Implements gva::Renderer.
| uint32_t gva::RendererCairo::DrawColor | ( | ColourType | colour | ) |
Set the Colour object to draw with.
| colour | The colour to draw with |
| uint32_t gva::RendererCairo::DrawColor | ( | uint32_t | rgb | ) |
Set the draw colour.
| rgb | The colour to draw with, packed RGB |
|
overridevirtual |
Set the Colour object to draw with.
| r | The red value |
| g | The green value |
| b | The blue value |
Implements gva::Renderer.
| void gva::RendererCairo::DrawLabel | ( | uint32_t | x, |
| uint32_t | y, | ||
| std::string_view | text | ||
| ) |
Draw an on screen label.
| x | axis pixel postion |
| y | axis pixel postion |
| text |
|
overridevirtual |
|
inline |
| x | |
| y |
| uint32_t gva::RendererCairo::DrawPen | ( | uint32_t | x, |
| uint32_t | y, | ||
| bool | close | ||
| ) |
| x | |
| y | |
| close |
| uint32_t gva::RendererCairo::DrawPenRaw | ( | int32_t | x, |
| int32_t | y | ||
| ) |
| x | |
| y |
|
overridevirtual |
Draw a rectangle.
| x | The x position |
| y | The y position |
| width | The width in pixels |
| height | The height in pixels |
| fill | Fill if true |
Implements gva::Renderer.
| void gva::RendererCairo::DrawRoundedRectangle | ( | uint32_t | x, |
| uint32_t | y, | ||
| uint32_t | width, | ||
| uint32_t | height, | ||
| uint32_t | corner, | ||
| bool | fill | ||
| ) |
Draw a rounded rectangle.
| x | The x position |
| y | The y position |
| width | The width |
| height | The height in pixels |
| corner | The corner radius |
| fill | Fill if true |
| void gva::RendererCairo::DrawString | ( | uint32_t | x, |
| uint32_t | y, | ||
| std::string_view | text | ||
| ) |
Draw some text on the screen.
| x | axis pixel postion |
| y | axis pixel postion |
| text |
| void gva::RendererCairo::DrawSurface | ( | cairo_t * | cr | ) |
Draw the new cairo surface to the screen.
| void gva::RendererCairo::DrawTextCentre | ( | uint32_t | x, |
| std::string_view | text, | ||
| uint32_t | size | ||
| ) |
Draw some text on the screen and centre it.
| x | axis pixel postion |
| text | to draw |
| size | of the text |
| void gva::RendererCairo::DrawTriangle | ( | uint32_t | x1, |
| uint32_t | y1, | ||
| uint32_t | x2, | ||
| uint32_t | y2, | ||
| uint32_t | x3, | ||
| uint32_t | y3, | ||
| bool | fill | ||
| ) |
Draw a triangle.
| x1 | The first x position |
| y1 | The first y position |
| x2 | The second x position |
| y2 | The second y position |
| x3 | The third x position |
| y3 | The third y position |
| fill | Fill if true |
|
inline |
Get the Height object.
| uint32_t gva::RendererCairo::GetTextHeight | ( | std::string_view | str, |
| uint32_t | fontSize | ||
| ) | const |
Get the Text Height object.
| str | |
| fontSize |
| uint32_t gva::RendererCairo::GetTextWidth | ( | std::string_view | str, |
| uint32_t | fontSize | ||
| ) | const |
Get the Text Width object.
| str | |
| fontSize |
|
inline |
Get the Width object.
| HandleType * gva::RendererCairo::Init | ( | uint32_t | width, |
| uint32_t | height, | ||
| bool | fullscreen = false |
||
| ) |
| uint32_t gva::RendererCairo::MovePen | ( | int32_t | x, |
| int32_t | y | ||
| ) |
| x | |
| y |
| uint32_t gva::RendererCairo::MovePenRaw | ( | int32_t | x, |
| int32_t | y | ||
| ) |
| x | |
| y |
| void gva::RendererCairo::Rotate | ( | double | radians | ) |
Rotate the renderer.
| radians | The angle to rotate by |
| void gva::RendererCairo::Scale | ( | double | x, |
| double | y | ||
| ) |
Scale the renderer.
| x | The x scale |
| y | The y scale |
| void gva::RendererCairo::SetColour | ( | uint32_t | rgb | ) |
Set the Colour object.
| rgb |
|
overridevirtual |
| void gva::RendererCairo::SetColourBackground | ( | ColourType | colour | ) |
Set the Colour Background attribute.
| colour |
| void gva::RendererCairo::SetColourBackground | ( | uint32_t | rgb | ) |
Set the Colour Background object.
| rgb |
|
overridevirtual |
| void gva::RendererCairo::SetColourForeground | ( | ColourType | colour | ) |
Set the Colour Foreground object.
| colour | The colour to set |
| void gva::RendererCairo::SetColourForeground | ( | uint32_t | rgb | ) |
Set the Colour Foreground object.
| rgb |
|
overridevirtual |
|
inline |
Set the Height object.
| height |
| void gva::RendererCairo::SetLineThickness | ( | uint32_t | thickness, |
| LineType | fill | ||
| ) |
Set the Line Thickness object.
| thickness | |
| fill |
| void gva::RendererCairo::SetLineThickness | ( | uint32_t | thickness, |
| LineType | fill, | ||
| LineCapEnd | end | ||
| ) |
Set the Line Thickness object.
| thickness | |
| fill | |
| end |
| void gva::RendererCairo::SetLineType | ( | uint32_t | type | ) |
Set the Line Type object.
| type |
|
overridevirtual |
| x | |
| y |
Implements gva::Renderer.
| void gva::RendererCairo::SetSurface | ( | cairo_surface_t * | surface | ) |
Set the Surface attribute, used by application.
| surface |
| void gva::RendererCairo::SetTextFont | ( | uint32_t | slope, |
| widget::WeightType | weight, | ||
| std::string_view | font_name, | ||
| double | size | ||
| ) |
Set the Text Font object.
| slope | The font slope |
| weight | The font weight |
| font_name | The font name |
| size | The font size |
|
inline |
Set the Width object.
| width |
| uint32_t gva::RendererCairo::TextureRGB | ( | uint32_t | x, |
| uint32_t | y, | ||
| cairo_surface_t * | surface | ||
| ) |
Set a texture (cairo surface) to use as a bitmap.
| x | axis pixel postion |
| y | axis pixel postion |
| surface | to load the image into |
| uint32_t gva::RendererCairo::TextureRGB | ( | uint32_t | x, |
| uint32_t | y, | ||
| unsigned char * | buffer | ||
| ) |
Set a texture (file) to use as a bitmap.
| x | axis pixel postion |
| y | axis pixel postion |
| buffer | to load the image into |
|
overridevirtual |
Set a texture (file) to use as a bitmap.
| x | axis pixel postion |
| y | axis pixel postion |
| buffer | unused when file set |
| file | to load |
Implements gva::Renderer.
| void gva::RendererCairo::Translate | ( | uint32_t | x, |
| uint32_t | y | ||
| ) |
Translate the renderer.
| x | The x position to translate to |
| y | The y position to translate to |