SVG spritesheets
An .svg spritesheet loads through lunasvg (now part of the core library) at one pixel per SVG unit, so regions, crops and picking work as for PNGs. The preview, renders and CLI draw it again, cached per power-of-two zoom level up to 8x, so it stays sharp when zoomed or scaled. Its pixels aren't edited (pencil, eraser, pack and merge leave it alone, and Save skips it), and the Isaac warning counts SVG sheets since the game can't load them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b31a28ebe9
commit
a917d8ae97
21 files changed
+178
-21
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
@@ -181,3 +181,26 @@ TEST_CASE("a blurred layer spreads past its crop like Flash's blur filter")
|
||||
REQUIRE(resource::Image::write_pixels_png(OUTPUT_DIR / "spin_blur_frame_0.png", glm::ivec2(fixture.canvas->size),
|
||||
blurred.data()));
|
||||
}
|
||||
|
||||
TEST_CASE("SVG spritesheets draw sharp at any scale")
|
||||
{
|
||||
RenderFixture fixture("vector.anm2");
|
||||
if (!fixture.gl.is_valid())
|
||||
{
|
||||
MESSAGE("skipped: no OpenGL context");
|
||||
return;
|
||||
}
|
||||
REQUIRE(fixture.document->is_valid());
|
||||
|
||||
// Drawn at 600% (200% frames at a 3x render), the circle's edge stays within a pixel or two: just inside it is
|
||||
// solid red, just outside it clear.
|
||||
auto pixels = fixture.frame_get(0.0f);
|
||||
auto inside = fixture.pixel_get(pixels, {-20.0f + 13.0f, 0.0f});
|
||||
auto outside = fixture.pixel_get(pixels, {-20.0f + 14.6f, 0.0f});
|
||||
CHECK(inside.r > 200);
|
||||
CHECK(outside.r < 80);
|
||||
|
||||
REQUIRE(resource::Image::write_pixels_png(OUTPUT_DIR / "vector_frame_0.png", glm::ivec2(fixture.canvas->size),
|
||||
pixels.data()));
|
||||
golden_image_check("vector_frame_0.png");
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<AnimatedActor>
|
||||
<Info CreatedBy="fixture" CreatedOn="01/01/2026 12:00:00 PM" Fps="30" Version="2" ExtendedVersion="1"/>
|
||||
<Content>
|
||||
<Spritesheets>
|
||||
<Spritesheet Id="0" Path="vector.svg"/>
|
||||
</Spritesheets>
|
||||
<Layers>
|
||||
<Layer Id="0" Name="circle" SpritesheetId="0"/>
|
||||
<Layer Id="1" Name="square" SpritesheetId="0"/>
|
||||
</Layers>
|
||||
<Nulls/>
|
||||
<Events/>
|
||||
</Content>
|
||||
<Animations DefaultAnimation="Big">
|
||||
<Animation Name="Big" FrameNum="1" Loop="true">
|
||||
<RootAnimation>
|
||||
<Frame XPosition="0" YPosition="0" Delay="1" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</RootAnimation>
|
||||
<LayerAnimations>
|
||||
<LayerAnimation LayerId="0" Visible="true">
|
||||
<Frame XPivot="8" YPivot="8" XCrop="0" YCrop="0" Width="16" Height="16" XPosition="-20" YPosition="0" Delay="1" Visible="true" XScale="200" YScale="200" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true">
|
||||
<Frame XPivot="8" YPivot="8" XCrop="16" YCrop="0" Width="16" Height="16" XPosition="20" YPosition="0" Delay="1" Visible="true" XScale="200" YScale="200" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
</Animation>
|
||||
</Animations>
|
||||
</AnimatedActor>
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="16" viewBox="0 0 32 16">
|
||||
<circle cx="8" cy="8" r="7" fill="#e02020"/>
|
||||
<rect x="17" y="1" width="14" height="14" fill="#2040e0" transform="rotate(20 24 8)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 227 B |
Reference in new issue
Block a user