OpenTTD Source: src/screenshot.h File Reference

OpenTTD Source 15.0-RC2

Enumerations | Functions | Variables
screenshot.h File Reference

Functions to make screenshots. More...

Go to the source code of this file.

## Enumerations
enum | ScreenshotType : uint8_t { SC_VIEWPORT , SC_CRASHLOG , SC_ZOOMEDIN , SC_DEFAULTZOOM , SC_WORLD , SC_HEIGHTMAP , SC_MINIMAP }
| Type of requested screenshot. More...

## Functions
std::string_view | GetCurrentScreenshotExtension ()
| Get filename extension of current screenshot file format.
bool | MakeHeightmapScreenshot (std::string_view filename)
| Make a heightmap of the current map.
void | MakeScreenshotWithConfirm (ScreenshotType t)
| Make a screenshot.
bool | MakeScreenshot (ScreenshotType t, const std::string &name, uint32_t width=0, uint32_t height=0)
| Schedule making a screenshot.
bool | MakeMinimapWorldScreenshot ()
| Make a minimap screenshot.

## Variables
std::string | _screenshot_format_name
| Extension of the current screenshot format.
std::string | _full_screenshot_path
| Pathname of the screenshot file.

## Detailed Description

Functions to make screenshots.

Definition in file screenshot.h.

## Enumeration Type Documentation

## ◆ ScreenshotType

enum ScreenshotType : uint8_t

Type of requested screenshot.

Enumerator
SC_VIEWPORT | Screenshot of viewport.
SC_CRASHLOG | Raw screenshot from blitter buffer.
SC_ZOOMEDIN | Fully zoomed in screenshot of the visible area.
SC_DEFAULTZOOM | Zoomed to default zoom level screenshot of the visible area.
SC_WORLD | World screenshot.
SC_HEIGHTMAP | Heightmap of the world.
SC_MINIMAP | Minimap screenshot.

Definition at line 16 of file screenshot.h.

## Function Documentation

## ◆ GetCurrentScreenshotExtension()

std::string_view GetCurrentScreenshotExtension | ( |  | ) |

Get filename extension of current screenshot file format.

Definition at line 61 of file screenshot.cpp.

References GetScreenshotProvider().

Referenced by FiosMakeHeightmapName().

## ◆ MakeHeightmapScreenshot()

bool MakeHeightmapScreenshot | ( | std::string_view | filename | ) |

Make a heightmap of the current map.

Parameters

  filename | Filename to use for saving.

Definition at line 314 of file screenshot.cpp.

References _heightmap_highest_peak, GetScreenshotProvider(), HeightmapCallback(), Map::Iterate(), lengthof, Map::SizeX(), Map::SizeY(), and TileHeight().

Referenced by RealMakeScreenshot().

## ◆ MakeMinimapWorldScreenshot()

bool MakeMinimapWorldScreenshot | ( |  | ) |

Make a minimap screenshot.

Definition at line 497 of file screenshot.cpp.

References _cur_palette, GetScreenshotProvider(), MakeScreenshotName(), Palette::palette, SCREENSHOT_NAME, Map::SizeX(), and Map::SizeY().

Referenced by RealMakeScreenshot().

## ◆ MakeScreenshot()

bool MakeScreenshot | ( | ScreenshotType | t,
|  | const std::string & | name,
|  | uint32_t | width,
|  | uint32_t | height
| ) |  |

Schedule making a screenshot.

Unconditionally take a screenshot of the requested type.

Parameters

  t | the type of screenshot to make.
  name | the name to give to the screenshot.
  width | the width of the screenshot of, or 0 for current viewport width (only works for SC_ZOOMEDIN and SC_DEFAULTZOOM).
  height | the height of the screenshot of, or 0 for current viewport height (only works for SC_ZOOMEDIN and SC_DEFAULTZOOM).

Returns
  true iff the screenshot was successfully made.

See also
  MakeScreenshotWithConfirm

Definition at line 456 of file screenshot.cpp.

References VideoDriver::GetInstance(), lock, VideoDriver::QueueOnMainThread(), RealMakeScreenshot(), and SC_CRASHLOG.

Referenced by MakeScreenshotWithConfirm(), ScreenshotConfirmationCallback(), and CrashLog::WriteScreenshot().

## ◆ MakeScreenshotWithConfirm()

void MakeScreenshotWithConfirm | ( | ScreenshotType | t | ) |

Make a screenshot.

Ask for confirmation first if the screenshot will be huge.

Parameters

  t | Screenshot type: World, defaultzoom, heightmap or viewport screenshot

See also
  MakeScreenshot

Definition at line 353 of file screenshot.cpp.

References _confirmed_screenshot_type, GetEncodedString(), Viewport::height, MakeScreenshot(), SC_HEIGHTMAP, SC_MINIMAP, ScreenshotConfirmationCallback(), SetupScreenshotViewport(), ShowQuery(), Map::SizeX(), Map::SizeY(), and Viewport::width.

Referenced by ScreenshotWindow::OnClick(), MainToolbarWindow::OnHotkey(), and ScenarioEditorToolbarWindow::OnHotkey().

## Variable Documentation

## ◆ _full_screenshot_path

std::string _full_screenshot_path
| extern

Pathname of the screenshot file.

Definition at line 41 of file screenshot.cpp.

Referenced by MakeScreenshotName(), and CrashLog::WriteScreenshot().

## ◆ _screenshot_format_name

std::string _screenshot_format_name
| extern

Extension of the current screenshot format.

Definition at line 39 of file screenshot.cpp.

Referenced by GetScreenshotProvider().