Files
armorpaint/base/assets/plugins/import_gpl.js
T

48 lines
1.4 KiB
JavaScript
Raw Normal View History

2024-03-13 23:50:11 +01:00
2024-11-08 23:46:39 +01:00
function import_gpl(path, replace_existing) {
let b = data_get_blob(path);
2024-03-13 23:50:11 +01:00
// let swatches: TSwatchColor[] = [];
// let str: string = sys_buffer_to_string(b);
2025-01-17 09:51:53 +01:00
// let lines: string[] = string_split(str, "\\n");
2024-03-13 23:50:11 +01:00
// // GIMP's color palette importer: https://gitlab.gnome.org/GNOME/gimp/-/blob/gimp-2-10/app/core/gimppalette-load.c#L39
2024-03-20 16:13:54 +01:00
// if (!starts_with(lines[0], "GIMP Palette")) {
2024-03-13 23:50:11 +01:00
// console_error(tr("Not a valid GIMP color palette"));
// return;
// }
// let delimiter: string = ~/\s+/ig;
// for (let line of lines) {
2024-03-20 16:13:54 +01:00
// if (starts_with(line, "Name:")) continue;
// else if (starts_with(line, "Columns:")) continue;
// else if (starts_with(line, "#")) continue;
2024-03-13 23:50:11 +01:00
// else {
2024-03-20 16:13:54 +01:00
// let tokens: string[] = string_split(delimiter, line);
2024-03-13 23:50:11 +01:00
// if (tokens.length < 3) continue;
2024-05-03 21:29:39 +02:00
// let swatch: TSwatchColor = makeSwatch(Color.fromBytes(tokens[0], tokens[1], tokens[2]));
2024-03-20 16:13:54 +01:00
// array_push(swatches, swatch);
2024-03-13 23:50:11 +01:00
// }
// }
// if (replaceExisting) {
// raw.swatches = [];
// if (swatches.length == 0) { // No swatches contained
2024-03-20 16:13:54 +01:00
// array_push(raw.swatches, makeSwatch());
2024-03-13 23:50:11 +01:00
// }
// }
// if (swatches.length > 0) {
// for (let s of swatches) {
2024-03-20 16:13:54 +01:00
// array_push(raw.swatches, s);
2024-03-13 23:50:11 +01:00
// }
// }
}
2024-11-08 23:46:39 +01:00
let plugin = plugin_create();
2025-01-17 09:51:53 +01:00
// path_swatch_importers_set("gpl", import_gpl);
2024-11-08 23:46:39 +01:00
plugin_notify_on_delete(plugin, function() {
2025-01-17 09:51:53 +01:00
// path_swatch_importers_delete("gpl");
2024-11-08 23:46:39 +01:00
});