Skip to content

Templates

abbie edited this page May 20, 2023 · 2 revisions

Like other image editors, Rawky has templates for new files. These specify the image size the template will have and a list of Guides that'll be applied to the file

File API

Files can be place in the users /template folder or for devs can be extracted out to it on launch using the following code in your plugin

FileUtils.copyResourcesRecursively(
    MyPlugin::class.java.getResource("/template"),
    RawkyPlugin.templateFolder
)

JSON

Templates are written in JSON, where just the name, width, height and guide file are given

{
  "name": "template",
  "width": 1920,
  "height": 1080,
  "guides": ["guide"]
}

Code API

A Template object can be added to the class's registry like so

Template.registry["template"] = Template(
    name = "template",
    width = 1920,
    height = 1080,
    guides = listOf("template")
)