Add DPI export targets

This commit is contained in:
GenevensiS
2025-12-04 18:12:10 +01:00
committed by GitHub
parent 2932d0007d
commit 4e197a75cb
7 changed files with 128 additions and 122 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ Bitmap export_bitmap(const SetP& set, const vector<CardP>& cards, bool scale_to_
Image export_image(const SetP& set, const CardP& card, const double zoom = 1.0, const Radians angle_radians = 0.0);
Image export_image(const SetP& set, const vector<CardP>& cards, bool scale_to_lowest_dpi = false, int padding = 0, const double zoom = 1.0, const Radians angle_radians = 0.0);
/// Export the image of one or more cards to a given filename
/// Export the image of one or more cards to a given filename, using the app's zoom and rotation settings
void export_image(const SetP& set, const CardP& card, const String& filename);
void export_image(const SetP& set, const vector<CardP>& cards, const String& path, const String& filename_template, FilenameConflicts conflicts);
+8 -5
View File
@@ -52,7 +52,7 @@ Rotation UnzoomedDataViewer::getRotation() const {
return Rotation(angle, stylesheet->getCardRect(), zoom, 1.0, ROTATION_ATTACH_TOP_LEFT);
}
double export_zoom = settings.stylesheetSettingsFor(set->stylesheetFor(card)).export_zoom();
double export_zoom = settings.exportZoomSettingsFor(set->stylesheetFor(card));
bool use_viewer_rotation = !settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_normal_export();
if (use_viewer_rotation) {
@@ -195,10 +195,13 @@ Image export_image(const SetP& set, const vector<CardP>& cards, bool scale_to_lo
return img;
}
void export_image(const SetP& set, const CardP& card, const String& filename) {
Image img = export_image(set, card);
img.SaveFile(filename); // can't use Bitmap::saveFile, it wants to know the file type
// but image.saveFile determines it automagicly
void export_image(const SetP& set, const CardP& card, const String& filename) {
const StyleSheet& stylesheet = set->stylesheetFor(card);
StyleSheetSettings& stylesheet_settings = settings.stylesheetSettingsFor(stylesheet);
double zoom = settings.exportZoomSettingsFor(stylesheet);
Radians angle = stylesheet_settings.card_normal_export() ? 0.0 : stylesheet_settings.card_angle() / 360.0 * 2.0 * M_PI;
Image img = export_image(set, card, zoom, angle);
img.SaveFile(filename);
}
void export_image(const SetP& set, const vector<CardP>& cards,