Support pre-view of palette
This commit is contained in:
@@ -14,9 +14,10 @@ component ProjectWidget inherits Rectangle {
|
||||
component ConvertImageWidget inherits Rectangle {
|
||||
in-out property <string> image_path;
|
||||
in-out property <image> image_data;
|
||||
in-out property <image> image_palette_data;
|
||||
in-out property <image> palette_data;
|
||||
in-out property <string> image_name;
|
||||
in-out property <bool> enable_button: false;
|
||||
in-out property <bool> palette_visible: false;
|
||||
|
||||
callback browse_clicked();
|
||||
callback add_clicked();
|
||||
@@ -80,10 +81,11 @@ component ConvertImageWidget inherits Rectangle {
|
||||
background: #404040;
|
||||
border-color: #808080;
|
||||
border-width: 4px;
|
||||
Image {
|
||||
palette_image := Image {
|
||||
width: 256px;
|
||||
height: 256px;
|
||||
source: root.image_palette_data;
|
||||
source: root.palette_data;
|
||||
visible: root.palette_visible;
|
||||
image-fit: contain;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
@@ -114,11 +116,22 @@ component ConvertImageWidget inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function set_palette_image(image: image) {
|
||||
palette_image.source = image;
|
||||
palette_image.visible = true;
|
||||
}
|
||||
|
||||
public function clear_palette_image() {
|
||||
palette_image.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
export component FileTab inherits Rectangle {
|
||||
in-out property <string> conv_image_path;
|
||||
in-out property <image> conv_image_data;
|
||||
in-out property <image> conv_palette_data;
|
||||
in-out property <bool> conv_palette_enable;
|
||||
in-out property <string> conv_image_name;
|
||||
in-out property <bool> conv_image_enable;
|
||||
in-out property <State> state;
|
||||
@@ -155,11 +168,13 @@ export component FileTab inherits Rectangle {
|
||||
if root.state == State.Project : ProjectWidget {
|
||||
}
|
||||
if root.state == State.ConvertImage : ConvertImageWidget {
|
||||
image_path <=> root.conv_image_path;
|
||||
image_data <=> root.conv_image_data;
|
||||
image_name <=> root.conv_image_name;
|
||||
enable_button <=> root.conv_image_enable;
|
||||
|
||||
image_path <=> root.conv_image_path;
|
||||
image_data <=> root.conv_image_data;
|
||||
palette_data <=> root.conv_palette_data;
|
||||
palette_visible <=> root.conv_palette_enable;
|
||||
image_name <=> root.conv_image_name;
|
||||
enable_button <=> root.conv_image_enable;
|
||||
|
||||
browse_clicked => {
|
||||
root.conv_image_browse_clicked();
|
||||
}
|
||||
|
Reference in New Issue
Block a user