scarpet-graphics

Quick rating

scarpet-graphics

No reviews yet

Carpet extension with functions for scarpet, used for headless image manipulation (A wrapper of Processing)

API/Library
Mod Loaders
Fabric
Minecraft
26.2

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Unsupported
Server Required

About

Project Details

Type
Mod
License
MIT License
Authors

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

Modrinth ID

Resources

External Links

About

Description

scarpet-graphics

Discord

A wrapper of Processing for scarpet

This can also be used with Discarpet to send the created images via Discord.

Values

This extension adds these new scarpet values:

  • image: Wrapper for PImage
  • graphics: Wrapper for PGraphics, extends image value (meaning it can be used in the same way image can)
  • font: Wrapper for PFont

Colors are handled using numbers (0xRRGGBBAA in hex), but can be constructed from RGB and HSB using the color function.

Functions

For a more detailed documentation for these functions, see the Processing reference Most functions are just a wrapper function for the internal processing function. Sometimes they may have slightly different names than the original Processing functions, due to the name being already used by scarpet (e.g. copy()) or to group them (all draw_?() functions).

Graphics and Image functions

load_image(location, shared?)

Loads an image from the specified location (string). Can be a URL, or file name (path that works just like read_file). If shared is true, uses shared app storage. Returns an image value.

save_image(image, location, shared?)

Saves the image in the specified location (works like load_image)

create_graphics(width, height)

Creates a new graphics object with the specified dimensions.

copy_image(source, desination, sourceX, sourceY, sourceW, sourceH, destinationX, destinationY, destinationW, destinationH)

Copies pixels from one image/graphics to another.

get_pixel(image, x, y)

Returns the color of a certain pixel.

set_pixel(image, x, y, color)

Sets the pixel on the image to the color.

begin_draw(graphics)

Prepares the graphics object for doing drawing operations on it.

end_draw(graphics)

To be called when done drawing.

Drawing functions

See the 2D Primitives section in the processing reference. (The scarpet functions have draw_ prefixed with the processing function names)

draw_background(graphics, color)

draw_rect(graphics, a, b, c, d)

draw_ellipse(graphics, a, b, c, d)

draw_line(graphics, x1, y1, x2, y2)

draw_image(graphics, image, a, b, c, d)

draw_text(graphics, text, x, y)

Mode functions

color_mode(graphics, mode)

modes: 'RGB', 'HSB'

image_mode(graphics, mode)

modes: 'CORNER', 'CORNERS', 'CENTER'

ellipse_mode(graphics, mode)

modes: 'CORNER', 'CORNERS', 'CENTER', 'RADIUS'

rect_mode(graphics, mode)

modes: 'CORNER', 'CORNERS', 'CENTER', 'RADIUS'

Utility functions

color(graphics, v1, v2, v3, alpha)

Depending on the color_mode() set, v1,v2,v3 are either r,g,b or h,s,b values

fill(graphics, color)

no_fill(graphics)

stroken(graphics, color)

no_stroke(graphics)

stroke_weight(graphics, weight)

smooth(graphics)

no_smooth(graphics)

font_list() (Equivalent to PFont.list() in processing)

text_font(graphics, font)

text_size(graphics, size)

create_font(graphics, name, size, smooth?)

text_align(graphics, alignX, alignY)

Screenshots

Gallery

  • Example script
    Example script Demonstrating how some of the functions work

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

~4,000
Downloads
Last Updated
CurseForge
Modrinth
Created
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works