Integrate all the progress into master #6
|
@ -96,10 +96,20 @@ fn encode<T: PSXImageConverter>(image: T, color_depth: ColorType, clut_align: Cl
|
|||
let palette = image.get_palette();
|
||||
let (pal_width, pal_height) = {
|
||||
if let Some(palette) = &palette {
|
||||
let pal_length_adjusted = {
|
||||
let pal_length = palette.len();
|
||||
if pal_length <= 16 {
|
||||
16u16
|
||||
}
|
||||
|
||||
else {
|
||||
256u16
|
||||
}
|
||||
};
|
||||
match clut_align {
|
||||
ClutAlignment::None |
|
||||
ClutAlignment::Linear => (palette.len() as u16, 1u16),
|
||||
ClutAlignment::Block => (16u16, (palette.len()/16) as u16),
|
||||
ClutAlignment::Linear => (pal_length_adjusted, 1u16),
|
||||
ClutAlignment::Block => (16u16, pal_length_adjusted/16u16),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue