Skip to content

Commit

Permalink
feat(icon): Add the new save() api.
Browse files Browse the repository at this point in the history
  • Loading branch information
e3ndr committed Sep 2, 2024
1 parent ef1cc3e commit 36a04b2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api/src/main/java/co/casterlabs/saucer/utils/SaucerIcon.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package co.casterlabs.saucer.utils;

import java.nio.file.Path;

import org.jetbrains.annotations.Nullable;

import com.sun.jna.Library;
Expand Down Expand Up @@ -56,6 +58,16 @@ public boolean isEmpty() {
return N.saucer_icon_empty(this);
}

/**
* @implNote On GTK, macOS, and Windows, this saves as a PNG.
* @implNote On QT, BMP, JPG, GIF, PNG, and various X-specific formats are
* supported.
* @implNote <b>It is recommended you stick to PNG for compatibility.</b>
*/
public void saveToFile(@NonNull Path target) {
N.saucer_icon_save(this, target.toAbsolutePath().toString());
}

/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------ */
Expand All @@ -69,6 +81,8 @@ static interface _Native extends Library {

boolean saucer_icon_empty(SaucerIcon instance);

boolean saucer_icon_save(SaucerIcon instance, String path);

}

}

0 comments on commit 36a04b2

Please sign in to comment.