From 4cdcf0fe7205a8897dab7294eab9cbdc67a3d34a Mon Sep 17 00:00:00 2001 From: Kevin Fischer Date: Tue, 6 Oct 2020 21:55:39 +0900 Subject: Add docs for outputs.screenshots --- dragon/outputs_docs.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dragon/outputs_docs.rb b/dragon/outputs_docs.rb index 16c97ec..7d47510 100644 --- a/dragon/outputs_docs.rb +++ b/dragon/outputs_docs.rb @@ -147,6 +147,33 @@ Here is an example: end #+end_src +S + end + + def docs_screenshots + <<-S +* DOCS: ~GTK::Outputs#screenshots~ + +Add a hash to this collection to take a screenshot and save as png file. +The keys of the hash can be provided in any order. + +#+begin_src + def tick args + args.outputs.screenshots << { + x: 0, y: 0, w: 100, h: 100, # Which portion of the screen should be captured + path: 'screenshot.png', # Output path of PNG file (inside game directory) + r: 255, g: 255, b: 255, a: 0 # Optional chroma key + } + end +#+end_src + +** Chroma key (Making a color transparent) + +By specifying the r, g, b and a keys of the hash you change the transparency of a color in the resulting PNG file. +This can be useful if you want to create files with transparent background like spritesheets. +The transparency of the color specified by ~r~, ~g~, ~b~ will be set to the transparency specified by ~a~. + +The example above sets the color white (255, 255, 255) as transparent. S end end -- cgit v1.2.3