JGraphics is the API for creating user interface objects introduced with Max 5. More...
Modules | |
JSurface | |
A surface is an abstract base class for something you render to. | |
Scalable Vector Graphics | |
JFont | |
JGraphics Matrix Transformations | |
The t_jmatrix is one way to represent a transformation. | |
JPattern | |
A pattern is like a brush that is used to fill a path with. | |
Colors | |
Styles | |
Styles provide a means by which to inherit attribute values from a patcher that are consistently used across many objects. | |
TextField | |
The textfield is a high-level text display object that may be used by a UI object to represent text in a patcher. | |
TextLayout | |
A textlayout is lower-level text rendering object used by higher-level entities such as TextField. | |
Popup Menus | |
Popup menu API so externals can create popup menus that can also be drawn into. | |
Box Layer | |
The boxlayer functions provide way to make it easier to use cached offscreen images (layers) in your drawing. | |
Data Structures | |
struct | t_jgraphics_font_extents |
A structure for holding information related to how much space the rendering of a given font will use. More... | |
Macros | |
#define | JGRAPHICS_RECT_BOTTOM(rect) |
Determine the coordinate of the bottom of a rect. | |
#define | JGRAPHICS_RECT_RIGHT(rect) |
Determine the coordinate of the right side of a rect. | |
#define | JGRAPHICS_PI |
Utility macro to return the value of Pi. More... | |
#define | JGRAPHICS_2PI |
Utility macro to return the value of twice Pi. More... | |
#define | JGRAPHICS_PIOVER2 |
Utility macro to return the value of half of Pi. More... | |
#define | JGRAPHICS_3PIOVER2 |
Utility macro to return the 270ยบ Case. More... | |
Typedefs | |
typedef typedefBEGIN_USING_C_LINKAGE struct _jgraphics | t_jgraphics |
An instance of a jgraphics drawing context. | |
typedef struct _jpath | t_jpath |
An instance of a jgraphics path. | |
typedef struct _jtextlayout | t_jtextlayout |
An instance of a jgraphics text layout object. | |
typedef struct _jtransform | t_jtransform |
An instance of a jgraphics transform. | |
typedef struct _jdesktopui | t_jdesktopui |
An instance of a transparent UI window on the desktop. | |
typedef struct _jpopupmenu | t_jpopupmenu |
An instance of a pop-up menu. | |
typedef struct _jsvg | t_jsvg |
An instance of an SVG object. | |
typedef struct _jsvg_remap | t_jsvg_remap |
An object used for remapping colors in a t_svg. | |
Enumerations | |
enum | t_jgraphics_format { JGRAPHICS_FORMAT_ARGB32, JGRAPHICS_FORMAT_RGB24, JGRAPHICS_FORMAT_A8 } |
Enumeration of color formats used by jgraphics surfaces. More... | |
enum | t_jgraphics_fileformat { JGRAPHICS_FILEFORMAT_PNG, JGRAPHICS_FILEFORMAT_JPEG } |
Enumeration of file formats usable for jgraphics surfaces. More... | |
enum | t_jgraphics_text_justification { JGRAPHICS_TEXT_JUSTIFICATION_LEFT, JGRAPHICS_TEXT_JUSTIFICATION_RIGHT, JGRAPHICS_TEXT_JUSTIFICATION_HCENTERED, JGRAPHICS_TEXT_JUSTIFICATION_TOP, JGRAPHICS_TEXT_JUSTIFICATION_BOTTOM, JGRAPHICS_TEXT_JUSTIFICATION_VCENTERED, JGRAPHICS_TEXT_JUSTIFICATION_HJUSTIFIED, JGRAPHICS_TEXT_JUSTIFICATION_CENTERED } |
Enumeration of text justification options, which are specified as a bitmask. More... | |
Functions | |
int | jgraphics_round (double d) |
Utility for rounding a double to an int. More... | |
t_jgraphics * | jgraphics_reference (t_jgraphics *g) |
Get a reference to a graphics context. More... | |
void | jgraphics_destroy (t_jgraphics *g) |
Release or free a graphics context. More... | |
void | jgraphics_new_path (t_jgraphics *g) |
Begin a new path. More... | |
t_jpath * | jgraphics_copy_path (t_jgraphics *g) |
Get a copy of the current path from a context. More... | |
t_jpath * | jgraphics_path_createstroked (t_jpath *p, double thickness, t_jgraphics_line_join join, t_jgraphics_line_cap cap) |
Create a new path consisting of the original path stroked with a given thickness. More... | |
void | jgraphics_path_destroy (t_jpath *path) |
Release/free a path. More... | |
void | jgraphics_append_path (t_jgraphics *g, t_jpath *path) |
Add a path to a graphics context. More... | |
void | jgraphics_close_path (t_jgraphics *g) |
Close the current path in a context. More... | |
void | jgraphics_path_roundcorners (t_jgraphics *g, double cornerRadius) |
Round out any corners in a path. More... | |
long | jgraphics_path_contains (t_jpath *path, double x, double y) |
Test if the path contains the point x,y. More... | |
long | jgraphics_path_intersectsline (t_jpath *path, double x1, double y1, double x2, double y2) |
Test if the path intersects the line defined by x1,y1 and x2,y2. More... | |
double | jgraphics_path_getlength (t_jpath *path) |
Return the length of a path. More... | |
void | jgraphics_path_getpointalongpath (t_jpath *path, double distancefromstart, double *x, double *y) |
Return a point that lies a given distance from the start of the path. More... | |
double | jgraphics_path_getnearestpoint (t_jpath *path, double x, double y, double *path_x, double *path_y) |
Finds the point on the path that is nearest to the point x,y passed in. More... | |
long | jgraphics_path_getpathelems (t_jpath *path, t_jgraphics_path_elem **elems) |
Get the path elements and return number of path elements. More... | |
void | jgraphics_get_current_point (t_jgraphics *g, double *x, double *y) |
Get the current location of the cursor in a graphics context. More... | |
void | jgraphics_arc (t_jgraphics *g, double xc, double yc, double radius, double angle1, double angle2) |
Add a circular, clockwise, arc to the current path. More... | |
void | jgraphics_ovalarc (t_jgraphics *g, double xc, double yc, double radiusx, double radiusy, double angle1, double angle2) |
Add a non-circular arc to the current path. More... | |
void | jgraphics_arc_negative (t_jgraphics *g, double xc, double yc, double radius, double angle1, double angle2) |
Add a circular, counter-clockwise, arc to the current path. More... | |
void | jgraphics_curve_to (t_jgraphics *g, double x1, double y1, double x2, double y2, double x3, double y3) |
Add a cubic Bezier spline to the current path. More... | |
void | jgraphics_rel_curve_to (t_jgraphics *g, double x1, double y1, double x2, double y2, double x3, double y3) |
Add a cubic Bezier spline to the current path, using coordinates relative to the current point. More... | |
void | jgraphics_line_to (t_jgraphics *g, double x, double y) |
Add a line segment to the current path. More... | |
void | jgraphics_rel_line_to (t_jgraphics *g, double x, double y) |
Add a line segment to the current path, using coordinates relative to the current point. More... | |
void | jgraphics_move_to (t_jgraphics *g, double x, double y) |
Move the cursor to a new point and begin a new subpath. More... | |
void | jgraphics_rel_move_to (t_jgraphics *g, double x, double y) |
Move the cursor to a new point and begin a new subpath, using coordinates relative to the current point. More... | |
void | jgraphics_rectangle (t_jgraphics *g, double x, double y, double width, double height) |
Add a closed rectangle path in the context. More... | |
void | jgraphics_oval (t_jgraphics *g, double x, double y, double width, double height) |
Deprecated – do not use. More... | |
void | jgraphics_rectangle_rounded (t_jgraphics *g, double x, double y, double width, double height, double ovalwidth, double ovalheight) |
Add a closed rounded-rectangle path in the context. More... | |
void | jgraphics_ellipse (t_jgraphics *g, double x, double y, double width, double height) |
Add a closed elliptical path in the context. More... | |
void | jgraphics_bubble (t_jgraphics *g, double bodyx, double bodyy, double bodywidth, double bodyheight, double cornersize, double arrowtipx, double arrowtipy, t_jgraphics_bubble_side whichside, double arrowedgeprop, double arrowwidth) |
Add a closed bubble path in the context. More... | |
void | jgraphics_triangle (t_jgraphics *g, double x1, double y1, double x2, double y2, double x3, double y3) |
Add a closed triangular path in the context. More... | |
void | jgraphics_select_font_face (t_jgraphics *g, const char *family, t_jgraphics_font_slant slant, t_jgraphics_font_weight weight) |
Specify a font for a graphics context. More... | |
void | jgraphics_select_jfont (t_jgraphics *g, t_jfont *jfont) |
Specify a font for a graphics context by passing a t_jfont object. More... | |
void | jgraphics_set_font_size (t_jgraphics *g, double size) |
Specify the font size for a context. More... | |
void | jgraphics_set_underline (t_jgraphics *g, char underline) |
Turn underlining on/off for text in a context. More... | |
void | jgraphics_show_text (t_jgraphics *g, const char *utf8) |
Display text at the current position in a context. More... | |
void | jgraphics_text_path (t_jgraphics *g, const char *utf8) |
Add a path of text to the current path. More... | |
void | jgraphics_font_extents (t_jgraphics *g, t_jgraphics_font_extents *extents) |
Return the extents of the currently selected font for a given graphics context. More... | |
void | jgraphics_text_measure (t_jgraphics *g, const char *utf8, double *width, double *height) |
Return the height and width of a string given current graphics settings in a context. More... | |
void | jgraphics_text_measuretext_wrapped (t_jgraphics *g, const char *utf8, double wrapwidth, long includewhitespace, double *width, double *height, long *numlines) |
Return the height, width, and number of lines that will be used to render a given string. More... | |
long | jgraphics_system_canantialiastexttotransparentbg () |
Determine if you can anti-alias text to a transparent background. More... | |
void | jgraphics_user_to_device (t_jgraphics *g, double *x, double *y) |
User coordinates are those passed to drawing functions in a given t_jgraphics context. More... | |
void | jgraphics_device_to_user (t_jgraphics *g, double *x, double *y) |
User coordinates are those passed to drawing functions in a given t_jgraphics context. More... | |
void | jgraphics_getfiletypes (void *dummy, long *count, t_fourcc **filetypes, char *alloc) |
Get a list of of filetypes appropriate for use with jgraphics surfaces. More... | |
long | jgraphics_rectintersectsrect (t_rect *r1, t_rect *r2) |
Simple utility to test for rectangle intersection. More... | |
long | jgraphics_rectcontainsrect (t_rect *outer, t_rect *inner) |
Simple utility to test for rectangle containment. More... | |
void | jgraphics_position_one_rect_near_another_rect_but_keep_inside_a_third_rect (t_rect *positioned_rect, const t_rect *positioned_near_this_rect, const t_rect *keep_inside_this_rect) |
Generate a t_rect according to positioning rules. More... | |
void | jgraphics_clip (t_jgraphics *g, double x, double y, double width, double height) |
Clip to a subset of the graphics context; once done, cannot be undone, only further reduced. More... | |
JGraphics is the API for creating user interface objects introduced with Max 5.
It includes functions for drawing vector-based shapes, managing pop-up menus, rendering text, and importing graphics resources. The API design is inspired by and analogous to the Cairo API, though the underlying implementation is actually drawn using JUCE (JUCE functions, however, cannot be called directly).
#define JGRAPHICS_2PI |
Utility macro to return the value of twice Pi.
#define JGRAPHICS_3PIOVER2 |
Utility macro to return the 270ยบ Case.
#define JGRAPHICS_PI |
Utility macro to return the value of Pi.
#define JGRAPHICS_PIOVER2 |
Utility macro to return the value of half of Pi.
enum t_jgraphics_format |
Enumeration of color formats used by jgraphics surfaces.
Enumeration of text justification options, which are specified as a bitmask.
void jgraphics_append_path | ( | t_jgraphics * | g, |
t_jpath * | path | ||
) |
Add a path to a graphics context.
g | The graphics context. |
path | The path to add. |
void jgraphics_arc | ( | t_jgraphics * | g, |
double | xc, | ||
double | yc, | ||
double | radius, | ||
double | angle1, | ||
double | angle2 | ||
) |
Add a circular, clockwise, arc to the current path.
g | The graphics context. |
xc | The horizontal coordinate of the arc's center. |
yc | The vertical coordinate of the arc's center. |
radius | The radius of the arc. |
angle1 | The starting angle of the arc in radians. Zero radians is center right (positive x axis). |
angle2 | The terminal angle of the arc in radians. Zero radians is center right (positive x axis). |
void jgraphics_arc_negative | ( | t_jgraphics * | g, |
double | xc, | ||
double | yc, | ||
double | radius, | ||
double | angle1, | ||
double | angle2 | ||
) |
Add a circular, counter-clockwise, arc to the current path.
g | The graphics context. |
xc | The horizontal coordinate of the arc's center. |
yc | The vertical coordinate of the arc's center. |
radius | The radius of the arc. |
angle1 | The starting angle of the arc in radians. Zero radians is center right (positive x axis). |
angle2 | The terminal angle of the arc in radians. Zero radians is center right (positive x axis). |
void jgraphics_bubble | ( | t_jgraphics * | g, |
double | bodyx, | ||
double | bodyy, | ||
double | bodywidth, | ||
double | bodyheight, | ||
double | cornersize, | ||
double | arrowtipx, | ||
double | arrowtipy, | ||
t_jgraphics_bubble_side | whichside, | ||
double | arrowedgeprop, | ||
double | arrowwidth | ||
) |
Add a closed bubble path in the context.
g | The graphics context. |
bodyx | Horizontal body origin. |
bodyy | The vertical origin. |
bodywidth | The width of the rect. |
bodyheight | The height of the rect. |
cornersize | Body rounded corners |
arrowtipx | X position of arrow tip |
arrowtipy | Y position of arrow tip |
whichside | side to connect arrow, 0 = top, 1 = left, 2 = bottom, 3 = right, |
arrowedgeprop | Arrow proportion along edge (0-1) |
arrowwidth | Arrow base width |
void jgraphics_clip | ( | t_jgraphics * | g, |
double | x, | ||
double | y, | ||
double | width, | ||
double | height | ||
) |
Clip to a subset of the graphics context; once done, cannot be undone, only further reduced.
g | The t_jgraphics context to be clipped. |
x | x origin of clip region. |
y | y origin of clip region. |
width | width of clip region. |
height | height of clip region. |
void jgraphics_close_path | ( | t_jgraphics * | g | ) |
Close the current path in a context.
This will add a line segment to close current subpath.
g | The graphics context. |
t_jpath* jgraphics_copy_path | ( | t_jgraphics * | g | ) |
Get a copy of the current path from a context.
g | the graphics context containing the current path |
void jgraphics_curve_to | ( | t_jgraphics * | g, |
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2, | ||
double | x3, | ||
double | y3 | ||
) |
Add a cubic Bezier spline to the current path.
g | The graphics context. |
x1 | The first control point. |
y1 | The first control point. |
x2 | The second control point. |
y2 | The second control point. |
x3 | The destination point. |
y3 | The destination point. |
void jgraphics_destroy | ( | t_jgraphics * | g | ) |
Release or free a graphics context.
g | The context to release. |
void jgraphics_device_to_user | ( | t_jgraphics * | g, |
double * | x, | ||
double * | y | ||
) |
User coordinates are those passed to drawing functions in a given t_jgraphics context.
Device coordinates refer to patcher canvas coordinates, before any zooming.
void jgraphics_ellipse | ( | t_jgraphics * | g, |
double | x, | ||
double | y, | ||
double | width, | ||
double | height | ||
) |
Add a closed elliptical path in the context.
g | The graphics context. |
x | The horizontal origin. |
y | The vertical origin. |
width | The width of the rect. |
height | The height of the rect. |
void jgraphics_font_extents | ( | t_jgraphics * | g, |
t_jgraphics_font_extents * | extents | ||
) |
Return the extents of the currently selected font for a given graphics context.
g | Pointer to a jgraphics context. |
extents | The address of a t_jgraphics_font_extents structure to be filled with the results. |
void jgraphics_get_current_point | ( | t_jgraphics * | g, |
double * | x, | ||
double * | y | ||
) |
Get the current location of the cursor in a graphics context.
g | The graphics context. |
x | The address of a variable that will be set to the horizontal cursor location upon return. |
y | The address of a variable that will be set to the vertical cursor location upon return. |
void jgraphics_getfiletypes | ( | void * | dummy, |
long * | count, | ||
t_fourcc ** | filetypes, | ||
char * | alloc | ||
) |
Get a list of of filetypes appropriate for use with jgraphics surfaces.
dummy | Unused. |
count | The address of a variable to be set with the number of types in filetypes upon return. |
filetypes | The address of a variable that will represent the array of file types upon return. |
alloc | The address of a char that will be flagged with a 1 or a 0 depending on whether or not memory was allocated for the filetypes member. |
void jgraphics_line_to | ( | t_jgraphics * | g, |
double | x, | ||
double | y | ||
) |
Add a line segment to the current path.
g | The graphics context. |
x | The destination point. |
y | The destination point. |
void jgraphics_move_to | ( | t_jgraphics * | g, |
double | x, | ||
double | y | ||
) |
Move the cursor to a new point and begin a new subpath.
g | The graphics context. |
x | The new location. |
y | The new location. |
void jgraphics_new_path | ( | t_jgraphics * | g | ) |
Begin a new path.
This action clears any current path in the context.
g | The graphics context. |
void jgraphics_oval | ( | t_jgraphics * | g, |
double | x, | ||
double | y, | ||
double | width, | ||
double | height | ||
) |
Deprecated – do not use.
Adds a closed oval path in the context, however, it does not scale appropriately.
g | The graphics context. |
x | The horizontal origin. |
y | The vertical origin. |
width | The width of the oval. |
height | The height of the oval. |
void jgraphics_ovalarc | ( | t_jgraphics * | g, |
double | xc, | ||
double | yc, | ||
double | radiusx, | ||
double | radiusy, | ||
double | angle1, | ||
double | angle2 | ||
) |
Add a non-circular arc to the current path.
g | The graphics context. |
xc | The horizontal coordinate of the arc's center. |
yc | The vertical coordinate of the arc's center. |
radiusx | The horizontal radius of the arc. |
radiusy | The vertical radius of the arc. |
angle1 | The starting angle of the arc in radians. Zero radians is center right (positive x axis). |
angle2 | The terminal angle of the arc in radians. Zero radians is center right (positive x axis). |
long jgraphics_path_contains | ( | t_jpath * | path, |
double | x, | ||
double | y | ||
) |
Test if the path contains the point x,y.
path | the path |
x | the x-coordinate of the point to test |
y | the y-coordinate of the point to test |
t_jpath* jgraphics_path_createstroked | ( | t_jpath * | p, |
double | thickness, | ||
t_jgraphics_line_join | join, | ||
t_jgraphics_line_cap | cap | ||
) |
Create a new path consisting of the original path stroked with a given thickness.
p | the path to be stroked |
thickness | thickness of the stroke |
join | the style to join segments together at corners |
cap | the style of end cap to use |
void jgraphics_path_destroy | ( | t_jpath * | path | ) |
Release/free a path.
path | The path to release. |
double jgraphics_path_getlength | ( | t_jpath * | path | ) |
Return the length of a path.
path | the path |
double jgraphics_path_getnearestpoint | ( | t_jpath * | path, |
double | x, | ||
double | y, | ||
double * | path_x, | ||
double * | path_y | ||
) |
Finds the point on the path that is nearest to the point x,y passed in.
path | the path to search |
x | x position of the target point |
y | y position of the target point |
path_x | pointer to double to receive the x position of closest point on path |
path_y | pointer to double to receive the y position of the closest point on path |
long jgraphics_path_getpathelems | ( | t_jpath * | path, |
t_jgraphics_path_elem ** | elems | ||
) |
Get the path elements and return number of path elements.
path | the path |
elems | pointer to array of path elements |
void jgraphics_path_getpointalongpath | ( | t_jpath * | path, |
double | distancefromstart, | ||
double * | x, | ||
double * | y | ||
) |
Return a point that lies a given distance from the start of the path.
path | the path |
distancefromstart | distance from the start point |
x | pointer to double to receive the x position of the point |
y | pointer to double to receive the y position of the point |
long jgraphics_path_intersectsline | ( | t_jpath * | path, |
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Test if the path intersects the line defined by x1,y1 and x2,y2.
path | the path |
x1 | the x-coordinate of the first point on the line |
y1 | the y-coordinate of the first point on the line |
x2 | the x-coordinate of the second point on the line |
y2 | the y-coordinate of the second point on the line |
void jgraphics_path_roundcorners | ( | t_jgraphics * | g, |
double | cornerRadius | ||
) |
Round out any corners in a path.
This action clears any current path in the context.
g | The graphics context. |
cornerRadius | The amount by which to round corners. |
void jgraphics_position_one_rect_near_another_rect_but_keep_inside_a_third_rect | ( | t_rect * | positioned_rect, |
const t_rect * | positioned_near_this_rect, | ||
const t_rect * | keep_inside_this_rect | ||
) |
Generate a t_rect according to positioning rules.
positioned_rect | The address of a valid t_rect whose members will be filled in upon return. |
positioned_near_this_rect | A pointer to a rect near which this rect should be positioned. |
keep_inside_this_rect | A pointer to a rect defining the limits within which the new rect must reside. |
void jgraphics_rectangle | ( | t_jgraphics * | g, |
double | x, | ||
double | y, | ||
double | width, | ||
double | height | ||
) |
Add a closed rectangle path in the context.
g | The graphics context. |
x | The horizontal origin. |
y | The vertical origin. |
width | The width of the rect. |
height | The height of the rect. |
void jgraphics_rectangle_rounded | ( | t_jgraphics * | g, |
double | x, | ||
double | y, | ||
double | width, | ||
double | height, | ||
double | ovalwidth, | ||
double | ovalheight | ||
) |
Add a closed rounded-rectangle path in the context.
g | The graphics context. |
x | The horizontal origin. |
y | The vertical origin. |
width | The width of the rect. |
height | The height of the rect. |
ovalwidth | The width of the oval used for the round corners. |
ovalheight | The height of the oval used for the round corners. |
Simple utility to test for rectangle containment.
outer | The address of the first rect for the test. |
inner | The address of the second rect for the test. |
Simple utility to test for rectangle intersection.
r1 | The address of the first rect for the test. |
r2 | The address of the second rect for the test. |
t_jgraphics* jgraphics_reference | ( | t_jgraphics * | g | ) |
Get a reference to a graphics context.
When you are done you should release your reference with jgraphics_destroy().
g | The context you wish to reference. |
void jgraphics_rel_curve_to | ( | t_jgraphics * | g, |
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2, | ||
double | x3, | ||
double | y3 | ||
) |
Add a cubic Bezier spline to the current path, using coordinates relative to the current point.
g | The graphics context. |
x1 | The first control point. |
y1 | The first control point. |
x2 | The second control point. |
y2 | The second control point. |
x3 | The destination point. |
y3 | The destination point. |
void jgraphics_rel_line_to | ( | t_jgraphics * | g, |
double | x, | ||
double | y | ||
) |
Add a line segment to the current path, using coordinates relative to the current point.
g | The graphics context. |
x | The destination point. |
y | The destination point. |
void jgraphics_rel_move_to | ( | t_jgraphics * | g, |
double | x, | ||
double | y | ||
) |
Move the cursor to a new point and begin a new subpath, using coordinates relative to the current point.
g | The graphics context. |
x | The new location. |
y | The new location. |
int jgraphics_round | ( | double | d | ) |
Utility for rounding a double to an int.
d | floating-point input. |
void jgraphics_select_font_face | ( | t_jgraphics * | g, |
const char * | family, | ||
t_jgraphics_font_slant | slant, | ||
t_jgraphics_font_weight | weight | ||
) |
Specify a font for a graphics context.
g | The graphics context. |
family | The name of the font family (e.g. "Arial"). |
slant | Define the slant to use for the font. |
weight | Define the weight to use for the font. |
void jgraphics_select_jfont | ( | t_jgraphics * | g, |
t_jfont * | jfont | ||
) |
Specify a font for a graphics context by passing a t_jfont object.
g | The graphics context. |
jfont | A jfont object whose attributes will be copied to the context. |
void jgraphics_set_font_size | ( | t_jgraphics * | g, |
double | size | ||
) |
Specify the font size for a context.
g | The graphics context. |
size | The font size. |
void jgraphics_set_underline | ( | t_jgraphics * | g, |
char | underline | ||
) |
Turn underlining on/off for text in a context.
g | The graphics context. |
underline | Pass true or false to set the appropriate behavior. |
void jgraphics_show_text | ( | t_jgraphics * | g, |
const char * | utf8 | ||
) |
Display text at the current position in a context.
g | The graphics context. |
utf8 | The text to display. |
long jgraphics_system_canantialiastexttotransparentbg | ( | ) |
Determine if you can anti-alias text to a transparent background.
You might want to call this and then disable "useimagebuffer" if false *and* you are rendering text on a transparent background.
void jgraphics_text_measure | ( | t_jgraphics * | g, |
const char * | utf8, | ||
double * | width, | ||
double * | height | ||
) |
Return the height and width of a string given current graphics settings in a context.
g | Pointer to a jgraphics context. |
utf8 | A string containing the text whose dimensions we wish to find. |
width | The address of a variable to be filled with the width of the rendered text. |
height | The address of a variable to be filled with the height of the rendered text. |
void jgraphics_text_measuretext_wrapped | ( | t_jgraphics * | g, |
const char * | utf8, | ||
double | wrapwidth, | ||
long | includewhitespace, | ||
double * | width, | ||
double * | height, | ||
long * | numlines | ||
) |
Return the height, width, and number of lines that will be used to render a given string.
g | Pointer to a jgraphics context. |
utf8 | A string containing the text whose dimensions we wish to find. |
wrapwidth | The number of pixels in width at which the text should be wrapped if it is too long. |
includewhitespace | Set zero to not include white space in the calculation, otherwise set this parameter to 1. |
width | The address of a variable to be filled with the width of the rendered text. |
height | The address of a variable to be filled with the height of the rendered text. |
numlines | The address of a variable to be filled with the number of lines required to render the text. |
void jgraphics_text_path | ( | t_jgraphics * | g, |
const char * | utf8 | ||
) |
Add a path of text to the current path.
g | The graphics context. |
utf8 | The text to generate path for. |
void jgraphics_triangle | ( | t_jgraphics * | g, |
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2, | ||
double | x3, | ||
double | y3 | ||
) |
Add a closed triangular path in the context.
g | The graphics context. |
x1 | Coordinate for the first point. |
y1 | Coordinate for the first point. |
x2 | Coordinate for the second point. |
y2 | Coordinate for the second point. |
x3 | Coordinate for the third point. |
y3 | Coordinate for the third point. |
void jgraphics_user_to_device | ( | t_jgraphics * | g, |
double * | x, | ||
double * | y | ||
) |
User coordinates are those passed to drawing functions in a given t_jgraphics context.
Device coordinates refer to patcher canvas coordinates, before any zooming.