API reference
The complete scriptable surface, organized by domain. Every
entry below is a real binding registered by the
pixel-stroke-scripting crate and callable from any
Rhai script.
Two calling conventions appear:
ps_function(...) for free functions and
ps.method(...) for state-method style on the
implicit document handle. They're equivalent — pick whichever
reads cleanest in context.
Brush stable
ps_brush_size(px)— set brush diameter.ps_brush_opacity(0..1)— set base opacity.ps_brush_opacity_pct(0..100)— same, in percent.ps_brush_spacing(0..1)— fractional spacing between stamps.ps_brush_pixel_perfect(true|false)— toggle the diagonal-doubles filter.ps_brush_shape("round" | "square")— stamp shape.ps_brush_symmetry(0..4)— N-way radial symmetry.ps_brush_pressure_curve(...)— pressure → size/opacity mapping.- Getters:
ps_brush_get_size(),ps_brush_get_opacity(),ps_brush_get_shape(),ps_brush_get_spacing(),ps_brush_get_pixel_perfect().
Filters stable
ps_filter_blur(radius)ps_filter_box_blur(radius)ps_filter_brightness(amount)ps_filter_contrast(amount)ps_filter_saturation(amount)ps_filter_hue_shift(degrees)ps_filter_desaturate()ps_filter_invert()ps_filter_posterize(levels)ps_filter_pixelate(scale)ps_filter_outline(thickness)ps_filter_edge_detect(strength)ps_filter_emboss(strength)ps_filter_drop_shadow(dx, dy, color, alpha)
Layers stable
State-method style on ps:
ps.layer_count()ps.layer_add(name)— returns the new layer's index.ps.layer_select(index)ps.layer_active()ps.layer_remove(index)ps.layer_duplicate(index)ps.layer_reorder(from, to)ps.layer_merge_down(index)ps.layer_flatten_visible()ps.layer_name(index, name),layer_get_name(index)ps.layer_visible(index, bool),layer_get_visible(index)ps.layer_locked(index, bool),layer_get_locked(index)ps.layer_opacity(pct),layer_get_opacity(index)ps.layer_blend_mode(mode),layer_get_blend_mode(index)
Palette stable
ps_palette_new(name)ps_palette_delete(name)ps_palette_duplicate(name, new_name)ps_palette_list()— array of palette names.ps_palette_set_active(name)ps_palette_active_name(),ps_palette_active_colors()ps_palette_colors(name)ps_palette_add_color(name, hex)ps_palette_remove_color(name, index)ps_palette_set_color(name, index, hex)ps_palette_reorder(name, from, to)ps_palette_sort(name, mode)ps_palette_load_gpl(name, gpl_text)ps_palette_load_hex(name, hex_list)ps_palette_save_gpl(name),ps_palette_save_hex(name)
Selection stable
ps_selection_rect(x, y, w, h)ps_selection_ellipse(x, y, w, h)ps_selection_wand(x, y, tolerance)ps_selection_all()ps_selection_invert()ps_selection_clear()ps_selection_bounds()— returns(x, y, w, h).ps_selection_has()— bool, true if non-empty.ps_selection_ants(true|false)— toggle marching ants.
Artboard stable
ps_artboard_resize(w, h, zoom)ps_artboard_crop()— crop to current selection.ps_artboard_trim()— trim transparent borders.ps_artboard_scale(factor)ps_artboard_flip_h(),ps_artboard_flip_v()ps_center_viewport()
Drawing primitives stable
ps_draw_text(x, y, str, color)ps_ellipse_filled(x, y, w, h, color)ps.pixel_get(x, y)— returns hex.ps.pixel_set(x, y, hex)ps.pixel_fill(x1, y1, x2, y2, hex)ps.doc_width(),ps.doc_height()
Animation stable
ps.animation_duplicate_frame()ps_onion_skin_enable(true|false)ps_onion_skin_config(...)
File I/O stable
ps_file_open(path)ps_file_save(),ps_file_save_as(path)ps_file_export(format, path)ps_file_recent()— array of recent paths.ps_export_png(path)ps_atlas_pack_frames()ps_atlas_export_json(),ps_atlas_export_png()
Coming next soon
ps_stamp_*family — capture a stamp from a selection, save to the drawer, scrub through animated stamps with the mousewheel.ps_state_machine_*— first-class FSM bindings for building procedural tool behaviors.keybind.*andcmd.*namespaces for customizable shortcuts and command-palette entries.