Implement writing image and half the platte information
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::{gui::{self, main_tab::MainTab, MutexTIMManager, VRAM_HEIGHT, VRAM_WI
|
||||
use super::FileTab;
|
||||
use rfd::FileDialog;
|
||||
use slint::SharedString;
|
||||
use tim_tool::logic::{project::{Job, Project}, tim::types::Encoding};
|
||||
use tim_tool::logic::{project::{Job, PaletteRect, Project}, tim::types::Encoding};
|
||||
use tool_helper::Error;
|
||||
|
||||
pub(super) fn on_browse_file(tim_manager: MutexTIMManager) -> impl FnMut(&mut FileTab, &MainWindow) -> Result<(), Error> + 'static {
|
||||
@@ -34,7 +34,7 @@ pub(super) fn on_browse_file(tim_manager: MutexTIMManager) -> impl FnMut(&mut Fi
|
||||
};
|
||||
}
|
||||
|
||||
pub(super) fn on_update_palette_size(tim_manager: MutexTIMManager) -> impl FnMut(&mut FileTab, &MainWindow, u32, u32) -> Result<(), Error> + 'static {
|
||||
pub(super) fn on_update_palette_size(tim_manager: MutexTIMManager) -> impl FnMut(&mut FileTab, &MainWindow, u16, u16) -> Result<(), Error> + 'static {
|
||||
return move |file_tab, _main_window, width, height| -> Result<(), Error> {
|
||||
file_tab.update_palette(tim_manager.lock().expect("VRAM already locked").change_unadded_tim_palette_size(width, height)?);
|
||||
Ok(())
|
||||
@@ -93,7 +93,12 @@ pub(super) fn on_save_project_clicked(tim_manager: MutexTIMManager) -> impl FnMu
|
||||
let prev_job = std::mem::replace(&mut cur_job, None);
|
||||
|
||||
if let Some(tim) = tim {
|
||||
cur_job = Some(Job::new(file_name, tim.get_path()));
|
||||
let mut job = Job::new(file_name, tim.get_path(), (vram.x as u16, vram.y as u16));
|
||||
|
||||
if let Some((width, height)) = tim.get_palette_size() {
|
||||
job.add_palette(PaletteRect::new(0, 0, width, height));
|
||||
}
|
||||
cur_job = Some(job);
|
||||
}
|
||||
prev_job
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user