Skip to content

Conversation

Y0SH1M4S73R
Copy link
Contributor

@Y0SH1M4S73R Y0SH1M4S73R commented Jul 16, 2025

This PR adds rustg_dmi_read_metadata to read metadata from a DMI, and rustg_dmi_inject_metadata to inject DMI metadata into a PNG-formatted file.

With rustg_dmi_inject_metadata, in conjunction with dmi_create_png's new support for alpha channels, it will now be possible to create arbitrary dmis from user-provided pixel data much faster than with BYOND's own icon operations.

Example Usage:

var/list/pixels = /* Some list containing 4096 rgba strings - 128 rows of 32 pixels, 32 rows per dir. */
rustg_dmi_create_png("output.dmi", "32", "128", pixels)
var/metadata = json_encode(list(\
  "width" = 32,\
  "height" = 32,\
  "states" = list(\
    list(\
      "name" = "",\
      "dirs" = 4,\
    )\
  )\
)
rustg_dmi_inject_metadata("output.dmi", metadata)

Copy link
Collaborator

@ZeWaka ZeWaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems a bit strange to add a way to inject without an ability to read

@Y0SH1M4S73R
Copy link
Contributor Author

seems a bit strange to add a way to inject without an ability to read

Well if you want a DMI metadata reading function to go with it, I can do that.

@Y0SH1M4S73R Y0SH1M4S73R changed the title DMI metadata injection DMI metadata reading and injection Jul 19, 2025
@ZeWaka ZeWaka merged commit da863cb into tgstation:master Jul 26, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants