Functions to draw into a graphics context.
Use these drawing functions inside a Layer's .update_proc
drawing callback. A GContext
is passed into this callback as an argument. This GContext
can then be used with all of the drawing functions which are documented below. See Graphics Context for more information about the graphics context.
Please refer to Building User Interfaces chapter in Pebble Developer Guide (chapter "Layers" and "Graphics") for a conceptual overview of the drawing system, Layers and relevant code examples.
Other drawing functions and related documentation:
Draws a bitmap into the graphics context, inside the specified rectangle.
ctx | The destination graphics context in which to draw the bitmap |
bitmap | The bitmap to draw |
rect | The rectangle in which to draw the bitmap |
rect
is smaller than the size of the bitmap, the bitmap will be clipped on right and bottom edges. If the size of rect
is larger than the size of the bitmap, the bitmap will be tiled automatically in both horizontal and vertical directions, effectively drawing a repeating pattern. Draws the outline of a circle in the current stroke color.
ctx | The destination graphics context in which to draw |
p | The center point of the circle |
radius | The radius in pixels |
Draws a 1-pixel wide line in the current stroke color.
ctx | The destination graphics context in which to draw |
p0 | The starting point of the line |
p1 | The ending point of the line |
void graphics_draw_pixel | ( | GContext * | ctx, |
GPoint | point | ||
) |
Draws a pixel at given point in the current stroke color.
ctx | The destination graphics context in which to draw |
point | The point at which to draw the pixel |
void graphics_draw_rect | ( | GContext * | ctx, |
GRect | rect | ||
) |
Draws a 1-pixel wide rectangle outline in the current stroke color.
ctx | The destination graphics context in which to draw |
rect | The rectangle for which to draw the outline |
Draws the outline of a rounded rectangle in the current stroke color.
ctx | The destination graphics context in which to draw |
rect | The rectangle defining the dimensions of the rounded rectangle to draw |
radius | The corner radius in pixels |
Fills a circle in the current fill color.
ctx | The destination graphics context in which to draw |
p | The center point of the circle |
radius | The radius in pixels |
void graphics_fill_rect | ( | GContext * | ctx, |
GRect | rect, | ||
uint16_t | corner_radius, | ||
GCornerMask | corner_mask | ||
) |
Fills a retangle with the current fill color, optionally rounding all or a selection of its corners.
ctx | The destination graphics context in which to draw |
rect | The rectangle to fill |
corner_radius | The rounding radius of the corners in pixels (maximum is 8 pixels) |
corner_mask | Bitmask of the corners that need to be rounded. |
enum GCornerMask |
Bit mask values to specify the corners of a rectangle. The values can be combines using binary OR (|
), For example: the mask to indicate top left and bottom right corners can: be created as follows: (GCornerTopLeft | GCornerBottomRight)