EE445M RTOS
Taken at the University of Texas Spring 2015
|
Frame bufer representation in memory. More...
Functions | |
framebuffer | fb_init (void) |
Create a framebuffer object and return the handle. More... | |
void | fb_destroy (framebuffer) |
Destroy a framebuffer object. More... | |
void | fb_erase_string (framebuffer, point *, char *) |
Erase string on fb starting at top_left_corner. More... | |
void | fb_erase_string_anon (framebuffer fb, point *top_left_corner, char *string) |
Erase string on fb starting at top_left_corner and free top_left_corner. More... | |
void | fb_erase_char (framebuffer, point *, char) |
Erase char on fb starting at top_left_corner. More... | |
void | fb_erase_char_anon (framebuffer fb, point *top_left_corner, char c) |
Call and free . More... | |
private void | _fb_draw_string (framebuffer, point *, char *) |
For internal use only. More... | |
void | fb_draw_string (framebuffer fb, point *top_left_corner, char *string) |
Draw string on fb starting at top_left_corner. More... | |
void | fb_draw_string_anon_pt (framebuffer fb, point *top_left_corner, char *string) |
Call fb_draw_string and destroy top_left_corner. More... | |
private void | _fb_draw_char (framebuffer, point *, char) |
For internal use only. More... | |
void | fb_draw_shape (framebuffer, shape *) |
Using as a canvas, draw . More... | |
void | fb_draw_shapes (framebuffer, ushort,...) |
void | fb_draw_shape_arr (framebuffer, ushort, shape **) |
void | fb_erase_shape_arr (framebuffer, ushort, shape **) |
private void | _fb_draw_shape (framebuffer, shape *, shade_t) |
For internal use only. More... | |
void | fb_erase_shape (framebuffer fb, shape *sh) |
Using as a canvas, draw . More... | |
void | fb_set_pixel (framebuffer, uchar, uchar, shade_t) |
In fb, set pixel (x,y) to . More... | |
void | fb_clear_pixel (framebuffer fb, uchar x, uchar y) |
Clear pixel (x,y) in . More... | |
void | fb_erase_pixel (framebuffer fb, uchar x, uchar y) |
Erase pixel (x,y) in . More... | |
private void | _fb_draw_line (framebuffer, point *, point *, shade_t) |
The heavy-lifter (pixel-setter) in line-segment-drawing. More... | |
void | fb_erase_anon_line (framebuffer fb, point *point1, point *point2) |
Erases a line connecting two points before destroys the two points. More... | |
void | fb_erase_line (framebuffer fb, point *point1, point *point2) |
Remove a line segment on from to . More... | |
void | fb_draw_anon_line (framebuffer fb, point *point1, point *point2, shade_t shade) |
Draws a line connecting two points before destroying the two points. More... | |
void | fb_draw_line (framebuffer fb, point *point1, point *point2, shade_t shade) |
Draw a line segment on from to of color .to of color .shade. More... | |
void | fb_draw_line_gradient (framebuffer fb, point *point1, point *point2, shade_t shade) |
Draw a line segment on from to . More... | |
void | fb_draw_ellipse (framebuffer, point *, ushort, ushort, shade_t) |
Draw an ellipse in fb at center with specified x- and y-radii of color shade. More... | |
void | fb_draw_circle (framebuffer fb, circle *c) |
Draw a circle in at with radius of color . More... | |
private void | _fb_fill_four_ellipse_points (framebuffer, point *, ushort, ushort) |
Fill an ellipse on fb. More... | |
void | fb_draw_ellipse_fill (framebuffer, point *, ushort, ushort, shade_t) |
Draw on fb a shaded ellipse described by center, x- and y-radii. More... | |
private void | _fb_plot_four_ellipse_points (framebuffer, point *, ushort, ushort) |
Plot on fb the four symmetric points on an ellipse described by a center and x- and y-offsets. More... | |
void | fb_console_println_point (point *) |
Print a point (ordered pair) to the console followed by a newline. More... | |
void | fb_console_print_point (point *) |
Print a point (ordered pair) to the console. More... | |
void | fb_console_println_coordinate (uchar, uchar, shade_t) |
Print a coordinate (ordered pair) to the console followed by a newline. More... | |
void | fb_console_print_coordinate (uchar, uchar, shade_t) |
Print a coordinate (ordered pair) to the console. More... | |
Frame bufer representation in memory.
Represent and transform one frame's buffer in memory.
private void _fb_draw_char | ( | framebuffer | , |
point * | , | ||
char | |||
) |
For internal use only.
Peforms the base work of all framebuffer string drawing requests.
Peforms the base work of all framebuffer string drawing requests.
fb | Framebuffer to use as canvas |
pen | Coordinate of top left corner of char on fb |
c | Character to draw |
Definition at line 283 of file framebuffer.c.
References FB_HEIGHT, fb_set_pixel(), FB_WIDTH, font_valvano, FONT_VALVANO_HEIGHT, FONT_VALVANO_WIDTH, point::shade, point::x, and point::y.
Referenced by _fb_draw_string(), and fb_erase_char().
private void _fb_draw_line | ( | framebuffer | , |
point * | , | ||
point * | , | ||
shade_t | |||
) |
The heavy-lifter (pixel-setter) in line-segment-drawing.
fb | The framebuffer to draw a line on |
point1 | The first endpoint of the line-segment to draw |
point2 | The final endpoint of the line-segment to draw |
shade | The shade of the line-segment to draw |
Definition at line 105 of file framebuffer.c.
References fb_set_pixel(), shape_duplicate_point(), point::x, and point::y.
Referenced by fb_draw_anon_line(), fb_draw_line(), fb_erase_anon_line(), and fb_erase_line().
private void _fb_draw_shape | ( | framebuffer | , |
shape * | , | ||
shade_t | |||
) |
For internal use only.
Helper function that performs the mechanics of drawing a shape.
Helper function that performs the mechanics of drawing a shape. The purpose of this function is to reduce duplicated code in memory.
fb | Framebuffer to use as canvas |
sh | Shape to draw |
shade | Color of shape |
Definition at line 39 of file framebuffer.c.
References fb_draw_line_gradient(), shape::num_points, and shape::points.
Referenced by fb_draw_shape(), and fb_erase_shape().
private void _fb_draw_string | ( | framebuffer | , |
point * | , | ||
char * | |||
) |
For internal use only.
Draw on the starting square against .
Draw a string on the framebuffer starting square against .
fb | Framebuffer to use as canvas |
top_left_corner | Coordinate of top left corner of string on fb |
string | String to draw |
Definition at line 269 of file framebuffer.c.
References _fb_draw_char(), FONT_VALVANO_KERNING, FONT_VALVANO_WIDTH, null, shape_duplicate_point(), and point::x.
Referenced by fb_draw_string(), fb_draw_string_anon_pt(), and fb_erase_string().
private void _fb_fill_four_ellipse_points | ( | framebuffer | , |
point * | , | ||
ushort | , | ||
ushort | |||
) |
Fill an ellipse on fb.
Fill an ellipse on fb.
Fill on fb from the four symmetric points on an ellipse described by a center and x- and y-offsets, to the axis of said ellipse.
fb | Framebuffer to use as canvas |
center | Geometric center of the ellipse |
x | X offset of point to plot |
y | Y offset of point to plot |
Definition at line 138 of file framebuffer.c.
References fb_set_pixel(), point::shade, point::x, and point::y.
Referenced by fb_draw_ellipse_fill().
private void _fb_plot_four_ellipse_points | ( | framebuffer | , |
point * | , | ||
ushort | , | ||
ushort | |||
) |
Plot on fb the four symmetric points on an ellipse described by a center and x- and y-offsets.
Plot on fb the four symmetric points on an ellipse.
fb | Framebuffer to use as canvas |
center | Geometric center of the ellipse |
x | X offset of point to plot |
y | Y offset of point to plot |
Definition at line 129 of file framebuffer.c.
References fb_set_pixel(), point::shade, point::x, and point::y.
Referenced by fb_draw_ellipse().
|
inline |
Clear pixel (x,y) in .
Clear pixel (x,y) in .
This is an alias for with a shade of zero.
fb | Framebuffer to use as canvas |
x | X coordinate |
y | Y coordinate |
Definition at line 240 of file framebuffer.h.
References FB_COLOR_ERASE, and fb_set_pixel().
Referenced by fb_erase_pixel().
Print a coordinate (ordered pair) to the console.
Print a coordinate (ordered pair) to the console.
This function does not append a newline to the console after printing the ordered pair. To just print the ordered pair WITH a newline call function fb_console_println_coordinate instead.
x | X coordinate of the coordinate to print |
y | Y coordinate of the coordinate to print |
shade | Shade of the coodrinate to print |
Definition at line 339 of file framebuffer.c.
void fb_console_print_point | ( | point * | ) |
Print a point (ordered pair) to the console.
Print a point (ordered pair) to the console.
This function does not append a newline to the console after printing the ordered pair. To just print the ordered pair WITH a newline call function fb_console_println_point instead.
p | Point to printf to the console |
Definition at line 316 of file framebuffer.c.
References point::shade, point::x, and point::y.
Print a coordinate (ordered pair) to the console followed by a newline.
Print a coordinate (ordered pair) to the console followed by a newline.
This function appends a newline to the console after printing the ordered pair. To just print the ordered pair (sans newline) call function instead.
x | X coordinate of the coordinate to print |
y | Y coordinate of the coordinate to print |
shade | Shade of the coodrinate to print |
Definition at line 327 of file framebuffer.c.
Referenced by fb_set_pixel().
void fb_console_println_point | ( | point * | ) |
Print a point (ordered pair) to the console followed by a newline.
Print a point (ordered pair) to the console followed by a newline.
This function appends a newline to the console after printing the ordered pair. To just print the ordered pair (sans newline) call function instead.
p | Point to printf to the console |
Definition at line 304 of file framebuffer.c.
References point::shade, point::x, and point::y.
void fb_destroy | ( | framebuffer | ) |
Destroy a framebuffer object.
Destroy a framebuffer object.
fb | Framebuffer to destroy |
Definition at line 22 of file framebuffer.c.
References OLED_WIDTH.
|
inline |
Draws a line connecting two points before destroying the two points.
Draws a line connecting two points before destroying the two points.
fb | Framebuffer to use as canvas |
point1 | One endpoint of the line to draw |
point2 | The other endpoint of the line to draw |
shade | Desired shade of the line on fb |
Definition at line 315 of file framebuffer.h.
References _fb_draw_line().
|
inline |
Draw a circle in at with radius of color .
Draw a circle in at with radius of color .
fb | Framebuffer to use as canvas |
center | Center of circle to draw |
radius | Radius of circle to draw |
shade | Shade to draw circle with on fb |
Definition at line 377 of file framebuffer.h.
References circle::center, fb_draw_ellipse(), circle::radius, and point::shade.
void fb_draw_ellipse | ( | framebuffer | , |
point * | , | ||
ushort | , | ||
ushort | , | ||
shade_t | |||
) |
Draw an ellipse in fb at center with specified x- and y-radii of color shade.
Draw an ellipse in fb at center with x- and y- radii of color shade.
fb | Framebuffer to use as canvas |
center | Center of ellipse to draw |
x_radius | X radius of specified ellipse |
y_radius | Y radius of specified ellipse |
shade | Shade to draw ellipse with on fb |
Definition at line 147 of file framebuffer.c.
References _fb_plot_four_ellipse_points().
Referenced by fb_draw_circle().
void fb_draw_ellipse_fill | ( | framebuffer | , |
point * | , | ||
ushort | , | ||
ushort | , | ||
shade_t | |||
) |
Draw on fb a shaded ellipse described by center, x- and y-radii.
Draw on fb a shaded ellipse described by center, x- and y-radii.
fb | Framebuffer to use as canvas |
center | Gemoetric center of the ellipse |
x_radius | X radius of ellipse to plot |
y_radius | Y radius of ellipse to plot |
shade | Color to fill ellipse with |
OPTIONAL: allow for different specified border color
Definition at line 211 of file framebuffer.c.
References _fb_fill_four_ellipse_points(), fb_set_pixel(), point::shade, point::x, and point::y.
|
inline |
Draw a line segment on from to of color .to of color .shade.
Draw a line segment on from to of color .
fb | Framebuffer to use as canvas |
point1 | Beginning of line segment |
point2 | End of line segment |
shade | Color of line segment |
Definition at line 333 of file framebuffer.h.
References _fb_draw_line().
Referenced by fb_draw_line_gradient().
|
inline |
Draw a line segment on from to .
Draw a line segment on from to .
fb | Framebuffer to use as canvas |
point1 | Beginning of line segment |
point2 | End of line segment |
Definition at line 347 of file framebuffer.h.
References fb_draw_line().
Referenced by _fb_draw_shape().
void fb_draw_shape | ( | framebuffer | , |
shape * | |||
) |
Using as a canvas, draw .
Using as a canvas, draw .
fb | Framebuffer to use as canvas |
sh | Shape to draw |
Definition at line 31 of file framebuffer.c.
References _fb_draw_shape(), null, shape::points, and point::shade.
Referenced by fb_draw_shape_arr(), and fb_draw_shapes().
void fb_draw_shape_arr | ( | framebuffer | , |
ushort | , | ||
shape ** | |||
) |
Method to draw an array of shapes on . Method to draw an array of shapes on .
fb | Framebuffer to use as canvas |
numShapes | Number of shapes to draw |
shape_arr | Array of shapes to draw |
Definition at line 68 of file framebuffer.c.
References fb_draw_shape().
void fb_draw_shapes | ( | framebuffer | , |
ushort | , | ||
... | |||
) |
Method to draw multiple shapes on . Method to draw multiple shapes on . Provide the number of shapes to draw for va_args.
fb | Framebuffer to use as canvas |
numShapes | Number of shapes to draw |
Definition at line 56 of file framebuffer.c.
References fb_draw_shape().
|
inline |
Draw string on fb starting at top_left_corner.
Draw string on starting at .
fb | Framebuffer to use as canvas |
top_left_corner | Coordinate of top left corner of string on fb |
string | Character array to draw |
Definition at line 115 of file framebuffer.h.
References _fb_draw_string().
|
inline |
Call fb_draw_string and destroy top_left_corner.
Call and destroy .
fb | Framebuffer to use as canvas |
top_left_corner | Coordinate of top left corner of string on fb. Will be destroyed. |
string | Character array to draw |
Definition at line 130 of file framebuffer.h.
References _fb_draw_string().
|
inline |
Erases a line connecting two points before destroys the two points.
Erases a line connecting two points before destroys the two points.
fb | Framebuffer to use as canvas |
point1 | One endpoint of the line to draw |
point2 | The other endpoint of the line to draw |
shade | Desired shade of the line on fb |
Definition at line 283 of file framebuffer.h.
References _fb_draw_line(), and FB_COLOR_ERASE.
void fb_erase_char | ( | framebuffer | , |
point * | , | ||
char | |||
) |
Erase char on fb starting at top_left_corner.
Erase char on
starting at .
fb | Framebuffer to use as canvas |
top_left_corner | Coordinate of top left corner on char on fb |
c | Char to erase from fb |
Definition at line 96 of file framebuffer.c.
References _fb_draw_char(), FB_COLOR_ERASE, point::shade, and shape_duplicate_point().
|
inline |
Call and free .
Call and free .
fb | Framebuffer to use as canvas |
top_left_corner | Coordinate of on char on . Will be destroyed. |
c | Char to erase from |
Definition at line 89 of file framebuffer.h.
|
inline |
Remove a line segment on from to .
Remove a line segment on from to .
fb | Framebuffer to use as canvas |
a | Beginning of line segment |
b | End of line segment |
Definition at line 299 of file framebuffer.h.
References _fb_draw_line(), and FB_COLOR_ERASE.
|
inline |
Erase pixel (x,y) in .
Erase pixel (x,y) in .
This is an alias for with a shade of zero.
fb | Framebuffer to use as canvas |
x | X coordinate |
y | Y coordinate |
Definition at line 256 of file framebuffer.h.
References fb_clear_pixel().
|
inline |
Using as a canvas, draw .
Using as a canvas, draw .
fb | Framebuffer to use as canvas |
sh | Shape to draw |
Definition at line 211 of file framebuffer.h.
References _fb_draw_shape(), and FB_COLOR_ERASE.
Referenced by fb_erase_shape_arr().
void fb_erase_shape_arr | ( | framebuffer | , |
ushort | , | ||
shape ** | |||
) |
Method to erase an array of shapes from . Method to erase an array of shapes from .
fb | Framebuffer to use as canvas |
numShapes | Number of shapes to erase |
shape_arr | Array containing shapes to erase |
Definition at line 76 of file framebuffer.c.
References fb_erase_shape().
void fb_erase_string | ( | framebuffer | , |
point * | , | ||
char * | |||
) |
Erase string on fb starting at top_left_corner.
Erase on starting at .
fb | Framebuffer to use as canvas |
top_left_corner | Coordinate of top left corner of string on fb |
string | String to erase from fb |
Definition at line 260 of file framebuffer.c.
References _fb_draw_string(), FB_COLOR_ERASE, point::shade, and shape_duplicate_point().
Referenced by fb_erase_string_anon().
|
inline |
Erase string on fb starting at top_left_corner and free top_left_corner.
Call and free .
fb | Framebuffer to use as canvas |
top_left_corner | Coordinate of top left corner of string on fb |
string | String to erase from fb |
Definition at line 55 of file framebuffer.h.
References fb_erase_string().
framebuffer fb_init | ( | void | ) |
Create a framebuffer object and return the handle.
Create a framebuffer object and return the handle.
Definition at line 11 of file framebuffer.c.
References OLED_HEIGHT, and OLED_WIDTH.
void fb_set_pixel | ( | framebuffer | , |
uchar | , | ||
uchar | , | ||
shade_t | |||
) |
In fb, set pixel (x,y) to .
In , set pixel (x,y) to .
fb | Framebuffer to use as canvas |
x | X coordinate |
y | Y coordinate |
shade | Shade to set pixel |
Definition at line 84 of file framebuffer.c.
References fb_console_println_coordinate(), FB_HEIGHT, and FB_WIDTH.
Referenced by _fb_draw_char(), _fb_draw_line(), _fb_fill_four_ellipse_points(), _fb_plot_four_ellipse_points(), fb_clear_pixel(), and fb_draw_ellipse_fill().