Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MU3] Allow the user to customize background when exporting as PDF/PNG/SVG #7500

Closed

Conversation

sidharth-anand
Copy link
Contributor

Resolves: https://musescore.org/en/node/293370

This patch provides the user complete control over the background when exporting the score to a PDF/PNG/SVG file, allowing the user to choose between a transparent background, the background currently used in the score (both solid colors and images) or a custom color.

image

Note: To be able to see the transparent background when exporting as a pdf, you will have to turn on the "Show Transparency Grid" or equivalent option in your pdf viewer or the transparent area gets filled with white by default.

  • I signed CLA
  • I made sure the code in the PR follows the coding rules
  • I made sure the code compiles on my machine
  • I made sure there are no unnecessary changes in the code
  • I made sure the title of the PR reflects the core meaning of the issue you are solving
  • I made sure the commit message(s) contain a description and answer the question "Why do those changes fix that particular issue?" or "Why are those changes really necessary as improvements?"
  • I made sure the commit message title starts with "fix #424242:" if there is a related issue
  • I created the test (mtest, vtest, script test) to verify the changes I made

@igorkorsukov igorkorsukov changed the title Allow the user to customize background when exporting as PDF/PNG/SVG [MU3] Allow the user to customize background when exporting as PDF/PNG/SVG Feb 12, 2021
@@ -66,6 +66,8 @@
#define PREF_EXPORT_PDF_DPI "export/pdf/dpi"
#define PREF_EXPORT_PNG_RESOLUTION "export/png/resolution"
#define PREF_EXPORT_PNG_USETRANSPARENCY "export/png/useTransparency"
#define PREF_EXPORT_BG_STYLE "export/bg/style"
#define PREF_EXPORT_BG_CUSTOM_COLOR "export/bg/customcolor"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use spaces here, not tabs

mscore/file.cpp Outdated
@@ -2187,6 +2216,21 @@ bool MuseScore::savePdf(QList<Score*> cs_, const QString& saveName)
if (!firstPage)
printer.newPage();
firstPage = false;

switch (exportBgStyle) {
case 1:
Copy link
Contributor

@Jojo-Schmitz Jojo-Schmitz Feb 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent one level more starting here

@sidharth-anand sidharth-anand force-pushed the 293370-export-background branch 2 times, most recently from 6a5d5ba to 5e968d8 Compare February 12, 2021 19:06
Comment on lines 26 to 37
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the margins changed? I don't think this is intended... please undo this (remove these 12 lines).

@cbjeukendrup
Copy link
Contributor

I would like to suggest a quick design tweak: (see mock-up)
Schermafbeelding 2021-03-01 om 19 40 42

@sidharth-anand sidharth-anand force-pushed the 293370-export-background branch from 5e968d8 to 5e61766 Compare March 2, 2021 10:24
@vpereverzev
Copy link
Member

Hi @sidharth-anand, we're not planning to release 3.x anymore, but I guess it might be useful for 4.0
Is it already included in your counter-part for master? If so, I'd close this one

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Mar 10, 2021

Even if it is, please merge to 3,x too, it is easier to test it with a 3.x development build

Also plans can change...

And that preferences stuff is not yet in master anyhow as far as I can tell
Anyway: as far as I can see this PR here is not included in the other one

@sidharth-anand
Copy link
Contributor Author

@vpereverzev it's not included in my PR for the export dialog currently. I was thinking of making a separate PR porting this to master once the export dialog and the preferences and somewhat stable in master

@Jojo-Schmitz
Copy link
Contributor

Needs #7704 too

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 4, 2021
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 compiler warnings it introduced
@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Sep 4, 2021

Wouldn't that new preference also need to get added to the dialog in Edit > Preferences > Export > PNG and ...PDF (there is none for ...SVG)?

Have you done a port of this to master meanwhile? (Edit: apparently not, but probably should)
(I've added this one here to #9000 meanwhile, so I guess it can get closed?)

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 4, 2021
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 4, 2021
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 9, 2021
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 10, 2021
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 23, 2021
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 24, 2021
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 26, 2021
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 29, 2021
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 12, 2022
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
@RomanPudashkin
Copy link
Contributor

3.x is closed for any changes

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 5, 2023
…/PNG/SVG

Duplicate of musescore#7500, plus fix 2 MinGW compiler warnings it introduced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants