Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Generic monochrome graphic primitives

This is a service providing generic implementations of graphic primitives.

it also provides functionality to draw a bitmap to the graphic memory.

These functions are made available if the graphic hardware being used do not implement the functionality in hardware. This is true in most cases.

This service is included as a requirement for a hardware specific component that uses these functions, and provides a asfdoc_common2_draw_pixel function.

Data Structures

struct  gfx_mono_bitmap
 Storage structure for bitmap pixel data and metadata. More...
 

Functions

void gfx_mono_generic_draw_circle (gfx_coord_t x, gfx_coord_t y, gfx_coord_t radius, enum gfx_mono_color color, uint8_t octant_mask)
 Draw an outline of a circle or arc (generic implementation). More...
 
void gfx_mono_generic_draw_filled_circle (gfx_coord_t x, gfx_coord_t y, gfx_coord_t radius, enum gfx_mono_color color, uint8_t quadrant_mask)
 Draw a filled circle or sector (generic implementation). More...
 
void gfx_mono_generic_draw_filled_rect (gfx_coord_t x, gfx_coord_t y, gfx_coord_t width, gfx_coord_t height, enum gfx_mono_color color)
 Draw a filled rectangle (generic implementation). More...
 
void gfx_mono_generic_draw_line (gfx_coord_t x1, gfx_coord_t y1, gfx_coord_t x2, gfx_coord_t y2, enum gfx_mono_color color)
 Draw a line between two arbitrary points (generic implementation). More...
 
void gfx_mono_generic_draw_rect (gfx_coord_t x, gfx_coord_t y, gfx_coord_t width, gfx_coord_t height, enum gfx_mono_color color)
 Draw an outline of a rectangle (generic implementation). More...
 
void gfx_mono_generic_draw_vertical_line (gfx_coord_t x, gfx_coord_t y, gfx_coord_t length, enum gfx_mono_color color)
 Draw a vertical line, one pixel wide (generic implementation) More...
 
void gfx_mono_generic_put_bitmap (struct gfx_mono_bitmap *bitmap, gfx_coord_t x, gfx_coord_t y)
 Put bitmap from FLASH or RAM to display. More...
 
void gfx_mono_generic_draw_horizontal_line (gfx_coord_t x, gfx_coord_t y, gfx_coord_t length, enum gfx_mono_color color)
 Draw a horizontal line, one pixel wide (generic implementation) More...
 

void gfx_mono_generic_draw_circle ( gfx_coord_t  x,
gfx_coord_t  y,
gfx_coord_t  radius,
enum gfx_mono_color  color,
uint8_t  octant_mask 
)

Draw an outline of a circle or arc (generic implementation).

The radius is the distance from the center to the circumference, which means that the total width or height of a circle will be (radius*2+1).

The octant_mask parameter is a bitmask that decides which octants of the circle to draw. Use the GFX_OCTANTn, GFX_QUADRANTn, GFX_xHALF and GFX_WHOLE constants and OR them together if required. Radius equal to zero gives a single pixel.

Parameters
[in]xX coordinate of center.
[in]yY coordinate of center.
[in]radiusCircle radius in pixels.
[in]colorPixel operation.
[in]octant_maskBitmask indicating which octants to draw.

References gfx_mono_draw_pixel, GFX_OCTANT0, GFX_OCTANT1, GFX_OCTANT2, GFX_OCTANT3, GFX_OCTANT4, GFX_OCTANT5, GFX_OCTANT6, and GFX_OCTANT7.

void gfx_mono_generic_draw_filled_circle ( gfx_coord_t  x,
gfx_coord_t  y,
gfx_coord_t  radius,
enum gfx_mono_color  color,
uint8_t  quadrant_mask 
)

Draw a filled circle or sector (generic implementation).

The radius is the distance from the center to the circumference, which means that the total width or height of a circle will be (radius*2+1).

The quadrant_mask parameter is a bitmask that decides which quadrants of the circle to draw. Use the GFX_QUADRANTn, GFX_xHALF and GFX_WHOLE constants and OR them together if required. Radius equal to zero gives a single pixel.

Note
This function only supports quadrants while gfx_draw_circle() supports octants. This is to improve performance on drawing filled circles.
Parameters
[in]xX coordinate of center.
[in]yY coordinate of center.
[in]radiusCircle radius in pixels.
[in]colorPixel operation.
[in]quadrant_maskBitmask indicating which quadrants to draw.

