update todo

This commit is contained in:
Reid 2023-10-06 15:54:44 -07:00
parent 4657c177b0
commit c03fc13b76
Signed by: reidlab
GPG key ID: 6C9EAA3364F962C8
3 changed files with 12 additions and 13 deletions

View file

@ -1,6 +1,6 @@
# gd-icon-renderer
rust geometryd ash icon redner!! shout out to [gd-icon-renderer](https://github.com/oatmealine/gd-icon-renderer) oat
A rust Geometry Dash icon renderer. Shhout out to [gd-icon-renderer](https://github.com/oatmealine/gd-icon-renderer), this project is just a rewrite but not in libvips and crystal
## usage
@ -8,7 +8,7 @@ Provide your `GJ_GameSheet02-uhd`, `GJ_GameSheetGlow-uhd`, `Robot_AnimDesc2`, an
## todo
- use custom plist parser. current one takes like 5 seconds to parse an animation file
- swap to a custom plist parser
- change zany anim to argument
- trim empty alpha space (robtop didnt make the bounds correctly :sob:)
- i think theres some slight shifting in the transform to do with rotation. investigate plz. really big on spider 16 for some reason????
- trim empty alpha space
- i think theres some weird shifting and offsets going on. investigate plz. really big on spider 16 for some reason???? related issue here: [issue #2, oatmealine/gd-icon-renderer](https://github.com/oatmealine/gd-icon-renderer/issues/2)

View file

@ -14,14 +14,14 @@ mod tests {
use std::time::Instant;
#[test]
fn it_works() {
fn render_test() {
let game_sheet_02 = load_spritesheet("assets/GJ_GameSheet02-uhd.plist");
let game_sheet_glow = load_spritesheet("assets/GJ_GameSheetGlow-uhd.plist");
let robot_sheet = load_animations("assets/Robot_AnimDesc2.plist");
let spider_sheet = load_animations("assets/Spider_AnimDesc2.plist");
let start = Instant::now();
let rendered_icon = render_icon("ship", 44, [0.0, 0.0, 0.0], [255.0/255.0, 125.0/255.0, 125.0/255.0], true, game_sheet_02, game_sheet_glow, robot_sheet, spider_sheet);
let rendered_icon = render_icon("spider", 16, [0.0, 0.0, 0.0], [255.0/255.0, 125.0/255.0, 125.0/255.0], true, game_sheet_02, game_sheet_glow, robot_sheet, spider_sheet);
let end = start.elapsed();
println!("time taken to render: {:?}", end);

View file

@ -67,7 +67,7 @@ fn transform(image: &DynamicImage, color: Option<[f32; 3]>, scale: Option<(f32,
let mut canvas = ImageBuffer::new(cmp::max(trig_width, width), cmp::max(trig_height, height));
canvas.copy_from(&transformed_image, transform_x, transform_y).expect("couldnt copy from img");
canvas = rotate_about_center(&canvas, radians, Interpolation::Bilinear, Rgba([0, 0, 0, 0]));
transformed_image = DynamicImage::ImageRgba8(canvas);
}
@ -90,14 +90,13 @@ pub fn render_layered(images: Vec<DynamicImage>, positions: Vec<Option<(f32, f32
let bounding_box = sizes
.iter()
.enumerate()
.fold((0, 0), |acc, (i, &size)| {
.map(|(i, &size)| {
let (width, height) = size;
let (x, y) = positions.get(i).cloned().unwrap_or((0.0, 0.0));
(
cmp::max(acc.0, (width as f32 + x.abs() * 2.0) as i32),
cmp::max(acc.1, (height as f32 + y.abs() * 2.0) as i32)
)
((width as f32 + x.abs() * 2.0) as i32, (height as f32 + y.abs() * 2.0) as i32)
})
.fold((0, 0), |acc, size| {
(cmp::max(acc.0, size.0), cmp::max(acc.1, size.1))
});
let mut canvas = ImageBuffer::new(bounding_box.0 as u32, bounding_box.1 as u32);