VKVG
Vulkan Vector Graphics
|
The header of the VKVG library. More...
#include <vulkan/vulkan.h>
#include <math.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... | |
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_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. More... | |
typedef struct _vkvg_context_t * | VkvgContext |
The Vkvg drawing Context. More... | |
typedef struct _vkvg_surface_t * | VkvgSurface |
Opaque pointer on a Vkvg Surface structure. More... | |
typedef struct _vkvg_device_t * | VkvgDevice |
Opaque pointer on a Vkvg device structure. More... | |
typedef struct _vkvg_pattern_t * | VkvgPattern |
Opaque pointer on a Vkvg pattern structure. More... | |
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. More... | |
void | vkvg_matrix_init (vkvg_matrix_t *matrix, float xx, float yx, float xy, float yy, float x0, float y0) |
Matrix initialization. More... | |
void | vkvg_matrix_init_translate (vkvg_matrix_t *matrix, float tx, float ty) |
Rotation matrix initialization. More... | |
void | vkvg_matrix_init_scale (vkvg_matrix_t *matrix, float sx, float sy) |
scaling matrix initialization More... | |
void | vkvg_matrix_init_rotate (vkvg_matrix_t *matrix, float radians) |
rotation matrix initialization More... | |
void | vkvg_matrix_translate (vkvg_matrix_t *matrix, float tx, float ty) |
apply translation on matrix More... | |
void | vkvg_matrix_scale (vkvg_matrix_t *matrix, float sx, float sy) |
apply scale on matrix More... | |
void | vkvg_matrix_rotate (vkvg_matrix_t *matrix, float radians) |
apply rotation on matrix More... | |
void | vkvg_matrix_multiply (vkvg_matrix_t *result, const vkvg_matrix_t *a, const vkvg_matrix_t *b) |
matrices multiplication More... | |
void | vkvg_matrix_transform_distance (const vkvg_matrix_t *matrix, float *dx, float *dy) |
transform distances More... | |
void | vkvg_matrix_transform_point (const vkvg_matrix_t *matrix, float *x, float *y) |
transform point More... | |
vkvg_status_t | vkvg_matrix_invert (vkvg_matrix_t *matrix) |
invert matrix More... | |
void | vkvg_matrix_get_scale (const vkvg_matrix_t *matrix, float *sx, float *sy) |
void | vkvg_device_set_thread_aware (VkvgDevice dev, uint32_t thread_awayre) |
vkvg_device_set_thread_aware More... | |
VkvgDevice | vkvg_device_create (VkSampleCountFlags samples, bool deferredResolve) |
Create a new vkvg device. More... | |
VkvgDevice | vkvg_device_create_from_vk (VkInstance inst, VkPhysicalDevice phy, VkDevice vkdev, uint32_t qFamIdx, uint32_t qIndex) |
Create a new vkvg device from an existing vulkan logical device. More... | |
VkvgDevice | vkvg_device_create_from_vk_multisample (VkInstance inst, VkPhysicalDevice phy, VkDevice vkdev, uint32_t qFamIdx, uint32_t qIndex, VkSampleCountFlags samples, bool deferredResolve) |
Create a new multisampled vkvg device. More... | |
void | vkvg_device_destroy (VkvgDevice dev) |
Decrement the reference count of the device by 1. Release all it's ressources if count reach 0. More... | |
vkvg_status_t | vkvg_device_status (VkvgDevice dev) |
Get the current status of the device. More... | |
VkvgDevice | vkvg_device_reference (VkvgDevice dev) |
Increment the reference count on this device. More... | |
uint32_t | vkvg_device_get_reference_count (VkvgDevice dev) |
Query the reference count of the device. More... | |
void | vkvg_device_set_dpy (VkvgDevice dev, int hdpy, int vdpy) |
Set the screen dot per inch for this device. More... | |
void | vkvg_device_get_dpy (VkvgDevice dev, int *hdpy, int *vdpy) |
Get the current dpy values. More... | |
void | vkvg_get_required_instance_extensions (const char **pExtensions, uint32_t *pExtCount) |
query required instance extensions for vkvg. More... | |
void | vkvg_get_required_device_extensions (VkPhysicalDevice phy, const char **pExtensions, uint32_t *pExtCount) |
query required device extensions for vkvg. More... | |
const void * | vkvg_get_device_requirements (VkPhysicalDeviceFeatures *pEnabledFeatures) |
get vulkan device creation requirement to fit vkvg needs. More... | |
VkvgSurface | vkvg_surface_create (VkvgDevice dev, uint32_t width, uint32_t height) |
Create a new vkvg surface. More... | |
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. More... | |
VkvgSurface | vkvg_surface_create_for_VkhImage (VkvgDevice dev, void *vkhImg) |
Create a new vkvg surface using an existing vulkan texture as backend. More... | |
VkvgSurface | vkvg_surface_reference (VkvgSurface surf) |
Increment reference count on the surface by one. More... | |
uint32_t | vkvg_surface_get_reference_count (VkvgSurface surf) |
Get the current reference count on this surface. More... | |
void | vkvg_surface_destroy (VkvgSurface surf) |
Decrement the reference count on the surface by one. Destroy it if count reach 0. More... | |
vkvg_status_t | vkvg_surface_status (VkvgSurface surf) |
Query the current status of the surface. More... | |
void | vkvg_surface_clear (VkvgSurface surf) |
Clear surface's content. More... | |
VkImage | vkvg_surface_get_vk_image (VkvgSurface surf) |
Get the final single sampled vulkan image of this surface. More... | |
VkFormat | vkvg_surface_get_vk_format (VkvgSurface surf) |
Get the vulkan format of the vulkan texture used as backend for this surface. More... | |
uint32_t | vkvg_surface_get_width (VkvgSurface surf) |
Get the actual surface width. More... | |
uint32_t | vkvg_surface_get_height (VkvgSurface surf) |
Get the actual surface height. More... | |
vkvg_status_t | vkvg_surface_write_to_png (VkvgSurface surf, const char *path) |
Write surface content to a png file on disk. More... | |
vkvg_status_t | vkvg_surface_write_to_memory (VkvgSurface surf, unsigned char *const bitmap) |
Save surface to memory. More... | |
void | vkvg_surface_resolve (VkvgSurface surf) |
Explicitly resolve a multisampled surface. More... | |
VkvgContext | vkvg_create (VkvgSurface surf) |
Create a new vkvg context used for drawing on surfaces. More... | |
void | vkvg_destroy (VkvgContext ctx) |
Destroy vkvg context. More... | |
vkvg_status_t | vkvg_status (VkvgContext ctx) |
Get context status. More... | |
const char * | vkvg_status_to_string (vkvg_status_t status) |
VkvgContext | vkvg_reference (VkvgContext ctx) |
Increment by one the reference count on this context. More... | |
uint32_t | vkvg_get_reference_count (VkvgContext ctx) |
Get the current reference count of this context. More... | |
void | vkvg_flush (VkvgContext ctx) |
Perform all the pending drawing operations on a context. More... | |
void | vkvg_new_path (VkvgContext ctx) |
Start a new empty path. More... | |
void | vkvg_close_path (VkvgContext ctx) |
Close the current path. More... | |
void | vkvg_new_sub_path (VkvgContext ctx) |
Start a new sub path. More... | |
void | vkvg_path_extents (VkvgContext ctx, float *x1, float *y1, float *x2, float *y2) |
vkvg_path_extents More... | |
void | vkvg_get_current_point (VkvgContext ctx, float *x, float *y) |
Get the current point. More... | |
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. More... | |
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. More... | |
void | vkvg_move_to (VkvgContext ctx, float x, float y) |
Move the context pen to the position given in argument. More... | |
void | vkvg_rel_move_to (VkvgContext ctx, float x, float y) |
Move the context pen relative to the current point. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | vkvg_quadratic_to (VkvgContext ctx, float x1, float y1, float x2, float y2) |
Add a quadratic Bezizer curve to the current path. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | vkvg_ellipse (VkvgContext ctx, float radiusX, float radiusY, float x, float y, float rotationAngle) |
Add a closed ellipse to the current path. More... | |
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. More... | |
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. More... | |
void | vkvg_stroke (VkvgContext ctx) |
Stroke command. More... | |
void | vkvg_stroke_preserve (VkvgContext ctx) |
Stroke command that preserve current path. More... | |
void | vkvg_fill (VkvgContext ctx) |
Fill command. More... | |
void | vkvg_fill_preserve (VkvgContext ctx) |
Fill command that preserve current path. More... | |
void | vkvg_paint (VkvgContext ctx) |
Paint command. More... | |
void | vkvg_clear (VkvgContext ctx) |
Clear surface. More... | |
void | vkvg_reset_clip (VkvgContext ctx) |
Reset the current clip region. More... | |
void | vkvg_clip (VkvgContext ctx) |
Establishes a new clip region. More... | |
void | vkvg_clip_preserve (VkvgContext ctx) |
Establishes a new clip region preserving the current path. More... | |
void | vkvg_set_opacity (VkvgContext ctx, float opacity) |
Set global opacity for drawing operations. More... | |
float | vkvg_get_opacity (VkvgContext ctx) |
Get current opacity. More... | |
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. More... | |
void | vkvg_set_source_rgba (VkvgContext ctx, float r, float g, float b, float a) |
set color with alpha. More... | |
void | vkvg_set_source_rgb (VkvgContext ctx, float r, float g, float b) |
set opaque color as new source. More... | |
void | vkvg_set_line_width (VkvgContext ctx, float width) |
set line width for the next draw command. More... | |
void | vkvg_set_miter_limit (VkvgContext ctx, float limit) |
set line join miter size limit. More... | |
float | vkvg_get_miter_limit (VkvgContext ctx) |
Gets the current miter limit. More... | |
void | vkvg_set_line_cap (VkvgContext ctx, vkvg_line_cap_t cap) |
set line terminations for the next draw command. More... | |
void | vkvg_set_line_join (VkvgContext ctx, vkvg_line_join_t join) |
set line joins for the next draw command. More... | |
void | vkvg_set_source_surface (VkvgContext ctx, VkvgSurface surf, float x, float y) |
use supplied surface as current pattern. More... | |
void | vkvg_set_source (VkvgContext ctx, VkvgPattern pat) |
set supplied pattern as current source. More... | |
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 More... | |
void | vkvg_get_dash (VkvgContext ctx, const float *dashes, uint32_t *num_dashes, float *offset) |
get current dash settings. More... | |
float | vkvg_get_line_width (VkvgContext ctx) |
get current line width More... | |
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. More... | |
VkvgPattern | vkvg_get_source (VkvgContext ctx) |
Get the current source of the context. More... | |
VkvgSurface | vkvg_get_target (VkvgContext ctx) |
Get the current target of the context. More... | |
bool | vkvg_has_current_point (VkvgContext ctx) |
Check if context has a current point defined. More... | |
void | vkvg_save (VkvgContext ctx) |
Save context's graphic states. More... | |
void | vkvg_restore (VkvgContext ctx) |
Restore context's graphic states. More... | |
void | vkvg_translate (VkvgContext ctx, float dx, float dy) |
Add a translation to the current transformation matrix. More... | |
void | vkvg_scale (VkvgContext ctx, float sx, float sy) |
Add a scaling transform to the current transformation matrix. More... | |
void | vkvg_rotate (VkvgContext ctx, float radians) |
Add a rotation to the current transformation matrix. More... | |
void | vkvg_transform (VkvgContext ctx, const vkvg_matrix_t *matrix) |
Add an additional transformation to the current matrix. More... | |
void | vkvg_set_matrix (VkvgContext ctx, const vkvg_matrix_t *matrix) |
Set the current matrix. More... | |
void | vkvg_get_matrix (VkvgContext ctx, const vkvg_matrix_t *matrix) |
Get the current matrix. More... | |
void | vkvg_identity_matrix (VkvgContext ctx) |
Set the current matrix to identity. More... | |
void | vkvg_select_font_face (VkvgContext ctx, const char *name) |
Try find font with the specified name using the FontConfig library. More... | |
void | vkvg_load_font_from_path (VkvgContext ctx, const char *path, const char *name) |
Select a new font by providing its file path. More... | |
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. More... | |
void | vkvg_set_font_size (VkvgContext ctx, uint32_t size) |
void | vkvg_show_text (VkvgContext ctx, const char *utf8) |
Show a string of text. More... | |
void | vkvg_text_extents (VkvgContext ctx, const char *utf8, vkvg_text_extents_t *extents) |
Gets the extents for a string of text. More... | |
void | vkvg_font_extents (VkvgContext ctx, vkvg_font_extents_t *extents) |
Gets the font extents for the currently selected font. More... | |
VkvgText | vkvg_text_run_create (VkvgContext ctx, const char *text) |
Create a new text run. More... | |
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. More... | |
void | vkvg_text_run_destroy (VkvgText textRun) |
Release ressources holded by the text run. More... | |
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. More... | |
void | vkvg_text_run_get_glyph_position (VkvgText textRun, uint32_t index, vkvg_glyph_info_t *pGlyphInfo) |
retrieve glyph positions. More... | |
VkvgPattern | vkvg_pattern_reference (VkvgPattern pat) |
add reference More... | |
uint32_t | vkvg_pattern_get_reference_count (VkvgPattern pat) |
get reference count More... | |
VkvgPattern | vkvg_pattern_create_for_surface (VkvgSurface surf) |
create a surface pattern More... | |
VkvgPattern | vkvg_pattern_create_linear (float x0, float y0, float x1, float y1) |
create a new linear gradient. More... | |
vkvg_status_t | vkvg_pattern_edit_linear (VkvgPattern pat, float x0, float y0, float x1, float y1) |
edit an existing linear gradient. More... | |
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 More... | |
VkvgPattern | vkvg_pattern_create_radial (float cx0, float cy0, float radius0, float cx1, float cy1, float radius1) |
create a new radial gradient. More... | |
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. More... | |
vkvg_status_t | vkvg_pattern_get_color_stop_count (VkvgPattern pat, uint32_t *count) |
get color stop count. More... | |
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. More... | |
void | vkvg_pattern_destroy (VkvgPattern pat) |
dispose pattern. More... | |
vkvg_status_t | vkvg_pattern_add_color_stop (VkvgPattern pat, float offset, float r, float g, float b, float a) |
add colors to gradients More... | |
void | vkvg_pattern_set_extend (VkvgPattern pat, vkvg_extend_t extend) |
control the extend of the pattern More... | |
void | vkvg_pattern_set_filter (VkvgPattern pat, vkvg_filter_t filter) |
control the filtering when using this pattern on a surface. More... | |
vkvg_extend_t | vkvg_pattern_get_extend (VkvgPattern pat) |
query the current extend value for a pa More... | |
vkvg_filter_t | vkvg_pattern_get_filter (VkvgPattern pat) |
vkvg_pattern_type_t | vkvg_pattern_get_type (VkvgPattern pat) |
get pattern type More... | |
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.
Definition in file vkvg.h.