Feature: Add option for taking transparent screenshots

This commit is contained in:
Cory Sanin authored and GitHub committed 2021-02-22 22:48:51 +01:00
1 parent 8e414a9d97
commit 57c950958b
6 files changed
+14 -1

No files matched your search

+1
View File
@@ -23,6 +23,7 @@
- Feature: [#13969] [Plugin] Add APIs for editing title sequences.
- Feature: [#14002] [Plugin] Use allowed_hosts when checking the binding IP for listening.
- Feature: [#14059] [Plugin] Add optional filter to custom tools.
- Feature: [#14142] [Plugin] Add option for taking transparent screenshots.
- Change: [#13346] [Plugin] Renamed FootpathScenery to FootpathAddition, fix typos.
- Change: [#13857] Change Rotation Control Toggle to track element number 256
- Fix: [#4605, #11912] Water palettes are not updated properly when selected in Object Selection.
+5
View File
@@ -314,6 +314,11 @@ declare global {
* Rotation of the camera from 0 to 3.
*/
rotation: number;
/**
* Whether to enable transparency in the screenshot.
*/
transparent?: boolean;
}
type ObjectType =
+5
View File
@@ -814,6 +814,11 @@ void CaptureImage(const CaptureOptions& options)
auto backupRotation = gCurrentRotation;
gCurrentRotation = options.Rotation;
if (options.Transparent)
{
viewport.flags |= VIEWPORT_FLAG_TRANSPARENT_BACKGROUND;
}
auto outputPath = ResolveFilenameForCapture(options.Filename);
auto dpi = CreateDPI(viewport);
RenderViewport(nullptr, viewport, dpi);
+1
View File
@@ -49,6 +49,7 @@ struct CaptureOptions
std::optional<CaptureView> View;
ZoomLevel Zoom;
uint8_t Rotation{};
bool Transparent{};
};
void screenshot_check();
+1
View File
@@ -62,6 +62,7 @@ namespace OpenRCT2::Scripting
captureOptions.Filename = fs::u8path(AsOrDefault(options["filename"], ""));
captureOptions.Rotation = options["rotation"].as_int() & 3;
captureOptions.Zoom = ZoomLevel(options["zoom"].as_int());
captureOptions.Transparent = AsOrDefault(options["transparent"], false);
auto dukPosition = options["position"];
if (dukPosition.type() == DukValue::Type::OBJECT)
+1 -1
View File
@@ -44,7 +44,7 @@
using namespace OpenRCT2;
using namespace OpenRCT2::Scripting;
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 21;
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 22;
struct ExpressionStringifier final
{