|
VKVG
Vulkan Vector Graphics
|
Main header of the VKVG library. More...
#include <stdint.h>#include <stddef.h>#include <vulkan/vulkan.h>#include <stdbool.h>

Go to the source code of this file.
Data Structures | |
| struct | vkvg_color_t |
| struct | vkvg_font_extents_t |
| font metrics More... | |
| struct | vkvg_text_extents_t |
| text metrics More... | |
| struct | vkvg_glyph_info_t |
| glyphs position in a VkvgText More... | |
| struct | vkvg_matrix_t |
| vkvg matrix structure More... | |
| struct | vkvg_device_create_info_t |
| vkvg device creation structure More... | |
Macros | |
| #define | VKVG_LOG_ERR 0x00000001 |
| #define | VKVG_LOG_DEBUG 0x00000002 |
| #define | VKVG_LOG_INFO_PTS 0x00000004 |
| #define | VKVG_LOG_INFO_PATH 0x00000008 |
| #define | VKVG_LOG_INFO_CMD 0x00000010 |
| #define | VKVG_LOG_INFO_VBO 0x00000020 |
| #define | VKVG_LOG_INFO_IBO 0x00000040 |
| #define | VKVG_LOG_INFO_VAO (VKVG_LOG_INFO_VBO | VKVG_LOG_INFO_IBO) |
| #define | VKVG_LOG_THREAD 0x00000080 |
| #define | VKVG_LOG_DBG_ARRAYS 0x00001000 |
| #define | VKVG_LOG_STROKE 0x00010000 |
| #define | VKVG_LOG_FULL 0xffffffff |
| #define | VKVG_LOG_INFO 0x00008000 |
| #define | VKVG_IDENTITY_MATRIX (vkvg_matrix_t){1, 0, 0, 1, 0, 0} |
Typedefs | |
| typedef struct _vkvg_text_run_t * | VkvgText |
| Opaque pointer on a vkvg text run. | |
| typedef struct _vkvg_context_t * | VkvgContext |
| The Vkvg drawing Context. | |
| typedef struct _vkvg_surface_t * | VkvgSurface |
| Opaque pointer on a Vkvg Surface structure. | |
| typedef struct _vkvg_device_t * | VkvgDevice |
| Opaque pointer on a Vkvg device structure. | |
| typedef struct _vkvg_pattern_t * | VkvgPattern |
| Opaque pointer on a Vkvg pattern structure. | |
Enumerations | |
| enum | vkvg_status_t |
| vkvg operation status. More... | |
| enum | vkvg_direction_t |
| enum | vkvg_format_t |
| enum | vkvg_extend_t |
| pattern border policy More... | |
| enum | vkvg_filter_t |
| enum | vkvg_pattern_type_t |
| pattern types More... | |
| enum | vkvg_line_cap_t |
| line caps More... | |
| enum | vkvg_line_join_t |
| lines articulations More... | |
| enum | vkvg_fill_rule_t |
| path fill method. More... | |
| enum | vkvg_operator_t |
| compositing operators More... | |
Functions | |
| void | vkvg_matrix_init_identity (vkvg_matrix_t *matrix) |
| Set matrix to identity. | |
| void | vkvg_matrix_init (vkvg_matrix_t *matrix, float xx, float yx, float xy, float yy, float x0, float y0) |
| Matrix initialization. | |
| void | vkvg_matrix_init_translate (vkvg_matrix_t *matrix, float tx, float ty) |
| Rotation matrix initialization. | |
| void | vkvg_matrix_init_scale (vkvg_matrix_t *matrix, float sx, float sy) |
| scaling matrix initialization | |
| void | vkvg_matrix_init_rotate (vkvg_matrix_t *matrix, float radians) |
| rotation matrix initialization | |
| void | vkvg_matrix_translate (vkvg_matrix_t *matrix, float tx, float ty) |
| apply translation on matrix | |
| void | vkvg_matrix_scale (vkvg_matrix_t *matrix, float sx, float sy) |
| apply scale on matrix | |
| void | vkvg_matrix_rotate (vkvg_matrix_t *matrix, float radians) |
| apply rotation on matrix | |
| void | vkvg_matrix_multiply (vkvg_matrix_t *result, const vkvg_matrix_t *a, const vkvg_matrix_t *b) |
| matrices multiplication | |
| void | vkvg_matrix_transform_distance (const vkvg_matrix_t *matrix, float *dx, float *dy) |
| transform distances | |
| void | vkvg_matrix_transform_point (const vkvg_matrix_t *matrix, float *x, float *y) |
| transform point | |
| vkvg_status_t | vkvg_matrix_invert (vkvg_matrix_t *matrix) |
| invert matrix | |
| void | vkvg_matrix_get_scale (const vkvg_matrix_t *matrix, float *sx, float *sy) |
| void | vkvg_device_set_context_cache_size (VkvgDevice dev, uint32_t maxCount) |
| Set maximum cached context count. | |
| VkvgDevice | vkvg_device_create (vkvg_device_create_info_t *info) |
| Create a new vkvg device. | |
| void | vkvg_device_destroy (VkvgDevice dev) |
| Create a new vkvg device from an existing vulkan logical device. | |
| vkvg_status_t | vkvg_device_status (VkvgDevice dev) |
| Get the current status of the device. | |
| VkvgDevice | vkvg_device_reference (VkvgDevice dev) |
| Increment the reference count on this device. | |
| uint32_t | vkvg_device_get_reference_count (VkvgDevice dev) |
| Query the reference count of the device. | |
| void | vkvg_device_set_dpy (VkvgDevice dev, int hdpy, int vdpy) |
| Set the screen dot per inch for this device. | |
| void | vkvg_device_get_dpy (VkvgDevice dev, int *hdpy, int *vdpy) |
| Get the current dpy values. | |
| void | vkvg_get_required_instance_extensions (const char **pExtensions, uint32_t *pExtCount) |
| query required instance extensions for vkvg. | |
| vkvg_status_t | vkvg_get_required_device_extensions (VkPhysicalDevice phy, const char **pExtensions, uint32_t *pExtCount) |
| query required device extensions for vkvg. | |
| const void * | vkvg_get_device_requirements (VkPhysicalDeviceFeatures *pEnabledFeatures) |
| get vulkan device creation requirement to fit vkvg needs. | |
| VkvgSurface | vkvg_surface_create (VkvgDevice dev, uint32_t width, uint32_t height) |
| Create a new vkvg surface. | |
| VkvgSurface | vkvg_surface_create_from_image (VkvgDevice dev, const char *filePath) |
| Create a new vkvg surface by loading an image file. The resulting surface will have the same dimension as the supplied image. This method will always return a valid pointer. | |
| VkvgSurface | vkvg_surface_create_for_VkhImage (VkvgDevice dev, void *vkhImg) |
| Create a new vkvg surface using an existing vulkan texture as backend. This method will always return a valid pointer. | |
| VkvgSurface | vkvg_surface_create_from_bitmap (VkvgDevice dev, unsigned char *img, uint32_t width, uint32_t height) |
| Create a new vkvg surface from an in memory rgba bitmap. | |
| vkvg_status_t | vkvg_surface_status (VkvgSurface surf) |
| Get the current status of the surface. | |
| VkvgSurface | vkvg_surface_reference (VkvgSurface surf) |
| Increment reference count on the surface by one. | |
| uint32_t | vkvg_surface_get_reference_count (VkvgSurface surf) |
| Get the current reference count on this surface. | |
| void | vkvg_surface_destroy (VkvgSurface surf) |
| Decrement the reference count on the surface by one. Destroy it if count reach 0. | |
| void | vkvg_surface_clear (VkvgSurface surf) |
| Clear surface's content. | |
| VkImage | vkvg_surface_get_vk_image (VkvgSurface surf) |
| Get the final single sampled vulkan image of this surface. | |
| VkFormat | vkvg_surface_get_vk_format (VkvgSurface surf) |
| Get the vulkan format of the vulkan texture used as backend for this surface. | |
| uint32_t | vkvg_surface_get_width (VkvgSurface surf) |
| Get the actual surface width. | |
| uint32_t | vkvg_surface_get_height (VkvgSurface surf) |
| Get the actual surface height. | |
| vkvg_status_t | vkvg_surface_write_to_png (VkvgSurface surf, const char *path) |
| Write surface content to a png file on disk. | |
| vkvg_status_t | vkvg_surface_write_to_memory (VkvgSurface surf, unsigned char *const bitmap) |
| Save surface to memory. | |
| void | vkvg_surface_resolve (VkvgSurface surf) |
| Explicitly resolve a multisampled surface. | |
| VkvgContext | vkvg_create (VkvgSurface surf) |
| Create a new vkvg context used for drawing on surfaces. | |
| void | vkvg_destroy (VkvgContext ctx) |
| Destroy vkvg context. | |
| vkvg_status_t | vkvg_status (VkvgContext ctx) |
| Get context status. | |
| const char * | vkvg_status_to_string (vkvg_status_t status) |
| VkvgContext | vkvg_reference (VkvgContext ctx) |
| Increment by one the reference count on this context. | |
| uint32_t | vkvg_get_reference_count (VkvgContext ctx) |
| Get the current reference count of this context. | |
| void | vkvg_flush (VkvgContext ctx) |
| Perform all the pending drawing operations on a context. | |
| void | vkvg_new_path (VkvgContext ctx) |
| Start a new empty path. | |
| void | vkvg_close_path (VkvgContext ctx) |
| Close the current path. | |
| void | vkvg_new_sub_path (VkvgContext ctx) |
| Start a new sub path. | |
| void | vkvg_path_extents (VkvgContext ctx, float *const x1, float *const y1, float *const x2, float *const y2) |
| vkvg_path_extents | |
| void | vkvg_get_current_point (VkvgContext ctx, float *x, float *y) |
| Get the current point. | |
| void | vkvg_line_to (VkvgContext ctx, float x, float y) |
| Add a line to the current path from the current point to the coordinate given in arguments. | |
| void | vkvg_rel_line_to (VkvgContext ctx, float dx, float dy) |
| Add a line to the current path from the current point to the coordinate relative to it. | |
| void | vkvg_move_to (VkvgContext ctx, float x, float y) |
| Move the context pen to the position given in argument. | |
| void | vkvg_rel_move_to (VkvgContext ctx, float x, float y) |
| Move the context pen relative to the current point. | |
| void | vkvg_arc (VkvgContext ctx, float xc, float yc, float radius, float a1, float a2) |
| Adds a circular arc of the given radius to the current path. | |
| void | vkvg_arc_negative (VkvgContext ctx, float xc, float yc, float radius, float a1, float a2) |
| Add a circular arc in counter clockwise order to the current path. | |
| void | vkvg_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2, float x3, float y3) |
| Adds a cubic Bézier spline to the current path. | |
| void | vkvg_rel_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2, float x3, float y3) |
| Adds a cubic Bézier spline to the current path relative to the current point. | |
| void | vkvg_quadratic_to (VkvgContext ctx, float x1, float y1, float x2, float y2) |
| Add a quadratic Bezizer curve to the current path. | |
| void | vkvg_rel_quadratic_to (VkvgContext ctx, float x1, float y1, float x2, float y2) |
| Add a quadratic Bezizer curve to the current path relative to the current point. | |
| vkvg_status_t | vkvg_rectangle (VkvgContext ctx, float x, float y, float w, float h) |
| Add an axis aligned rectangle subpath to the current path. | |
| vkvg_status_t | vkvg_rounded_rectangle (VkvgContext ctx, float x, float y, float w, float h, float radius) |
| Add an axis aligned rectangle with rounded corners to the current path. | |
| void | vkvg_rounded_rectangle2 (VkvgContext ctx, float x, float y, float w, float h, float rx, float ry) |
| Add an axis aligned rectangle with rounded corners defined in both axis to the current path. | |
| void | vkvg_ellipse (VkvgContext ctx, float radiusX, float radiusY, float x, float y, float rotationAngle) |
| Add a closed ellipse to the current path. | |
| void | vkvg_elliptic_arc_to (VkvgContext ctx, float x, float y, bool large_arc_flag, bool sweep_flag, float rx, float ry, float phi) |
| Add an elliptical arc to the current path. | |
| void | vkvg_rel_elliptic_arc_to (VkvgContext ctx, float x, float y, bool large_arc_flag, bool sweep_flag, float rx, float ry, float phi) |
| Add an elliptical arc to the current path. | |
| void | vkvg_stroke (VkvgContext ctx) |
| Stroke command. | |
| void | vkvg_stroke_preserve (VkvgContext ctx) |
| Stroke command that preserve current path. | |
| void | vkvg_fill (VkvgContext ctx) |
| Fill command. | |
| void | vkvg_fill_preserve (VkvgContext ctx) |
| Fill command that preserve current path. | |
| void | vkvg_paint (VkvgContext ctx) |
| Paint command. | |
| void | vkvg_clear (VkvgContext ctx) |
| Clear surface. | |
| void | vkvg_reset_clip (VkvgContext ctx) |
| Reset the current clip region. | |
| void | vkvg_clip (VkvgContext ctx) |
| Establishes a new clip region. | |
| void | vkvg_clip_preserve (VkvgContext ctx) |
| Establishes a new clip region preserving the current path. | |
| void | vkvg_set_opacity (VkvgContext ctx, float opacity) |
| Set global opacity for drawing operations. | |
| float | vkvg_get_opacity (VkvgContext ctx) |
| Get current opacity. | |
| void | vkvg_set_source_color (VkvgContext ctx, uint32_t c) |
| Set current source for drawing to the solid color defined by the supplied 32bit integer. | |
| void | vkvg_set_source_rgba (VkvgContext ctx, float r, float g, float b, float a) |
| set color with alpha. | |
| void | vkvg_set_source_rgb (VkvgContext ctx, float r, float g, float b) |
| set opaque color as new source. | |
| void | vkvg_set_source_surface (VkvgContext ctx, VkvgSurface surf, float x, float y) |
| use supplied surface as current pattern. | |
| void | vkvg_set_source (VkvgContext ctx, VkvgPattern pat) |
| set supplied pattern as current source. | |
| void | vkvg_set_line_width (VkvgContext ctx, float width) |
| set line width for the next draw command. | |
| void | vkvg_set_miter_limit (VkvgContext ctx, float limit) |
| set line join miter size limit. | |
| float | vkvg_get_miter_limit (VkvgContext ctx) |
| Gets the current miter limit. | |
| void | vkvg_set_line_cap (VkvgContext ctx, vkvg_line_cap_t cap) |
| set line terminations for the next draw command. | |
| void | vkvg_set_line_join (VkvgContext ctx, vkvg_line_join_t join) |
| set line joins for the next draw command. | |
| void | vkvg_set_operator (VkvgContext ctx, vkvg_operator_t op) |
| void | vkvg_set_fill_rule (VkvgContext ctx, vkvg_fill_rule_t fr) |
| void | vkvg_set_dash (VkvgContext ctx, const float *dashes, uint32_t num_dashes, float offset) |
| set the dash configuration for strokes | |
| void | vkvg_get_dash (VkvgContext ctx, const float *dashes, uint32_t *num_dashes, float *offset) |
| get current dash settings. | |
| float | vkvg_get_line_width (VkvgContext ctx) |
| get current line width | |
| vkvg_line_cap_t | vkvg_get_line_cap (VkvgContext ctx) |
| vkvg_line_join_t | vkvg_get_line_join (VkvgContext ctx) |
| vkvg_operator_t | vkvg_get_operator (VkvgContext ctx) |
| vkvg_fill_rule_t | vkvg_get_fill_rule (VkvgContext ctx) |
| Get current fill rule. | |
| VkvgPattern | vkvg_get_source (VkvgContext ctx) |
| Get the current source of the context. | |
| VkvgSurface | vkvg_get_target (VkvgContext ctx) |
| Get the current target of the context. | |
| bool | vkvg_has_current_point (VkvgContext ctx) |
| Check if context has a current point defined. | |
| void | vkvg_save (VkvgContext ctx) |
| Save context's graphic states. | |
| void | vkvg_restore (VkvgContext ctx) |
| Restore context's graphic states. | |
| void | vkvg_translate (VkvgContext ctx, float dx, float dy) |
| Add a translation to the current transformation matrix. | |
| void | vkvg_scale (VkvgContext ctx, float sx, float sy) |
| Add a scaling transform to the current transformation matrix. | |
| void | vkvg_rotate (VkvgContext ctx, float radians) |
| Add a rotation to the current transformation matrix. | |
| void | vkvg_transform (VkvgContext ctx, const vkvg_matrix_t *matrix) |
| Add an additional transformation to the current matrix. | |
| void | vkvg_set_matrix (VkvgContext ctx, const vkvg_matrix_t *matrix) |
| Set the current matrix. | |
| void | vkvg_get_matrix (VkvgContext ctx, vkvg_matrix_t *const matrix) |
| Get the current matrix. | |
| void | vkvg_identity_matrix (VkvgContext ctx) |
| Set the current matrix to identity. | |
| void | vkvg_select_font_face (VkvgContext ctx, const char *name) |
| Try find font with the specified name using the FontConfig library. | |
| void | vkvg_load_font_from_path (VkvgContext ctx, const char *path, const char *name) |
| Select a new font by providing its file path. | |
| void | vkvg_load_font_from_memory (VkvgContext ctx, unsigned char *fontBuffer, long fontBufferByteSize, const char *name) |
| Select a new font by providing a pointer on the font file loaded in memory and its size in byte. | |
| void | vkvg_set_font_size (VkvgContext ctx, uint32_t size) |
| void | vkvg_show_text (VkvgContext ctx, const char *utf8) |
| Show a string of text. | |
| void | vkvg_text_extents (VkvgContext ctx, const char *utf8, vkvg_text_extents_t *extents) |
| Gets the extents for a string of text. | |
| void | vkvg_font_extents (VkvgContext ctx, vkvg_font_extents_t *extents) |
| Gets the font extents for the currently selected font. | |
| VkvgText | vkvg_text_run_create (VkvgContext ctx, const char *text) |
| Create a new text run. | |
| VkvgText | vkvg_text_run_create_with_length (VkvgContext ctx, const char *text, uint32_t length) |
| Create a new text run for a non null terminated string. | |
| void | vkvg_text_run_destroy (VkvgText textRun) |
| Release resources holded by the text run. | |
| void | vkvg_show_text_run (VkvgContext ctx, VkvgText textRun) |
| void | vkvg_text_run_get_extents (VkvgText textRun, vkvg_text_extents_t *extents) |
| uint32_t | vkvg_text_run_get_glyph_count (VkvgText textRun) |
| Get glyph count of text run. | |
| void | vkvg_text_run_get_glyph_position (VkvgText textRun, uint32_t index, vkvg_glyph_info_t *pGlyphInfo) |
| retrieve glyph positions. | |
| vkvg_status_t | vkvg_pattern_status (VkvgPattern pat) |
| Get pattern current status. | |
| VkvgPattern | vkvg_pattern_reference (VkvgPattern pat) |
| add reference | |
| uint32_t | vkvg_pattern_get_reference_count (VkvgPattern pat) |
| get reference count | |
| VkvgPattern | vkvg_pattern_create_for_surface (VkvgSurface surf) |
| create a surface pattern | |
| VkvgPattern | vkvg_pattern_create_linear (float x0, float y0, float x1, float y1) |
| create a new linear gradient. | |
| vkvg_status_t | vkvg_pattern_edit_linear (VkvgPattern pat, float x0, float y0, float x1, float y1) |
| edit an existing linear gradient. | |
| vkvg_status_t | vkvg_pattern_get_linear_points (VkvgPattern pat, float *x0, float *y0, float *x1, float *y1) |
| get the gradient end points for a linear gradient | |
| VkvgPattern | vkvg_pattern_create_radial (float cx0, float cy0, float radius0, float cx1, float cy1, float radius1) |
| create a new radial gradient. | |
| vkvg_status_t | vkvg_pattern_edit_radial (VkvgPattern pat, float cx0, float cy0, float radius0, float cx1, float cy1, float radius1) |
| edit an existing radial gradient. | |
| vkvg_status_t | vkvg_pattern_get_color_stop_count (VkvgPattern pat, uint32_t *count) |
| get color stop count. | |
| vkvg_status_t | vkvg_pattern_get_color_stop_rgba (VkvgPattern pat, uint32_t index, float *offset, float *r, float *g, float *b, float *a) |
| get color stop. | |
| void | vkvg_pattern_destroy (VkvgPattern pat) |
| dispose pattern. | |
| vkvg_status_t | vkvg_pattern_add_color_stop (VkvgPattern pat, float offset, float r, float g, float b, float a) |
| add colors to gradients | |
| void | vkvg_pattern_set_extend (VkvgPattern pat, vkvg_extend_t extend) |
| control the extend of the pattern | |
| void | vkvg_pattern_set_filter (VkvgPattern pat, vkvg_filter_t filter) |
| control the filtering when using this pattern on a surface. | |
| vkvg_extend_t | vkvg_pattern_get_extend (VkvgPattern pat) |
| query the current extend value for a pa | |
| vkvg_filter_t | vkvg_pattern_get_filter (VkvgPattern pat) |
| vkvg_pattern_type_t | vkvg_pattern_get_type (VkvgPattern pat) |
| get pattern type | |
| void | vkvg_pattern_set_matrix (VkvgPattern pat, const vkvg_matrix_t *matrix) |
| void | vkvg_pattern_get_matrix (VkvgPattern pat, vkvg_matrix_t *matrix) |
| void | vkvg_set_source_color_name (VkvgContext ctx, const char *color) |
This is the header file of the VKVG library. It defines all its types and declares all its functions.
To start drawing with vkvg, simply include this header.
Definition in file vkvg.h.