mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-15 18:14:14 +02:00
Add an SVG export option to store pictures smaller
An SVG keeps every picture at full resolution, whatever size it is drawn at: a folio with 22 phone photos shown at a tenth of their size gave a 270 MB SVG and took 65 s to write, most of it compressing the photos again. The export dialog gets "SVG: smaller pictures" (off by default, kept with the other export settings), and --export-svg gets --svg-small-pictures. With it, a picture is stored at four times the size it is drawn at when that is smaller than the picture; smaller pictures stay whole. Four times is about 375 dpi on a printed folio. The exporter sets Diagram::smallPictures() for its own drawing only, so screen, print, PDF and PNG are unchanged. It is not part of applyProperties(), which every format uses. On that project: --export-svg 84.9 s -> 34.5 s (opening is 20 s of both), 270 MB -> 57 MB, peak memory 2.45 -> 1.86 GB. Rendered at twice the folio size, the two SVGs differ by more than 32/255 on 0.23 % of pixels, along photo detail. tst_svgsmallpictures: an 800x600 picture drawn at 0.1 is stored at 320x240 with the option, through --export-svg and through the dialog's QPicture route, and at 800x600 without it; a 40x30 picture stays whole. It fails when the factor is changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,7 @@ ExportProperties::ExportProperties() :
|
||||
draw_colored_conductors(true),
|
||||
dxf_blocks(false),
|
||||
dxf_attributes(false),
|
||||
svg_small_pictures(false),
|
||||
exported_area(QET::BorderArea)
|
||||
{
|
||||
}
|
||||
@@ -83,6 +84,8 @@ void ExportProperties::toSettings(QSettings &settings,
|
||||
dxf_blocks);
|
||||
settings.setValue(prefix % "dxfattributes",
|
||||
dxf_attributes);
|
||||
settings.setValue(prefix % "svgsmallpictures",
|
||||
svg_small_pictures);
|
||||
settings.setValue(prefix % "area",
|
||||
QET::diagramAreaToString(exported_area));
|
||||
}
|
||||
@@ -125,6 +128,8 @@ void ExportProperties::fromSettings(QSettings &settings,
|
||||
false).toBool();
|
||||
dxf_attributes = settings.value(prefix % "dxfattributes",
|
||||
false).toBool();
|
||||
svg_small_pictures = settings.value(prefix % "svgsmallpictures",
|
||||
false).toBool();
|
||||
|
||||
exported_area = QET::diagramAreaFromString(
|
||||
settings.value(
|
||||
|
||||
Reference in New Issue
Block a user