jit.mgraphics
Description
The jit.mgraphics object supports drawing 2D vector graphics with the MGraphics API.
Examples

2D Vector Graphics
Discussion
This is the Max wrapper for the JGraphics API. Documentation on JGraphics is available online http://www.cycling74.com/sdk/MaxSDK-5.1.1/html/group__jgraphics.html . They are both loosely based on the API of http://cairographics.org . When looking at the JGraphics documentation, the functions don't pass in t_jgraphics *. Otherwise arguments are similar.
Matrix Operator
matrix inputs:0, matrix outputs:1
Name | IOProc | Planelink | Typelink | Dimlink | Plane | Dim | Type |
---|---|---|---|---|---|---|---|
out | n/a | 1 | 1 | 1 | 4 | 1 | char |
More about Matrix Operators
The Jitter MOP
MOP Arguments
MOP Attributes
MOP Messages
Attributes
autofill [int]
Automatically fill paths when closed.
dim [2 ints]
Dimensions.
relative_coords [int]
Use relative coordinates (0.-1. rather than pixels).
Common Box Attributes
Messages
append_path
Arguments
path
[symbol]
Add a path to a graphics context.
arc
Arguments
xc
[float]
yc [float]
radius [float]
angle1 [float]
angle2 [float]
yc [float]
radius [float]
angle1 [float]
angle2 [float]
Add a circular, clockwise, arc to the current path.
arc_negative
Arguments
xc
[float]
yc [float]
radius [float]
angle1 [float]
angle2 [float]
yc [float]
radius [float]
angle1 [float]
angle2 [float]
Add a circular, counter-clockwise, arc to the current path.
attr_setfill
Fill a pattern with a named style color
clear_surface
Clear the drawing surface and reset to it's initial state.
close_path
Close the current path in a context.
curve_to
Arguments
x1
[float]
y1 [float]
x2 [float]
y2 [float]
x3 [float]
y3 [float]
y1 [float]
x2 [float]
y2 [float]
x3 [float]
y3 [float]
Add a cubic Bezier spline to the current path.
device_to_user
Arguments
x
[float]
y [float]
y [float]
Converts device coordinates to user coordinates. User coordinates are those passed to drawing functions. Device coordinates are those of the display device. The result is sent out the dumpout outlet with a
prefix. ellipse
Arguments
x
[float]
y [float]
width [float]
height [float]
y [float]
width [float]
height [float]
Add a closed elliptical path in the context.
fill
Fill the current path, discarding the path once filled.
fill_extents
Return the current path's extents if filled. The result is 4 floating point numbers of the form x1, y1, x2, y2, and is sent out the dumpout outlet with a
prefix. fill_preserve
Fill the current path, preserving the path for further path operations.
fill_preserve_with_alpha
Arguments
alpha
[float]
Fill the current path, applying a global alpha, and preserving the path for further path operations.
fill_with_alpha
Arguments
alpha
[float]
Fill the current path, applying a global alpha, and discarding the path once filled.
font_extents
Return the extents of the currently selected font. The result is 3 floating point numbers of the form ascent, descent, height, and is sent out the dumpout outlet with a
prefix. get_current_point
Get the current location of the cursor in a graphics context. The result is sent out the dumpout outlet with a
prefix. get_line_cap
Return the current line cap style. The result is a symbol, and is sent out the dumpout outlet with a
prefix. get_line_join
Return the current line join style. The result is a symbol, and is sent out the dumpout outlet with a
prefix. get_line_width
Return the current line width. The result is a floating point number, and is sent out the dumpout outlet with a
prefix. get_matrix
Return the transform matrix. The result is 6 floating point numbers of the form xx, yx, xy, yy, x0, y0, and is sent out the dumpout outlet with a
prefix. getfontlist
Return the current font list. The result is a list of symbols, and is sent out the dumpout outlet with a
prefix. identity_matrix
Set the current transform to be the identity matrix.
image_surface_create
Arguments
name
[symbol]
source [symbol]
width [float]
height [float]
source [symbol]
width [float]
height [float]
Create a named image surface, filling with the contents of specified source. Source can be a file name or a matrix name.
image_surface_destroy
Arguments
name
[symbol]
Destroy a named image surface.
image_surface_draw
Arguments
source
[symbol]
Draw an image surface. Supports zoom, but not rotations. Source can be a surface name, file name or a matrix name.
image_surface_draw_fast
Arguments
source
[symbol]
Draw an image surface quickly. Does not support zoom or rotations. Source can be a surface name, file name or a matrix name.
image_surface_get_size
Arguments
name
[symbol]
Return the size of an image surface. The result is sent out the dumpout outlet with a
prefix. in_fill
Arguments
x
[float]
y [float]
y [float]
Check if a point is in the current path's fill region. The result is sent out the dumpout outlet with a
prefix. line_to
Arguments
x
[float]
y [float]
y [float]
Add a line segment to the current path.
move_to
Arguments
x
[float]
y [float]
y [float]
Move the cursor to a new point and begin a new subpath.
new_path
Begin a new path.
ovalarc
Arguments
xc
[float]
yc [float]
radiusx [float]
radiusy [float]
angle1 [float]
angle2 [float]
yc [float]
radiusx [float]
radiusy [float]
angle1 [float]
angle2 [float]
Add a non-circular arc to the current path.
paint
Paint current source in entire current clip region.
paint_with_alpha
Paint current source with alpha in entire current clip region.
parentpaint
This is primarily used for jspainter functionality to tell the parent object to call it's native paint method.
path_roundcorners
Arguments
corner_radius
[float]
Round out any corners in a path.
pattern_add_color_stop_rgba
Arguments
pattern_name
[symbol]
offset [float]
red [float]
green [float]
blue [float]
alpha [float]
offset [float]
red [float]
green [float]
blue [float]
alpha [float]
Add a color stop to a gradient pattern.
pattern_create_for_surface
Arguments
pattern_name
[symbol]
source [symbol]
source [symbol]
Create a named image pattern, filling with the contents of specified source. Source can be an image surface name, a file name, or a matrix name.
pattern_create_linear
Arguments
pattern_name
[symbol]
x0 [float]
y0 [float]
x1 [float]
y1 [float]
x0 [float]
y0 [float]
x1 [float]
y1 [float]
Create a named linear gradient pattern.
pattern_create_radial
Arguments
pattern_name
[symbol]
cx0 [float]
cy0 [float]
radius0 [float]
cx1 [float]
cy1 [float]
radius1 [float]
cx0 [float]
cy0 [float]
radius0 [float]
cx1 [float]
cy1 [float]
radius1 [float]
Create a named radial gradient pattern.
pattern_create_rgba
Arguments
pattern_name
[symbol]
red [float]
green [float]
blue [float]
alpha [float]
red [float]
green [float]
blue [float]
alpha [float]
Create a named solid color pattern.
pattern_destroy
Arguments
pattern_name
[symbol]
Destroy a named pattern.
pattern_get_extend
Arguments
pattern_name
[symbol]
Get the pattern's extend mode. The result is sent out the dumpout outlet with a
prefix. pattern_get_matrix
Arguments
pattern_name
[symbol]
Get the pattern's transform matrix. The result is sent out the dumpout outlet with a
prefix. pattern_get_type
Arguments
pattern_name
[symbol]
Get the pattern's type. The result is sent out the dumpout outlet with a
prefix. pattern_identity_matrix
Arguments
pattern_name
[symbol]
Set the pattern's transform matrix to the identity matrix.
pattern_rotate
Arguments
pattern_name
[symbol]
radians [float]
radians [float]
Rotate the pattern's transform matrix.
pattern_scale
Arguments
pattern_name
[symbol]
sx [float]
sy [float]
sx [float]
sy [float]
Scale the pattern's transform matrix.
pattern_set_extend
Arguments
pattern_name
[symbol]
extend_mode [symbol]
extend_mode [symbol]
Set a pattern's extend mode. Values can be: none, repeat, reflect, or pad. However, many of these are not implemented for various pattern types.
pattern_set_matrix
Arguments
pattern_name
[symbol]
xx [float]
xy [float]
yx [float]
yy [float]
x0 [float]
y0 [float]
xx [float]
xy [float]
yx [float]
yy [float]
x0 [float]
y0 [float]
Set the pattern's transform matrix.
pattern_translate
Arguments
pattern_name
[symbol]
tx [float]
ty [float]
tx [float]
ty [float]
Translate the pattern's transform matrix.
pop_group_to_source
Pops the current group to the current source pattern.
push_group
Temporarily redirects drawing to an intermediate surface known as a group. Use pop_group, pop_group_to_source, or pop_group_to_surface to use it.
rectangle
Arguments
x
[float]
y [float]
width [float]
height [float]
y [float]
width [float]
height [float]
Add a closed rectangle path in the context.
rectangle_rounded
Arguments
x
[float]
y [float]
width [float]
height [float]
ovalwidth [float]
ovalheight [float]
y [float]
width [float]
height [float]
ovalwidth [float]
ovalheight [float]
Add a closed rounded-rectangle path in the context.
rel_curve_to
Arguments
x1
[float]
y1 [float]
x2 [float]
y2 [float]
x3 [float]
y3 [float]
y1 [float]
x2 [float]
y2 [float]
x3 [float]
y3 [float]
Add a cubic Bezier spline to the current path, using coordinates relative to the current point.
rel_line_to
Arguments
x
[float]
y [float]
y [float]
Add a line segment to the current path, using coordinates relative to the current point.
rel_move_to
Arguments
x
[float]
y [float]
y [float]
Move the cursor to a new point and begin a new subpath, using coordinates relative to the current point.
restore
Restores the saved graphics settings ("pops" the graphics state stack).
rotate
Arguments
radians
[float]
Rotate the transform matrix.
save
Saves the current graphics settings to be restored later ("pushes" the graphics state stack).
scale
Arguments
tx
[float]
ty [float]
ty [float]
Scale the transform matrix.
scale_source_rgba
Arguments
redscale
[float]
greenscale [float]
bluescale [float]
alphascale [float]
greenscale [float]
bluescale [float]
alphascale [float]
Set the source color transform's scale factor.
select_font_face
Arguments
fontfamily
[symbol]
slant [symbol]
weight [symbol]
slant [symbol]
weight [symbol]
Specify a font for a graphics context. The
may be or , and The may be or . set_dash
Arguments
dash-length
[float]
gap-length [float]
gap-length [float]
Sets the line drawing style to a dash. The first argument sets the dash length, and the second sets the gap length.
set_font_size
Arguments
size
[float]
Specify the font size.
set_line_cap
Arguments
style
[symbol]
Set the current line cap style. Values can be: butt, round, or square.
set_line_join
Arguments
style
[symbol]
Set the current line join style. Values can be: miter, round, or bevel.
set_line_width
Arguments
width
[float]
Set the current line width.
set_matrix
Arguments
xx
[float]
xy [float]
yx [float]
yy [float]
x0 [float]
y0 [float]
xy [float]
yx [float]
yy [float]
x0 [float]
y0 [float]
Set the transform matrix.
set_source
Arguments
source
[symbol]
Set the current source to the named pattern or image surface.
set_source_rgb
Arguments
red
[float]
green [float]
blue [float]
green [float]
blue [float]
Set the current source color.
set_source_rgba
Arguments
red
[float]
green [float]
blue [float]
alpha [float]
green [float]
blue [float]
alpha [float]
Set the current source color.
set_source_surface
Arguments
source
[symbol]
Set the current source to the named image surface or file name.
show_text
Arguments
text
[symbol]
Display text at the current position.
stroke
Stroke the current path, discarding the path once filled.
stroke_preserve
Stroke the current path, preserving the path for further path operations.
stroke_preserve_with_alpha
Arguments
alpha
[float]
Stroke the current path, applying a global alpha, and preserving the path for further path operations.
stroke_with_alpha
Arguments
alpha
[float]
Stroke the current path, applying a global alpha, and discarding the path once filled.
svg_create
Arguments
svg_name
[symbol]
source [symbol]
source [symbol]
Create a named svg object, filling with the contents of specified source. Source can be a file name, or an XML svg string.
svg_destroy
Arguments
svg_name
[symbol]
Destroy a named svg object.
svg_get_size
Arguments
svg_name
[symbol]
Get a named svg object's size. The result is sent out the dumpout outlet with a
prefix. svg_render
Arguments
svg_name
[symbol]
Render a named svg object.
svg_set
Arguments
svg_name
[symbol]
Reuse an existing SVG object that was created with
. text_measure
Arguments
text
[symbol]
Return the width and height of a string given current graphics settings in a context. The result is sent out the dumpout outlet with a
prefix. text_path
Arguments
text
[symbol]
Add a path of text to the current path.
transform
Arguments
xx
[float]
xy [float]
yx [float]
yy [float]
x0 [float]
y0 [float]
xy [float]
yx [float]
yy [float]
x0 [float]
y0 [float]
Multiply the transform matrix by another matrix.
translate
Arguments
tx
[float]
ty [float]
ty [float]
Translate the transform matrix.
translate_source_rgba
Arguments
redoffset
[float]
greenoffset [float]
blueoffset [float]
alphaoffset [float]
greenoffset [float]
blueoffset [float]
alphaoffset [float]
Set the source color transform's offset values.
user_to_device
Arguments
x
[float]
y [float]
y [float]
Converts user coordinates to device coordinates. User coordinates are those passed to drawing functions. Device coordinates are those of the display device. The result is sent out the dumpout outlet with a
prefix. See Also
Name | Description |
---|---|
jit.lcd | |
jit.gl.sketch | |
jsui | |
MGraphics Quick Start Guide | MGraphics Quick Start Guide |