Fixed #1847 shape viewer and PDF exporter - correct drawing of pure vertical/horizontal shapes (zero width/height)

This commit is contained in:
Jindra Petřík
2022-10-23 10:56:31 +02:00
parent 1b136913b2
commit bfae9f6871
2 changed files with 8 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
- [#1834] PlaceObject4 tags appear as Unresolved inside of DefineSprite
- [#1839] Sprite frames exported incorrectly and repeating
- [#1838] AS3 - Properly handling of long unsigned values, hex values, default uint values etc.
- [#1847] shape viewer and PDF exporter - correct drawing of pure vertical/horizontal shapes (zero width/height)
### Changed
- AS3 integer values are internally (e.g. in the lib) handled as java int type instead of long.
@@ -2381,6 +2382,7 @@ All notable changes to this project will be documented in this file.
[#1834]: https://www.free-decompiler.com/flash/issues/1834
[#1839]: https://www.free-decompiler.com/flash/issues/1839
[#1838]: https://www.free-decompiler.com/flash/issues/1838
[#1847]: https://www.free-decompiler.com/flash/issues/1847
[#270]: https://www.free-decompiler.com/flash/issues/270
[#1718]: https://www.free-decompiler.com/flash/issues/1718
[#1801]: https://www.free-decompiler.com/flash/issues/1801

View File

@@ -167,7 +167,10 @@ public class BitmapExporter extends ShapeExporterBase {
ExportRectangle bounds = new ExportRectangle(shape.getBounds());
ExportRectangle transformedBounds = strokeTransformation.transform(bounds);
this.strokeTransformation = Matrix.getScaleInstance(transformedBounds.getWidth() / bounds.getWidth(), transformedBounds.getHeight() / bounds.getHeight());
this.strokeTransformation = Matrix.getScaleInstance(
Double.compare(bounds.getWidth(), 0.0d) == 0 /*horizontal line or single point */ ? 1 : transformedBounds.getWidth() / bounds.getWidth(),
Double.compare(bounds.getHeight(), 0.0d) == 0 /*vertical line or single point */ ? 1 : transformedBounds.getHeight() / bounds.getHeight()
);
graphics = (Graphics2D) image.getGraphics();
AffineTransform at = transformation.toTransform();
@@ -411,14 +414,8 @@ public class BitmapExporter extends ShapeExporterBase {
}
}
if (Double.isNaN(thickness) || Double.compare(thickness, 0.0d) == 0) { //for example when bounding box width/height is zero
lineStroke = null;
lineColor = null;
return;
} else {
if (thickness < 0) {
thickness = -thickness;
}
if (thickness < 0) {
thickness = -thickness;
}
if (joinStyle == BasicStroke.JOIN_MITER) {