topic/jb/tim_tool/risize_image #18

Merged
jaby merged 5 commits from topic/jb/tim_tool/risize_image into main 2025-03-08 14:32:56 +00:00
3 changed files with 37 additions and 14 deletions
Showing only changes of commit 6375183624 - Show all commits

View File

@ -25,8 +25,11 @@ impl FileTab {
self.update_palette(palette);
let main_window = self.main_window.borrow();
let image_size = image.size();
main_window.set_file_tab_image_data(image);
main_window.set_file_tab_image_width(image_size.width as i32);
main_window.set_file_tab_image_height(image_size.height as i32);
if let Some(file_name) = file_name {
main_window.set_file_tab_image_name(file_name.into());
}

View File

@ -15,6 +15,8 @@ export component MainWindow inherits Window {
// Convert Image values
in-out property file_tab-browse_path <=> file_tab.conv-image_path;
in-out property file_tab-image_data <=> file_tab.conv-image_data;
in-out property file_tab-image_width <=> file_tab.conv-image_width;
in-out property file_tab-image_height <=> file_tab.conv-image_height;
in-out property file_tab-palette_data <=> file_tab.conv-palette_data;
in-out property file_tab-palette_width <=> file_tab.conv-palette_width;
in-out property file_tab-palette_height <=> file_tab.conv-palette_height;

View File

@ -15,6 +15,8 @@ component ConvertImageWidget inherits Rectangle {
in-out property <string> image_path;
in-out property <string> image_name;
in-out property <image> image_data;
in-out property <int> image-width;
in-out property <int> image-height;
in-out property <image> palette_data;
in-out property <int> palette_width: 0;
in-out property <int> palette_height: 0;
@ -59,18 +61,32 @@ component ConvertImageWidget inherits Rectangle {
padding: 4px;
HorizontalLayout {
alignment: center;
Rectangle {
width: 256px + 2*4px; // < Because of border
height: 256px + 2*4px; // < Because of border
background: #404040;
border-color: #808080;
border-width: 4px;
Image {
width: 256px;
height: 256px;
source: root.image_data;
image-fit: contain;
image-rendering: pixelated;
VerticalLayout {
Rectangle {
width: 256px + 2*4px; // < Because of border
height: 256px + 2*4px; // < Because of border
background: #404040;
border-color: #808080;
border-width: 4px;
Image {
width: 256px;
height: 256px;
source: root.image_data;
image-fit: contain;
image-rendering: pixelated;
}
}
VerticalLayout {
alignment: center;
Text {
text: "Width: " + root.image-width;
}
}
VerticalLayout {
alignment: center;
Text {
text: "Height: " + root.image-height;
}
}
}
Rectangle {
@ -172,17 +188,17 @@ component ConvertImageWidget inherits Rectangle {
}
export component FileTab inherits Rectangle {
// TODO: Names are messed up here!
in-out property <string> conv-image_path;
in-out property <string> conv-image_name;
in-out property <image> conv-image_data;
in-out property <int> conv-image_width;
in-out property <int> conv-image_height;
in-out property <image> conv-palette_data;
in-out property <int> conv-palette_width;
in-out property <int> conv-palette_height;
in-out property <bool> conv-palette_enable;
in-out property <bool> conv-enable_view;
in-out property <State> state;
callback conv-image_update_palette_size(int, int);
callback conv-image_browse_clicked;
@ -220,6 +236,8 @@ export component FileTab inherits Rectangle {
if root.state == State.ConvertImage : ConvertImageWidget {
image_path <=> root.conv-image_path;
image_data <=> root.conv-image_data;
image-width <=> root.conv-image_width;
image-height <=> root.conv-image_height;
palette_data <=> root.conv-palette_data;
palette_width <=> root.conv-palette_width;
palette_height <=> root.conv-palette_height;