#include <stdlib.h>
#include <stdbool.h>
#include <cairo/cairo.h>
Go to the source code of this file.
Classes | |
struct | dr2d_color |
Structure representing an RGBA color. Color components are specified in the range of 0 - 255. More... | |
struct | dr2d_context |
struct | dr2d_draw_image_args |
struct | dr2d_drawing_callbacks |
struct | dr2d_font |
struct | dr2d_font_metrics |
struct | dr2d_glyph_metrics |
struct | dr2d_image |
struct | dr2d_surface |
Macros | |
#define | DR2D_FONT_NO_CLEARTYPE (1 << 0) |
#define | DR2D_IMAGE_DRAW_BACKGROUND (1 << 0) |
#define | DR2D_IMAGE_HINT_NO_ALPHA (1 << 1) |
#define | DR2D_MAX_FONT_FAMILY_LENGTH 128 |
#define | DR2D_NO_GDI |
#define | DR2D_READ (1 << 0) |
#define | DR2D_WRITE (1 << 1) |
Typedefs | |
typedef void(* | dr2d_begin_draw_proc) (dr2d_surface *pSurface) |
typedef unsigned char | dr2d_byte |
typedef void(* | dr2d_clear_proc) (dr2d_surface *pSurface, dr2d_color color) |
typedef struct dr2d_color | dr2d_color |
typedef struct dr2d_context | dr2d_context |
typedef void(* | dr2d_draw_image_proc) (dr2d_surface *pSurface, dr2d_image *pImage, dr2d_draw_image_args *pArgs) |
typedef void(* | dr2d_draw_rect_outline_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float outlineWidth) |
typedef void(* | dr2d_draw_rect_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color) |
typedef void(* | dr2d_draw_rect_with_outline_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float outlineWidth, dr2d_color outlineColor) |
typedef void(* | dr2d_draw_round_rect_outline_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float width, float outlineWidth) |
typedef void(* | dr2d_draw_round_rect_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float width) |
typedef void(* | dr2d_draw_round_rect_with_outline_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float width, float outlineWidth, dr2d_color outlineColor) |
typedef void(* | dr2d_draw_text_proc) (dr2d_surface *pSurface, dr2d_font *pFont, const char *text, size_t textSizeInBytes, float posX, float posY, dr2d_color color, dr2d_color backgroundColor) |
typedef struct dr2d_drawing_callbacks | dr2d_drawing_callbacks |
typedef void(* | dr2d_end_draw_proc) (dr2d_surface *pSurface) |
typedef struct dr2d_font | dr2d_font |
typedef struct dr2d_font_metrics | dr2d_font_metrics |
typedef void(* | dr2d_get_clip_proc) (dr2d_surface *pSurface, float *pLeftOut, float *pTopOut, float *pRightOut, float *pBottomOut) |
typedef bool(* | dr2d_get_font_metrics_proc) (dr2d_font *pFont, dr2d_font_metrics *pMetricsOut) |
typedef bool(* | dr2d_get_glyph_metrics_proc) (dr2d_font *pFont, unsigned int utf32, dr2d_glyph_metrics *pMetricsOut) |
typedef dr2d_image_format(* | dr2d_get_optimal_image_format_proc) (dr2d_context *pContext) |
typedef bool(* | dr2d_get_text_cursor_position_from_char_proc) (dr2d_font *pFont, const char *text, size_t characterIndex, float *pTextCursorPosXOut) |
typedef bool(* | dr2d_get_text_cursor_position_from_point_proc) (dr2d_font *pFont, const char *text, size_t textSizeInBytes, float maxWidth, float inputPosX, float *pTextCursorPosXOut, size_t *pCharacterIndexOut) |
typedef struct dr2d_glyph_metrics | dr2d_glyph_metrics |
typedef struct dr2d_image | dr2d_image |
typedef void *(* | dr2d_map_image_data_proc) (dr2d_image *pImage, unsigned int accessFlags) |
typedef bool(* | dr2d_measure_string_proc) (dr2d_font *pFont, const char *text, size_t textSizeInBytes, float *pWidthOut, float *pHeightOut) |
typedef bool(* | dr2d_on_create_context_proc) (dr2d_context *pContext, const void *pUserData) |
typedef bool(* | dr2d_on_create_font_proc) (dr2d_font *pFont) |
typedef bool(* | dr2d_on_create_image_proc) (dr2d_image *pImage, unsigned int stride, const void *pData) |
typedef bool(* | dr2d_on_create_surface_proc) (dr2d_surface *pSurface, float width, float height) |
typedef void(* | dr2d_on_delete_context_proc) (dr2d_context *pContext) |
typedef void(* | dr2d_on_delete_font_proc) (dr2d_font *pFont) |
typedef void(* | dr2d_on_delete_image_proc) (dr2d_image *pImage) |
typedef void(* | dr2d_on_delete_surface_proc) (dr2d_surface *pSurface) |
typedef void(* | dr2d_set_clip_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom) |
typedef struct dr2d_surface | dr2d_surface |
typedef void(* | dr2d_unmap_image_data_proc) (dr2d_image *pImage) |
Functions | |
void | dr2d_begin_draw (dr2d_surface *pSurface) |
Marks the beginning of a paint operation. More... | |
void | dr2d_clear (dr2d_surface *pSurface, dr2d_color color) |
Clears the given surface with the given color. More... | |
dr2d_context * | dr2d_create_context (dr2d_drawing_callbacks drawingCallbacks, size_t contextExtraBytes, size_t surfaceExtraBytes, size_t fontExtraBytes, size_t imageExtraBytes, const void *pUserData) |
Creats a context. More... | |
dr2d_context * | dr2d_create_context_cairo () |
Creates a 2D context with Cairo as the backend. More... | |
dr2d_font * | dr2d_create_font (dr2d_context *pContext, const char *family, unsigned int size, dr2d_font_weight weight, dr2d_font_slant slant, float rotation, unsigned int flags) |
Creates a font that can be passed to dr2d_draw_text(). More... | |
dr2d_image * | dr2d_create_image (dr2d_context *pContext, unsigned int width, unsigned int height, dr2d_image_format format, unsigned int stride, const void *pData) |
dr2d_surface * | dr2d_create_surface (dr2d_context *pContext, float width, float height) |
Creates a surface. More... | |
dr2d_surface * | dr2d_create_surface_cairo (dr2d_context *pContext, cairo_t *cr) |
Creates a surface that draws directly to the given cairo context. More... | |
void | dr2d_delete_context (dr2d_context *pContext) |
Deletes the given context. More... | |
void | dr2d_delete_font (dr2d_font *pFont) |
Deletes a font that was previously created with dr2d_create_font() More... | |
void | dr2d_delete_image (dr2d_image *pImage) |
Deletes the given image. More... | |
void | dr2d_delete_surface (dr2d_surface *pSurface) |
Deletes the given surface. More... | |
void | dr2d_draw_image (dr2d_surface *pSurface, dr2d_image *pImage, dr2d_draw_image_args *pArgs) |
Draws an image. More... | |
void | dr2d_draw_rect (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color) |
Draws a filled rectangle without an outline. More... | |
void | dr2d_draw_rect_outline (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float outlineWidth) |
Draws the outline of the given rectangle. More... | |
void | dr2d_draw_rect_with_outline (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float outlineWidth, dr2d_color outlineColor) |
Draws a filled rectangle with an outline. More... | |
void | dr2d_draw_round_rect (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float radius) |
Draws a filled rectangle without an outline with rounded corners. More... | |
void | dr2d_draw_round_rect_outline (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float radius, float outlineWidth) |
Draws the outline of the given rectangle with rounded corners. More... | |
void | dr2d_draw_round_rect_with_outline (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float radius, float outlineWidth, dr2d_color outlineColor) |
Draws a filled rectangle with an outline. More... | |
void | dr2d_draw_text (dr2d_surface *pSurface, dr2d_font *pFont, const char *text, size_t textSizeInBytes, float posX, float posY, dr2d_color color, dr2d_color backgroundColor) |
Draws a run of text. More... | |
void | dr2d_end_draw (dr2d_surface *pSurface) |
Marks the end of a paint operation. More... | |
cairo_surface_t * | dr2d_get_cairo_surface_t (dr2d_surface *pSurface) |
cairo_t * | dr2d_get_cairo_t (dr2d_surface *pSurface) |
Retrieves the internal cairo_t object from the given surface. More... | |
void | dr2d_get_clip (dr2d_surface *pSurface, float *pLeftOut, float *pTopOut, float *pRightOut, float *pBottomOut) |
Retrieves the clipping rectangle. More... | |
void * | dr2d_get_context_extra_data (dr2d_context *pContext) |
Retrieves a pointer to the given context's extra data buffer. More... | |
void * | dr2d_get_font_extra_data (dr2d_font *pFont) |
Retrieves a pointer to the given font's extra data buffer. More... | |
bool | dr2d_get_font_metrics (dr2d_font *pFont, dr2d_font_metrics *pMetricsOut) |
Retrieves the metrics of the given font. More... | |
unsigned int | dr2d_get_font_size (dr2d_font *pFont) |
Retrieves the size of the given font. More... | |
bool | dr2d_get_glyph_metrics (dr2d_font *pFont, unsigned int utf32, dr2d_glyph_metrics *pMetricsOut) |
Retrieves the metrics of the glyph for the given character when rendered with the given font. More... | |
void * | dr2d_get_image_extra_data (dr2d_image *pImage) |
Retrieves a pointer to the given image's extra data buffer. More... | |
void | dr2d_get_image_size (dr2d_image *pImage, unsigned int *pWidthOut, unsigned int *pHeightOut) |
Retrieves the size of the given image. More... | |
dr2d_image_format | dr2d_get_optimal_image_format (dr2d_context *pContext) |
Retrieves the optimal image format for the given context. This depends on the backend. More... | |
void * | dr2d_get_surface_extra_data (dr2d_surface *pSurface) |
Retrieves a pointer to the given surface's extra data buffer. More... | |
float | dr2d_get_surface_height (const dr2d_surface *pSurface) |
Retrieves the height of the surface. More... | |
float | dr2d_get_surface_width (const dr2d_surface *pSurface) |
Retrieves the width of the surface. More... | |
bool | dr2d_get_text_cursor_position_from_char (dr2d_font *pFont, const char *text, size_t characterIndex, float *pTextCursorPosXOut) |
Retrieves the position to palce a text cursor based on the character at the given index for the given string when drawn with the given font. More... | |
bool | dr2d_get_text_cursor_position_from_point (dr2d_font *pFont, const char *text, size_t textSizeInBytes, float maxWidth, float inputPosX, float *pTextCursorPosXOut, size_t *pCharacterIndexOut) |
Retrieves the position to place a text cursor based on the given point for the given string when drawn with the given font. More... | |
void * | dr2d_map_image_data (dr2d_image *pImage, unsigned int accessFlags) |
bool | dr2d_measure_string (dr2d_font *pFont, const char *text, size_t textSizeInBytes, float *pWidthOut, float *pHeightOut) |
Retrieves the dimensions of the given string when drawn with the given font. More... | |
dr2d_color | dr2d_rgb (dr2d_byte r, dr2d_byte g, dr2d_byte b) |
Creates a fully opaque color object from a set of RGB color components. More... | |
dr2d_color | dr2d_rgba (dr2d_byte r, dr2d_byte g, dr2d_byte b, dr2d_byte a) |
Creates a color object from a set of RGBA color components. More... | |
void | dr2d_set_clip (dr2d_surface *pSurface, float left, float top, float right, float bottom) |
Sets the clipping rectangle. More... | |
void | dr2d_unmap_image_data (dr2d_image *pImage) |
#define DR2D_FONT_NO_CLEARTYPE (1 << 0) |
Definition at line 157 of file rhino/demo/c/dr_libs/old/dr_2d.h.
#define DR2D_IMAGE_DRAW_BACKGROUND (1 << 0) |
Definition at line 151 of file rhino/demo/c/dr_libs/old/dr_2d.h.
#define DR2D_IMAGE_HINT_NO_ALPHA (1 << 1) |
Definition at line 152 of file rhino/demo/c/dr_libs/old/dr_2d.h.
#define DR2D_MAX_FONT_FAMILY_LENGTH 128 |
Definition at line 62 of file rhino/demo/c/dr_libs/old/dr_2d.h.
#define DR2D_NO_GDI |
Definition at line 57 of file rhino/demo/c/dr_libs/old/dr_2d.h.
#define DR2D_READ (1 << 0) |
Definition at line 154 of file rhino/demo/c/dr_libs/old/dr_2d.h.
#define DR2D_WRITE (1 << 1) |
Definition at line 155 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_begin_draw_proc) (dr2d_surface *pSurface) |
Definition at line 208 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef unsigned char dr2d_byte |
Definition at line 77 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_clear_proc) (dr2d_surface *pSurface, dr2d_color color) |
Definition at line 210 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef struct dr2d_color dr2d_color |
Definition at line 83 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef struct dr2d_context dr2d_context |
Definition at line 79 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_draw_image_proc) (dr2d_surface *pSurface, dr2d_image *pImage, dr2d_draw_image_args *pArgs) |
Definition at line 218 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_draw_rect_outline_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float outlineWidth) |
Definition at line 212 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_draw_rect_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color) |
Definition at line 211 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_draw_rect_with_outline_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float outlineWidth, dr2d_color outlineColor) |
Definition at line 213 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_draw_round_rect_outline_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float width, float outlineWidth) |
Definition at line 215 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_draw_round_rect_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float width) |
Definition at line 214 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_draw_round_rect_with_outline_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom, dr2d_color color, float width, float outlineWidth, dr2d_color outlineColor) |
Definition at line 216 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_draw_text_proc) (dr2d_surface *pSurface, dr2d_font *pFont, const char *text, size_t textSizeInBytes, float posX, float posY, dr2d_color color, dr2d_color backgroundColor) |
Definition at line 217 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef struct dr2d_drawing_callbacks dr2d_drawing_callbacks |
Definition at line 86 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_end_draw_proc) (dr2d_surface *pSurface) |
Definition at line 209 of file rhino/demo/c/dr_libs/old/dr_2d.h.
Definition at line 81 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef struct dr2d_font_metrics dr2d_font_metrics |
Definition at line 84 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_get_clip_proc) (dr2d_surface *pSurface, float *pLeftOut, float *pTopOut, float *pRightOut, float *pBottomOut) |
Definition at line 220 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef bool(* dr2d_get_font_metrics_proc) (dr2d_font *pFont, dr2d_font_metrics *pMetricsOut) |
Definition at line 224 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef bool(* dr2d_get_glyph_metrics_proc) (dr2d_font *pFont, unsigned int utf32, dr2d_glyph_metrics *pMetricsOut) |
Definition at line 225 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef dr2d_image_format(* dr2d_get_optimal_image_format_proc) (dr2d_context *pContext) |
Definition at line 221 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef bool(* dr2d_get_text_cursor_position_from_char_proc) (dr2d_font *pFont, const char *text, size_t characterIndex, float *pTextCursorPosXOut) |
Definition at line 228 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef bool(* dr2d_get_text_cursor_position_from_point_proc) (dr2d_font *pFont, const char *text, size_t textSizeInBytes, float maxWidth, float inputPosX, float *pTextCursorPosXOut, size_t *pCharacterIndexOut) |
Definition at line 227 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef struct dr2d_glyph_metrics dr2d_glyph_metrics |
Definition at line 85 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef struct dr2d_image dr2d_image |
Definition at line 82 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void*(* dr2d_map_image_data_proc) (dr2d_image *pImage, unsigned int accessFlags) |
Definition at line 222 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef bool(* dr2d_measure_string_proc) (dr2d_font *pFont, const char *text, size_t textSizeInBytes, float *pWidthOut, float *pHeightOut) |
Definition at line 226 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef bool(* dr2d_on_create_context_proc) (dr2d_context *pContext, const void *pUserData) |
Definition at line 200 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef bool(* dr2d_on_create_font_proc) (dr2d_font *pFont) |
Definition at line 204 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef bool(* dr2d_on_create_image_proc) (dr2d_image *pImage, unsigned int stride, const void *pData) |
Definition at line 206 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef bool(* dr2d_on_create_surface_proc) (dr2d_surface *pSurface, float width, float height) |
Definition at line 202 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_on_delete_context_proc) (dr2d_context *pContext) |
Definition at line 201 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_on_delete_font_proc) (dr2d_font *pFont) |
Definition at line 205 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_on_delete_image_proc) (dr2d_image *pImage) |
Definition at line 207 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_on_delete_surface_proc) (dr2d_surface *pSurface) |
Definition at line 203 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_set_clip_proc) (dr2d_surface *pSurface, float left, float top, float right, float bottom) |
Definition at line 219 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef struct dr2d_surface dr2d_surface |
Definition at line 80 of file rhino/demo/c/dr_libs/old/dr_2d.h.
typedef void(* dr2d_unmap_image_data_proc) (dr2d_image *pImage) |
Definition at line 223 of file rhino/demo/c/dr_libs/old/dr_2d.h.
enum dr2d_font_slant |
Enumerator | |
---|---|
dr2d_font_slant_none | |
dr2d_font_slant_italic | |
dr2d_font_slant_oblique | |
dr2d_font_slant_none | |
dr2d_font_slant_italic | |
dr2d_font_slant_oblique |
Definition at line 135 of file rhino/demo/c/dr_libs/old/dr_2d.h.
enum dr2d_font_weight |
Definition at line 116 of file rhino/demo/c/dr_libs/old/dr_2d.h.
enum dr2d_image_format |
Enumerator | |
---|---|
dr2d_image_format_rgba8 | |
dr2d_image_format_bgra8 | |
dr2d_image_format_argb8 | |
dr2d_image_format_rgba8 | |
dr2d_image_format_bgra8 | |
dr2d_image_format_argb8 |
Definition at line 143 of file rhino/demo/c/dr_libs/old/dr_2d.h.
void dr2d_begin_draw | ( | dr2d_surface * | pSurface | ) |
Marks the beginning of a paint operation.
void dr2d_clear | ( | dr2d_surface * | pSurface, |
dr2d_color | color | ||
) |
Clears the given surface with the given color.
dr2d_context* dr2d_create_context | ( | dr2d_drawing_callbacks | drawingCallbacks, |
size_t | contextExtraBytes, | ||
size_t | surfaceExtraBytes, | ||
size_t | fontExtraBytes, | ||
size_t | imageExtraBytes, | ||
const void * | pUserData | ||
) |
Creats a context.
dr2d_context* dr2d_create_context_cairo | ( | ) |
Creates a 2D context with Cairo as the backend.
dr2d_font* dr2d_create_font | ( | dr2d_context * | pContext, |
const char * | family, | ||
unsigned int | size, | ||
dr2d_font_weight | weight, | ||
dr2d_font_slant | slant, | ||
float | rotation, | ||
unsigned int | flags | ||
) |
Creates a font that can be passed to dr2d_draw_text().
dr2d_image* dr2d_create_image | ( | dr2d_context * | pContext, |
unsigned int | width, | ||
unsigned int | height, | ||
dr2d_image_format | format, | ||
unsigned int | stride, | ||
const void * | pData | ||
) |
Creates an image that can be passed to dr2d_draw_image().
dr2d_surface* dr2d_create_surface | ( | dr2d_context * | pContext, |
float | width, | ||
float | height | ||
) |
Creates a surface.
dr2d_surface* dr2d_create_surface_cairo | ( | dr2d_context * | pContext, |
cairo_t * | cr | ||
) |
Creates a surface that draws directly to the given cairo context.
void dr2d_delete_context | ( | dr2d_context * | pContext | ) |
Deletes the given context.
void dr2d_delete_font | ( | dr2d_font * | pFont | ) |
Deletes a font that was previously created with dr2d_create_font()
void dr2d_delete_image | ( | dr2d_image * | pImage | ) |
Deletes the given image.
void dr2d_delete_surface | ( | dr2d_surface * | pSurface | ) |
Deletes the given surface.
void dr2d_draw_image | ( | dr2d_surface * | pSurface, |
dr2d_image * | pImage, | ||
dr2d_draw_image_args * | pArgs | ||
) |
Draws an image.
void dr2d_draw_rect | ( | dr2d_surface * | pSurface, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom, | ||
dr2d_color | color | ||
) |
Draws a filled rectangle without an outline.
void dr2d_draw_rect_outline | ( | dr2d_surface * | pSurface, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom, | ||
dr2d_color | color, | ||
float | outlineWidth | ||
) |
Draws the outline of the given rectangle.
void dr2d_draw_rect_with_outline | ( | dr2d_surface * | pSurface, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom, | ||
dr2d_color | color, | ||
float | outlineWidth, | ||
dr2d_color | outlineColor | ||
) |
Draws a filled rectangle with an outline.
void dr2d_draw_round_rect | ( | dr2d_surface * | pSurface, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom, | ||
dr2d_color | color, | ||
float | radius | ||
) |
Draws a filled rectangle without an outline with rounded corners.
void dr2d_draw_round_rect_outline | ( | dr2d_surface * | pSurface, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom, | ||
dr2d_color | color, | ||
float | radius, | ||
float | outlineWidth | ||
) |
Draws the outline of the given rectangle with rounded corners.
void dr2d_draw_round_rect_with_outline | ( | dr2d_surface * | pSurface, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom, | ||
dr2d_color | color, | ||
float | radius, | ||
float | outlineWidth, | ||
dr2d_color | outlineColor | ||
) |
Draws a filled rectangle with an outline.
void dr2d_draw_text | ( | dr2d_surface * | pSurface, |
dr2d_font * | pFont, | ||
const char * | text, | ||
size_t | textSizeInBytes, | ||
float | posX, | ||
float | posY, | ||
dr2d_color | color, | ||
dr2d_color | backgroundColor | ||
) |
Draws a run of text.
void dr2d_end_draw | ( | dr2d_surface * | pSurface | ) |
Marks the end of a paint operation.
cairo_surface_t* dr2d_get_cairo_surface_t | ( | dr2d_surface * | pSurface | ) |
Retrieves the internal cairo_surface_t object from the given surface.
cairo_t* dr2d_get_cairo_t | ( | dr2d_surface * | pSurface | ) |
Retrieves the internal cairo_t object from the given surface.
void dr2d_get_clip | ( | dr2d_surface * | pSurface, |
float * | pLeftOut, | ||
float * | pTopOut, | ||
float * | pRightOut, | ||
float * | pBottomOut | ||
) |
Retrieves the clipping rectangle.
void* dr2d_get_context_extra_data | ( | dr2d_context * | pContext | ) |
Retrieves a pointer to the given context's extra data buffer.
void* dr2d_get_font_extra_data | ( | dr2d_font * | pFont | ) |
Retrieves a pointer to the given font's extra data buffer.
bool dr2d_get_font_metrics | ( | dr2d_font * | pFont, |
dr2d_font_metrics * | pMetricsOut | ||
) |
Retrieves the metrics of the given font.
unsigned int dr2d_get_font_size | ( | dr2d_font * | pFont | ) |
Retrieves the size of the given font.
bool dr2d_get_glyph_metrics | ( | dr2d_font * | pFont, |
unsigned int | utf32, | ||
dr2d_glyph_metrics * | pMetricsOut | ||
) |
Retrieves the metrics of the glyph for the given character when rendered with the given font.
void* dr2d_get_image_extra_data | ( | dr2d_image * | pImage | ) |
Retrieves a pointer to the given image's extra data buffer.
void dr2d_get_image_size | ( | dr2d_image * | pImage, |
unsigned int * | pWidthOut, | ||
unsigned int * | pHeightOut | ||
) |
Retrieves the size of the given image.
dr2d_image_format dr2d_get_optimal_image_format | ( | dr2d_context * | pContext | ) |
Retrieves the optimal image format for the given context. This depends on the backend.
void* dr2d_get_surface_extra_data | ( | dr2d_surface * | pSurface | ) |
Retrieves a pointer to the given surface's extra data buffer.
float dr2d_get_surface_height | ( | const dr2d_surface * | pSurface | ) |
Retrieves the height of the surface.
float dr2d_get_surface_width | ( | const dr2d_surface * | pSurface | ) |
Retrieves the width of the surface.
bool dr2d_get_text_cursor_position_from_char | ( | dr2d_font * | pFont, |
const char * | text, | ||
size_t | characterIndex, | ||
float * | pTextCursorPosXOut | ||
) |
Retrieves the position to palce a text cursor based on the character at the given index for the given string when drawn with the given font.
bool dr2d_get_text_cursor_position_from_point | ( | dr2d_font * | pFont, |
const char * | text, | ||
size_t | textSizeInBytes, | ||
float | maxWidth, | ||
float | inputPosX, | ||
float * | pTextCursorPosXOut, | ||
size_t * | pCharacterIndexOut | ||
) |
Retrieves the position to place a text cursor based on the given point for the given string when drawn with the given font.
void* dr2d_map_image_data | ( | dr2d_image * | pImage, |
unsigned int | accessFlags | ||
) |
Retrieves a pointer to a buffer representing the given image's data.
Call dr2d_unmap_image_data() when you are done with this function.
Use this function to access an image's data. The returned pointer does not necessarilly point to the image's actual data, so when writing to this pointer, nothing is guaranteed to be updated until dr2d_unmap_image_data() is called.
The returned data will contain the image data at the time of the mapping.
This will fail if the image's data is already mapped.
bool dr2d_measure_string | ( | dr2d_font * | pFont, |
const char * | text, | ||
size_t | textSizeInBytes, | ||
float * | pWidthOut, | ||
float * | pHeightOut | ||
) |
Retrieves the dimensions of the given string when drawn with the given font.
dr2d_color dr2d_rgb | ( | dr2d_byte | r, |
dr2d_byte | g, | ||
dr2d_byte | b | ||
) |
Creates a fully opaque color object from a set of RGB color components.
dr2d_color dr2d_rgba | ( | dr2d_byte | r, |
dr2d_byte | g, | ||
dr2d_byte | b, | ||
dr2d_byte | a | ||
) |
Creates a color object from a set of RGBA color components.
void dr2d_set_clip | ( | dr2d_surface * | pSurface, |
float | left, | ||
float | top, | ||
float | right, | ||
float | bottom | ||
) |
Sets the clipping rectangle.
void dr2d_unmap_image_data | ( | dr2d_image * | pImage | ) |
Unmaps the given image's data.
A flush is done at this point to ensure the actual underlying image data is updated.