JGraphics is the API for creating user interface objects introduced with Max 5. More...

+ Collaboration diagram for JGraphics:

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_jgraphicsjgraphics_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_jpathjgraphics_copy_path (t_jgraphics *g)
 Get a copy of the current path from a context. More...
 
t_jpathjgraphics_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...
 

Detailed Description

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).

Macro Definition Documentation

#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.

Enumeration Type Documentation

Enumeration of file formats usable for jgraphics surfaces.

Enumerator
JGRAPHICS_FILEFORMAT_PNG 

Portable Network Graphics (PNG) format.

JGRAPHICS_FILEFORMAT_JPEG 

JPEG format.

Enumeration of color formats used by jgraphics surfaces.

Enumerator
JGRAPHICS_FORMAT_ARGB32 

Color is represented using 32 bits, 8 bits each for the components, and including an alpha component.

JGRAPHICS_FORMAT_RGB24 

Color is represented using 32 bits, 8 bits each for the components. There is no alpha component.

JGRAPHICS_FORMAT_A8 

The color is represented only as an 8-bit alpha mask.

Enumeration of text justification options, which are specified as a bitmask.

Enumerator
JGRAPHICS_TEXT_JUSTIFICATION_LEFT 

Justify left.

JGRAPHICS_TEXT_JUSTIFICATION_RIGHT 

Justify right.

JGRAPHICS_TEXT_JUSTIFICATION_HCENTERED 

Centered horizontally.

JGRAPHICS_TEXT_JUSTIFICATION_TOP 

Justified to the top.

JGRAPHICS_TEXT_JUSTIFICATION_BOTTOM 

Justified to the bottom.

JGRAPHICS_TEXT_JUSTIFICATION_VCENTERED 

Centered vertically.

JGRAPHICS_TEXT_JUSTIFICATION_HJUSTIFIED 

Horizontally justified.

JGRAPHICS_TEXT_JUSTIFICATION_CENTERED 

Shortcut for Centering both vertically and horizontally.

Function Documentation

void jgraphics_append_path ( t_jgraphics g,
t_jpath path 
)

Add a path to a graphics context.

Parameters
gThe graphics context.
pathThe 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.

Parameters
gThe graphics context.
xcThe horizontal coordinate of the arc's center.
ycThe vertical coordinate of the arc's center.
radiusThe radius of the arc.
angle1The starting angle of the arc in radians. Zero radians is center right (positive x axis).
angle2The 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.

Parameters
gThe graphics context.
xcThe horizontal coordinate of the arc's center.
ycThe vertical coordinate of the arc's center.
radiusThe radius of the arc.
angle1The starting angle of the arc in radians. Zero radians is center right (positive x axis).
angle2The 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.

Parameters
gThe graphics context.
bodyxHorizontal body origin.
bodyyThe vertical origin.
bodywidthThe width of the rect.
bodyheightThe height of the rect.
cornersizeBody rounded corners
arrowtipxX position of arrow tip
arrowtipyY position of arrow tip
whichsideside to connect arrow, 0 = top, 1 = left, 2 = bottom, 3 = right,
arrowedgepropArrow proportion along edge (0-1)
arrowwidthArrow 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.

Parameters
gThe t_jgraphics context to be clipped.
xx origin of clip region.
yy origin of clip region.
widthwidth of clip region.
heightheight 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.

Parameters
gThe graphics context.
t_jpath* jgraphics_copy_path ( t_jgraphics g)

Get a copy of the current path from a context.

Parameters
gthe graphics context containing the current path
Returns
A copy of 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.

Parameters
gThe graphics context.
x1The first control point.
y1The first control point.
x2The second control point.
y2The second control point.
x3The destination point.
y3The destination point.
void jgraphics_destroy ( t_jgraphics g)

Release or free a graphics context.

Parameters
gThe 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.

Parameters
gThe graphics context.
xThe horizontal origin.
yThe vertical origin.
widthThe width of the rect.
heightThe 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.

Parameters
gPointer to a jgraphics context.
extentsThe 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.

Parameters
gThe graphics context.
xThe address of a variable that will be set to the horizontal cursor location upon return.
yThe 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.

Parameters
dummyUnused.
countThe address of a variable to be set with the number of types in filetypes upon return.
filetypesThe address of a variable that will represent the array of file types upon return.
allocThe 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.
Remarks
This example shows a common usage of jgraphics_getfiletypes().
1  char filename[MAX_PATH_CHARS];
2  t_fourcc *type = NULL;
3  long ntype;
4  long outtype;
5  t_max_err err;
6  char alloc;
7  short path;
8  t_jsurface *surface;
9 
10  if (want_to_show_dialog) {
11  jgraphics_getfiletypes(x, &ntype, &type, &alloc);
12  err = open_dialog(filename, &path,(void *)&outtype, (void *)type, ntype);
13  if (err)
14  goto out;
15  }
16  else {
17  strncpy_zero(filename, s->s_name, MAX_PATH_CHARS);
18  err = locatefile_extended(filename, &path, &outtype, type, ntype);
19  if (err)
20  goto out;
21  }
22  surface = jgraphics_image_surface_create_referenced(filename, path);
23 out:
24  if (alloc)
25  sysmem_freeptr((char *)type);
void jgraphics_line_to ( t_jgraphics g,
double  x,
double  y 
)

