Skip to content

Commit

Permalink
Fix editor snapshot bounds and increase scaling factor
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Feb 7, 2025
1 parent 2daf0a2 commit c4a6639
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Source/UI/EditorViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,23 +919,25 @@ void EditorViewport::mouseDown (const MouseEvent& e)
}
else if (result == 6)
{
editorArray[i]->deselect();

File picturesDirectory = File::getSpecialLocation (File::SpecialLocationType::userPicturesDirectory);

String editorName = editorArray[i]->getName() + "_" + String (editorArray[i]->getProcessor()->getNodeId());
File outputFile = picturesDirectory.getNonexistentChildFile (editorName, ".png");

juce::Rectangle<int> bounds = juce::Rectangle<int> (3, 3, editorArray[i]->getWidth() - 6, editorArray[i]->getHeight() - 6);

Image componentImage = editorArray[i]->createComponentSnapshot (
bounds,
editorArray[i]->getLocalBounds(),
true,
1.5f);
2.0f);

FileOutputStream stream (outputFile);
PNGImageFormat pngWriter;
pngWriter.writeImageToStream (componentImage, stream);

CoreServices::sendStatusMessage ("Saved image to " + outputFile.getFullPathName());

return;
}
}

Expand Down

0 comments on commit c4a6639

Please sign in to comment.