Skip to content
scs edited this page Jul 14, 2012 · 2 revisions

Table of Contents

Overview

Overlay text and simple geometric primitives over existing color images in BGR format. To be able to render text, leanXoverlay loads in a bitmap (.bmp) image with all available characters printed out (Font_System.bmp). This file has to be copied to the execution location for the code to work. Always call Occ_ov_init before using any other function from this collection.

Credits

Contributed by Reto Bättig

Dependencies

  • Oscar v1.3 or greater
    • Bmp module
  • C math library (Add -lm to LD_FLAGS)

API

Occ_ov_init

Loads in the font from Font_System.bmp and makes some precalculations. Call this before calling any other function from this collection.

Arguments:

  • -
Return value:
  • 0 on success, -1 on error

Occ_ov_text

Overlays a text message at the specified location with the specified colors.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x: Desired horizontal position of the text (pixels)
  • int y: Desired vertical position of the text (pixels)
  • int size: Size multiplication factor for the font.
  • char *text: Desired text
  • uint32 col_fg: Foreground (text) color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
  • uint32 col_bg: Background color of the text with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
Return value:
  • void

Occ_ov_line

Draws a line with the specified color.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x1: Horizontal starting position of the line (pixels)
  • int y1: Vertical starting position of the line (pixels)
  • int x2: Horizontal end position of the line (pixels)
  • int y2: Vertical end position of the line (pixels)
  • uint32 col: Line color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
Return value:
  • void

Occ_ov_box

Draws a box with the specified colors.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x1: Horizontal starting position (top left corner) of the box (pixels)
  • int y1: Vertical starting position (top left corner) of the box (pixels)
  • int x2: Horizontal end position (bottom right corner) of the box (pixels)
  • int y2: Vertical end position (bottom right corner) of the box (pixels)
  • uint32 col: Box color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
  • bool fill: True if the box is to be filled with the specified color, false if only the box frame is to be drawn.
Return value:
  • void

Occ_ov_bar_vert

Draws a vertical bar with an empty and a filled part, the height of which reflects the specified percentage. Useful to create a visual feedback of a percentage value.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x1: Horizontal starting position (top left corner) of the bar (pixels)
  • int y1: Vertical starting position (top left corner) of the bar (pixels)
  • int x2: Horizontal end position (bottom right corner) of the bar (pixels)
  • int y2: Vertical end position (bottom right corner) of the bar (pixels)
  • int percentage: Percentage of the bar to fill.
  • uint32 col: Box color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
  • bool fill: True if the box is to be filled with the specified color, false if only the box frame is to be drawn.
Return value:
  • void

Occ_ov_ellipse

Draws an ellipse with the specified colors and with the major axis along the X-axis. To draw a circle with radius R around X0/Y0, choose P1=X0-R/Y0, P2=X0/Y0-R.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x1: Horizontal position of the leftmost point P1 of the ellipse (pixels)
  • int y1: Vertical position of the leftmost point P1 of the ellipse (pixels)
  • int x2: Horizontal position of the highest point P2 of the ellipse (pixels)
  • int y2: Vertical position of the highest point P2 of the ellipse (pixels)
  • uint32 col: Ellipse color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
  • bool fill: True if the ellipse is to be filled with the specified color, false if only the circumference is to be drawn.
Return value:
  • void

Occ_ov_pixel

Set the pixel at a certain coordinate to a certain value.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x: Horizontal position of the pixel to be set.
  • int y: Vertical position of the pixel to be set.
  • uint32 col: Color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
Return value:
  • void

Occ_ov_plot_vector

Plot a 1-dimensional signal vector (curve) onto the image. The supplied vector must contain the desired Y values for all X coordinates (pixels) up to the horizontal length of the curve.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x0: Horizontal position of the origin of the X axis of the curve (pixels)
  • int y0: Vertical position of the origin of the X axis of the curve (pixels)
  • int8 *v: Array of Y values for each X value of the curve.
  • int len: Length of the array v and thus horizontal length of the curve.
  • uint32 color: Color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
Return value:
  • void

Occ_ov_plot_vector_scale8

Same as Occ_ov_plot_vector but with automatic vertical rescaling of the curve to height.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x0: Horizontal position of the origin of the X axis of the curve (pixels)
  • int y0: Vertical position of the origin of the X axis of the curve (pixels)
  • int8 *vect: Array of Y values for each X value of the curve.
  • int height: Maximum total height of the curve (pixels)
  • int16 len: Length of the array v and thus horizontal length of the curve.
  • uint32 color: Color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
Return value:
  • void

Occ_ov_plot_vector_scale16

Same as Occ_ov_plot_vector_scale8 but with vector being described with int16 values instead of int8.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x0: Horizontal position of the origin of the X axis of the curve (pixels)
  • int y0: Vertical position of the origin of the X axis of the curve (pixels)
  • int16 *vect: Array of Y values for each X value of the curve.
  • int height: Maximum total height of the curve (pixels)
  • int16 len: Length of the array v and thus horizontal length of the curve.
  • uint32 color: Color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
Return value:
  • void

Occ_ov_plot_vector_scale32

Same as Occ_ov_plot_vector_scale8 but with vector being described with int32 values instead of int8.

Arguments:

  • struct OSC_PICTURE *pPic: The picture to add the overlay to
  • int x0: Horizontal position of the origin of the X axis of the curve (pixels)
  • int y0: Vertical position of the origin of the X axis of the curve (pixels)
  • int32 *vect: Array of Y values for each X value of the curve.
  • int height: Maximum total height of the curve (pixels)
  • int16 len: Length of the array v and thus horizontal length of the curve.
  • uint32 color: Color with format 0xBBGGRR, where B=Blue, G=Green, R=Red between 0x00 and 0xFF
Return value:
  • void
Clone this wiki locally