Add a line segment to the current path.

Parameters
gThe graphics context.
xThe destination point.
yThe 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.

Parameters
gThe graphics context.
xThe new location.
yThe new location.
void jgraphics_new_path ( t_jgraphics g)

Begin a new path.

This action clears any current path in the context.

Parameters
gThe 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.

Parameters
gThe graphics context.
xThe horizontal origin.
yThe vertical origin.
widthThe width of the oval.
heightThe 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.

Parameters
gThe graphics context.
xcThe horizontal coordinate of the arc's center.
ycThe vertical coordinate of the arc's center.
radiusxThe horizontal radius of the arc.
radiusyThe vertical radius of the arc.
angle1The starting angle of the arc in radians. Zero radians is center right (positive x axis).
angle2The 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.

Parameters
paththe path
xthe x-coordinate of the point to test
ythe 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.

Parameters
pthe path to be stroked
thicknessthickness of the stroke
jointhe style to join segments together at corners
capthe style of end cap to use
Returns
the new path, which must be freed with jgraphics_path_destroy() when done
void jgraphics_path_destroy ( t_jpath path)

Release/free a path.

Parameters
pathThe path to release.
double jgraphics_path_getlength ( t_jpath path)

Return the length of a path.

Parameters
paththe path
Returns
the length of 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.

Parameters
paththe path to search
xx position of the target point
yy position of the target point
path_xpointer to double to receive the x position of closest point on path
path_ypointer to double to receive the y position of the closest point on path
Returns
returns the distance along the path from the path start position to the found point on the path
long jgraphics_path_getpathelems ( t_jpath path,
t_jgraphics_path_elem **  elems 
)

Get the path elements and return number of path elements.

Parameters
paththe path
elemspointer to array of path elements
Returns
the number 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.

Parameters
paththe path
distancefromstartdistance from the start point
xpointer to double to receive the x position of the point
ypointer 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.

Parameters
paththe path
x1the x-coordinate of the first point on the line
y1the y-coordinate of the first point on the line
x2the x-coordinate of the second point on the line
y2the 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.

Parameters
gThe graphics context.
cornerRadiusThe 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.

Parameters
positioned_rectThe address of a valid t_rect whose members will be filled in upon return.
positioned_near_this_rectA pointer to a rect near which this rect should be positioned.
keep_inside_this_rectA 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.

Parameters
gThe graphics context.
xThe horizontal origin.
yThe vertical origin.
widthThe width of the rect.
heightThe 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.

Parameters
gThe graphics context.
xThe horizontal origin.
yThe vertical origin.
widthThe width of the rect.
heightThe height of the rect.
ovalwidthThe width of the oval used for the round corners.
ovalheightThe height of the oval used for the round corners.
long jgraphics_rectcontainsrect ( t_rect outer,
t_rect inner 
)

Simple utility to test for rectangle containment.

Parameters
outerThe address of the first rect for the test.
innerThe address of the second rect for the test.
Returns
Returns true if the inner rect is completely inside the outer rect, otherwise false.
long jgraphics_rectintersectsrect ( t_rect r1,
t_rect r2 
)

Simple utility to test for rectangle intersection.

Parameters
r1The address of the first rect for the test.
r2The address of the second rect for the test.
Returns
Returns true if the rects intersect, otherwise false.
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().

Parameters
gThe context you wish to reference.
Returns
A new reference to the context.
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.

Parameters
gThe graphics context.
x1The first control point.
y1The first control point.
x2The second control point.
y2The second control point.
x3The destination point.
y3The 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.

Parameters
gThe graphics context.
xThe destination point.
yThe 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.

Parameters
gThe graphics context.
xThe new location.
yThe new location.
int jgraphics_round ( double  d)

Utility for rounding a double to an int.

Parameters
dfloating-point input.
Returns
rounded int output.
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.

Parameters
gThe graphics context.
familyThe name of the font family (e.g. "Arial").
slantDefine the slant to use for the font.
weightDefine 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.

Parameters
gThe graphics context.
jfontA 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.

Parameters
gThe graphics context.
sizeThe font size.
void jgraphics_set_underline ( t_jgraphics g,
char  underline 
)

Turn underlining on/off for text in a context.

Parameters
gThe graphics context.
underlinePass 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.

Parameters
gThe graphics context.
utf8The 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.

Returns
Non-zero if you can anti-alias text to 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.

Parameters
gPointer to a jgraphics context.
utf8A string containing the text whose dimensions we wish to find.
widthThe address of a variable to be filled with the width of the rendered text.
heightThe 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.

Parameters
gPointer to a jgraphics context.
utf8A string containing the text whose dimensions we wish to find.
wrapwidthThe number of pixels in width at which the text should be wrapped if it is too long.
includewhitespaceSet zero to not include white space in the calculation, otherwise set this parameter to 1.
widthThe address of a variable to be filled with the width of the rendered text.
heightThe address of a variable to be filled with the height of the rendered text.
numlinesThe 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.

Parameters
gThe graphics context.
utf8The 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.

Parameters
gThe graphics context.
x1Coordinate for the first point.
y1Coordinate for the first point.
x2Coordinate for the second point.
y2Coordinate for the second point.
x3Coordinate for the third point.
y3Coordinate 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.

  Copyright © 2015, Cycling '74