Files
armorpaint/base/Sources/import_gpl.ts
T

43 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-03-13 23:50:11 +01:00
function import_gpl_run(path: string, replace_existing: bool) {
2024-03-20 16:13:54 +01:00
let b: buffer_t = data_get_blob(path);
2024-03-13 23:50:11 +01:00
// let swatches: TSwatchColor[] = [];
// let str: string = sys_buffer_to_string(b);
2024-03-20 16:13:54 +01:00
// let lines: string[] = string_split(str, "\n");
2024-03-13 23:50:11 +01:00
2024-03-20 16:13:54 +01:00
// let view: buffer_view_t = buffer_view_create(b);
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-03-20 16:13:54 +01:00
// let swatch: TSwatchColor = makeSwatch(Color.fromBytes(any_to_string(tokens[0]), any_to_string(tokens[1]), any_to_string(tokens[2])));
// 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
// }
// }
}