1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Feature: Add option for taking transparent screenshots

This commit is contained in:
Cory Sanin
2021-02-22 15:48:51 -06:00
committed by GitHub
parent 8e414a9d97
commit 57c950958b
6 changed files with 14 additions and 1 deletions

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.

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 =

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);

View File

@@ -49,6 +49,7 @@ struct CaptureOptions
std::optional<CaptureView> View;
ZoomLevel Zoom;
uint8_t Rotation{};
bool Transparent{};
};
void screenshot_check();

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)

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
{