Display size of image
This commit is contained in:
parent
58b2f62d2f
commit
6375183624
|
@ -25,8 +25,11 @@ impl FileTab {
|
||||||
self.update_palette(palette);
|
self.update_palette(palette);
|
||||||
|
|
||||||
let main_window = self.main_window.borrow();
|
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_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 {
|
if let Some(file_name) = file_name {
|
||||||
main_window.set_file_tab_image_name(file_name.into());
|
main_window.set_file_tab_image_name(file_name.into());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ export component MainWindow inherits Window {
|
||||||
// Convert Image values
|
// Convert Image values
|
||||||
in-out property file_tab-browse_path <=> file_tab.conv-image_path;
|
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_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_data <=> file_tab.conv-palette_data;
|
||||||
in-out property file_tab-palette_width <=> file_tab.conv-palette_width;
|
in-out property file_tab-palette_width <=> file_tab.conv-palette_width;
|
||||||
in-out property file_tab-palette_height <=> file_tab.conv-palette_height;
|
in-out property file_tab-palette_height <=> file_tab.conv-palette_height;
|
||||||
|
|
|
@ -15,6 +15,8 @@ component ConvertImageWidget inherits Rectangle {
|
||||||
in-out property <string> image_path;
|
in-out property <string> image_path;
|
||||||
in-out property <string> image_name;
|
in-out property <string> image_name;
|
||||||
in-out property <image> image_data;
|
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 <image> palette_data;
|
||||||
in-out property <int> palette_width: 0;
|
in-out property <int> palette_width: 0;
|
||||||
in-out property <int> palette_height: 0;
|
in-out property <int> palette_height: 0;
|
||||||
|
@ -59,18 +61,32 @@ component ConvertImageWidget inherits Rectangle {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: center;
|
alignment: center;
|
||||||
Rectangle {
|
VerticalLayout {
|
||||||
width: 256px + 2*4px; // < Because of border
|
Rectangle {
|
||||||
height: 256px + 2*4px; // < Because of border
|
width: 256px + 2*4px; // < Because of border
|
||||||
background: #404040;
|
height: 256px + 2*4px; // < Because of border
|
||||||
border-color: #808080;
|
background: #404040;
|
||||||
border-width: 4px;
|
border-color: #808080;
|
||||||
Image {
|
border-width: 4px;
|
||||||
width: 256px;
|
Image {
|
||||||
height: 256px;
|
width: 256px;
|
||||||
source: root.image_data;
|
height: 256px;
|
||||||
image-fit: contain;
|
source: root.image_data;
|
||||||
image-rendering: pixelated;
|
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 {
|
Rectangle {
|
||||||
|
@ -172,17 +188,17 @@ component ConvertImageWidget inherits Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
export component FileTab 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_path;
|
||||||
in-out property <string> conv-image_name;
|
in-out property <string> conv-image_name;
|
||||||
in-out property <image> conv-image_data;
|
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 <image> conv-palette_data;
|
||||||
in-out property <int> conv-palette_width;
|
in-out property <int> conv-palette_width;
|
||||||
in-out property <int> conv-palette_height;
|
in-out property <int> conv-palette_height;
|
||||||
in-out property <bool> conv-palette_enable;
|
in-out property <bool> conv-palette_enable;
|
||||||
in-out property <bool> conv-enable_view;
|
in-out property <bool> conv-enable_view;
|
||||||
|
|
||||||
|
|
||||||
in-out property <State> state;
|
in-out property <State> state;
|
||||||
callback conv-image_update_palette_size(int, int);
|
callback conv-image_update_palette_size(int, int);
|
||||||
callback conv-image_browse_clicked;
|
callback conv-image_browse_clicked;
|
||||||
|
@ -220,6 +236,8 @@ export component FileTab inherits Rectangle {
|
||||||
if root.state == State.ConvertImage : ConvertImageWidget {
|
if root.state == State.ConvertImage : ConvertImageWidget {
|
||||||
image_path <=> root.conv-image_path;
|
image_path <=> root.conv-image_path;
|
||||||
image_data <=> root.conv-image_data;
|
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_data <=> root.conv-palette_data;
|
||||||
palette_width <=> root.conv-palette_width;
|
palette_width <=> root.conv-palette_width;
|
||||||
palette_height <=> root.conv-palette_height;
|
palette_height <=> root.conv-palette_height;
|
||||||
|
|
Loading…
Reference in New Issue