/tg/ Station 13 - Modules - Types

code/__HELPERS/icons.dm

/proc/rgb2hsvConverts an rgb color into a list storing hsva Exists because it's useful to have a guaranteed alpha value
/proc/hsv2rgbConverts a list storing hsva into an rgb color
/proc/getFlatIconCreate a single /icon from a given /atom or /image.
/proc/generate_icon_alpha_maskHelper proc to generate a cutout alpha mask out of an icon.
/proc/get_flat_human_icon
/proc/get_flat_existing_human_iconA simpler version of get_flat_human_icon() that uses an existing human as a base to create the icon. Does not feature caching yet, since I could not think of a good way to cache them without having a possibility of using the cached version when we don't want to, so only use this proc if you just need this flat icon generated once and handle the caching yourself if you need to access that icon multiple times, or refactor this proc to feature caching of icons.
/proc/generate_and_hash_rsc_filegenerates a filename for a given asset. like generate_asset_name(), except returns the rsc reference and the rsc file hash as well as the asset name (sans extension) used so that certain asset files don't have to be hashed twice
/proc/generate_asset_nameGenerate a filename for this asset The same asset will always lead to the same asset name (Generated names do not include file extention.)
/proc/get_dummy_savefileGets a dummy savefile for usage in icon generation. Savefiles generated from this proc will be empty.
/proc/icon2base64Converts an icon to base64. Operates by putting the icon in the iconCache savefile, exporting it as text, and then parsing the base64 from that. (This relies on byond automatically storing icons in savefiles as base64)
/proc/is_valid_dmi_filegiven a text string, returns whether it is a valid dmi icons folder path
/proc/get_icon_dmi_pathgiven an icon object, dmi file path, or atom/image/mutable_appearance, attempts to find and return an associated dmi file path. a weird quirk about dm is that /icon objects represent both compile-time or dynamic icons in the rsc, but stringifying rsc references returns a dmi file path ONLY if that icon represents a completely unchanged dmi file from when the game was compiled. so if the given object is associated with an icon that was in the rsc when the game was compiled, this returns a path. otherwise it returns ""
/proc/icon2htmlgenerate an asset for the given icon or the icon of the given appearance for [thing], and send it to any clients in target. Arguments:
/proc/center_imageCenter's an image. Requires: The Image The x dimension of the icon file used in the image The y dimension of the icon file used in the image eg: center_image(image_to_center, 32,32) eg2: center_image(image_to_center, 96,96)
/proc/icon_existsChecks if the given iconstate exists in the given file, caching the result. Setting scream to TRUE will print a stack trace ONCE.
/proc/get_size_in_tilesReturns the size of the sprite in tiles. Takes the icon size and divides it by the world icon size (default 32). This gives the size of the sprite in tiles.
/proc/get_icon_dimensionsReturns a list containing the width and height of an icon file
/proc/get_small_overlayFikou's fix for making toast alerts look nice - resets offsets, transforms to fit
/proc/strip_appearance_underlaysStrips all underlays on a different plane from an appearance. Returns the stripped appearance.