References gfx_mono_draw_pixel, gfx_mono_draw_vertical_line, GFX_QUADRANT0, GFX_QUADRANT1, GFX_QUADRANT2, and GFX_QUADRANT3.

void gfx_mono_generic_draw_filled_rect ( gfx_coord_t  x,
gfx_coord_t  y,
gfx_coord_t  width,
gfx_coord_t  height,
enum gfx_mono_color  color 
)

Draw a filled rectangle (generic implementation).

Parameters
[in]xX coordinate of the left side.
[in]yY coordinate of the top side.
[in]widthWidth of the rectangle.
[in]heightHeight of the rectangle.
[in]colorPixel operation of the line

References gfx_mono_draw_horizontal_line.

void gfx_mono_generic_draw_horizontal_line ( gfx_coord_t  x,
gfx_coord_t  y,
gfx_coord_t  length,
enum gfx_mono_color  color 
)

Draw a horizontal line, one pixel wide (generic implementation)

Note
This function does a very simple bounds checking that does not check if the line is placed outside the screen. If you supply an x- or y-coordinate outside the display the behaviour is undefined, and you risk overwriting portions of internal SRAM.
Parameters
[in]xX coordinate of leftmost pixel.
[in]yY coordinate of the line.
[in]lengthLength of the line in pixels.
[in]colorPixel operation of the line.

References gfx_mono_get_byte, GFX_MONO_LCD_WIDTH, gfx_mono_put_byte, GFX_PIXEL_CLR, GFX_PIXEL_SET, and GFX_PIXEL_XOR.

void gfx_mono_generic_draw_line ( gfx_coord_t  x1,
gfx_coord_t  y1,
gfx_coord_t  x2,
gfx_coord_t  y2,
enum gfx_mono_color  color 
)

Draw a line between two arbitrary points (generic implementation).

Parameters
[in]x1Start X coordinate.
[in]y1Start Y coordinate.
[in]x2End X coordinate.
[in]y2End Y coordinate.
[in]colorPixel operation of the line.

References gfx_mono_draw_pixel, and i.

void gfx_mono_generic_draw_rect ( gfx_coord_t  x,
gfx_coord_t  y,
gfx_coord_t  width,
gfx_coord_t  height,
enum gfx_mono_color  color 
)

Draw an outline of a rectangle (generic implementation).

Parameters
[in]xX coordinate of the left side.
[in]yY coordinate of the top side.
[in]widthWidth of the rectangle.
[in]heightHeight of the rectangle.
[in]colorPixel operation of the line.

References gfx_mono_draw_horizontal_line, and gfx_mono_draw_vertical_line.

void gfx_mono_generic_draw_vertical_line ( gfx_coord_t  x,
gfx_coord_t  y,
gfx_coord_t  length,
enum gfx_mono_color  color 
)

Draw a vertical line, one pixel wide (generic implementation)

Note
This function does a very simple bounds checking that does not check if the line is placed outside the screen. If you supply an x- or y-coordinate outside the display the behaviour is undefined, and you risk overwriting portions of internal SRAM.
Parameters
[in]xX coordinate of the line.
[in]yY coordinate of the topmost pixel.
[in]lengthLength of the line in pixels.
[in]colorPixel operation of the line.

References gfx_mono_draw_pixel, GFX_MONO_LCD_HEIGHT, and gfx_mono_mask_byte.

void gfx_mono_generic_put_bitmap ( struct gfx_mono_bitmap bitmap,
gfx_coord_t  x,
gfx_coord_t  y 
)

Put bitmap from FLASH or RAM to display.

This function will output bitmap data from FLASH or RAM. The bitmap y-coordinate will be aligned with display pages, rounded down. Ie: placing a bitmap at x=10, y=5 will put the bitmap at x = 10,y = 0 and placing a bitmap at x = 10, y = 10 will put the bitmap at x = 10, y = 8

References gfx_mono_bitmap::data, GFX_MONO_BITMAP_PROGMEM, GFX_MONO_BITMAP_RAM, gfx_mono_put_byte, gfx_mono_put_page, gfx_mono_bitmap::height, i, gfx_mono_bitmap::pixmap, gfx_mono_bitmap::progmem, PROGMEM_READ_BYTE, gfx_mono_bitmap::type, and gfx_mono_bitmap::width.