The creation of screenshots! More...
#include "stdafx.h"#include "fileio_func.h"#include "viewport_func.h"#include "gfx_func.h"#include "screenshot.h"#include "blitter/factory.hpp"#include "zoom_func.h"#include "core/endian_func.hpp"#include "saveload/saveload.h"#include "company_func.h"#include "strings_func.h"#include "gui.h"#include "window_gui.h"#include "window_func.h"#include "tile_map.h"#include "table/strings.h"#include <png.h>Go to the source code of this file.
Data Structures | |
| struct | ScreenshotFormat |
| struct | BitmapFileHeader |
| BMP File Header (stored in little endian). More... | |
| struct | BitmapInfoHeader |
| BMP Info Header (stored in little endian). More... | |
| struct | RgbQuad |
| Format of palette data in BMP header. More... | |
| struct | PcxHeader |
Typedefs | |
| typedef void | ScreenshotCallback (void *userdata, void *buf, uint y, uint pitch, uint n) |
| typedef bool | ScreenshotHandlerProc (const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) |
Functions | |
| assert_compile (sizeof(BitmapFileHeader)==14) | |
| assert_compile (sizeof(BitmapInfoHeader)==40) | |
| assert_compile (sizeof(RgbQuad)==4) | |
| static bool | MakeBMPImage (const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) |
| Generic .BMP writer. | |
| static void PNGAPI | png_my_error (png_structp png_ptr, png_const_charp message) |
| static void PNGAPI | png_my_warning (png_structp png_ptr, png_const_charp message) |
| static bool | MakePNGImage (const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) |
| assert_compile (sizeof(PcxHeader)==128) | |
| static bool | MakePCXImage (const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) |
| void | InitializeScreenshotFormats () |
| const char * | GetScreenshotFormatDesc (int i) |
| void | SetScreenshotFormat (uint i) |
| static void | CurrentScreenCallback (void *userdata, void *buf, uint y, uint pitch, uint n) |
| static void | LargeWorldCallback (void *userdata, void *buf, uint y, uint pitch, uint n) |
| generate a large piece of the world | |
| static const char * | MakeScreenshotName (const char *ext) |
| static bool | MakeSmallScreenshot () |
| Make a screenshot of the current screen. | |
| static bool | MakeZoomedInScreenshot () |
| Make a zoomed-in screenshot of the currently visible area. | |
| static bool | MakeWorldScreenshot () |
| Make a screenshot of the whole map. | |
| bool | MakeScreenshot (ScreenshotType t, const char *name) |
| Make an actual screenshot. | |
Variables | |
| char | _screenshot_format_name [8] |
| uint | _num_screenshot_formats |
| uint | _cur_screenshot_format |
| static char | _screenshot_name [128] |
| char | _full_screenshot_name [MAX_PATH] |
| struct BitmapFileHeader | GCC_PACK |
| BMP File Header (stored in little endian). | |
| static const ScreenshotFormat | _screenshot_formats [] |
The creation of screenshots!
Definition in file screenshot.cpp.
| static void LargeWorldCallback | ( | void * | userdata, | |
| void * | buf, | |||
| uint | y, | |||
| uint | pitch, | |||
| uint | n | |||
| ) | [static] |
generate a large piece of the world
| userdata | Viewport area to draw | |
| buf | Videobuffer with same bitdepth as current blitter | |
| y | First line to render | |
| pitch | Pitch of the videobuffer | |
| n | Number of lines to render |
Definition at line 572 of file screenshot.cpp.
References _screen_disable_anim, ViewPort::left, min(), ScaleByZoom(), ViewPort::top, ViewPort::virtual_left, ViewPort::virtual_top, and ViewPort::width.
Referenced by MakeWorldScreenshot(), and MakeZoomedInScreenshot().
| static bool MakeBMPImage | ( | const char * | name, | |
| ScreenshotCallback * | callb, | |||
| void * | userdata, | |||
| uint | w, | |||
| uint | h, | |||
| int | pixelformat, | |||
| const Colour * | palette | |||
| ) | [static] |
Generic .BMP writer.
| name | file name including extension | |
| callb | callback used for gathering rendered image | |
| userdata | parameters forwarded to callb | |
| w | width in pixels | |
| h | height in pixels | |
| pixelformat | bits per pixel | |
| palette | colour palette (for 8bpp mode) |
Definition at line 93 of file screenshot.cpp.
| bool MakeScreenshot | ( | ScreenshotType | t, | |
| const char * | name | |||
| ) |
Make an actual screenshot.
| t | the type of screenshot to make. | |
| name | the name to give to the screenshot. |
Definition at line 709 of file screenshot.cpp.
References DrawDirtyBlocks(), INVALID_STRING_ID, lastof, MakeSmallScreenshot(), MakeWorldScreenshot(), MakeZoomedInScreenshot(), SC_RAW, SC_VIEWPORT, SC_WORLD, SC_ZOOMEDIN, SetDParamStr(), ShowErrorMessage(), strecpy(), WL_ERROR, and WL_WARNING.
Referenced by CrashLog::WriteScreenshot().
| static bool MakeSmallScreenshot | ( | ) | [static] |
Make a screenshot of the current screen.
Definition at line 652 of file screenshot.cpp.
References _cur_palette, BlitterFactoryBase::GetCurrentBlitter(), and Blitter::GetScreenDepth().
Referenced by MakeScreenshot().
| static bool MakeWorldScreenshot | ( | ) | [static] |
Make a screenshot of the whole map.
Definition at line 679 of file screenshot.cpp.
References _cur_palette, BlitterFactoryBase::GetCurrentBlitter(), Blitter::GetScreenDepth(), ViewPort::height, LargeWorldCallback(), ViewPort::left, MapMaxX(), MapMaxY(), MapSize(), TILE_HEIGHT, TILE_PIXELS, TileHeight(), ViewPort::top, ViewPort::virtual_height, ViewPort::virtual_left, ViewPort::virtual_top, ViewPort::virtual_width, and ViewPort::width.
Referenced by MakeScreenshot().
| static bool MakeZoomedInScreenshot | ( | ) | [static] |
Make a zoomed-in screenshot of the currently visible area.
Definition at line 659 of file screenshot.cpp.
References _cur_palette, FindWindowById(), BlitterFactoryBase::GetCurrentBlitter(), Blitter::GetScreenDepth(), ViewPort::height, LargeWorldCallback(), ViewPort::left, ViewPort::top, Window::viewport, ViewPort::virtual_height, ViewPort::virtual_left, ViewPort::virtual_top, ViewPort::virtual_width, and ViewPort::width.
Referenced by MakeScreenshot().
const ScreenshotFormat _screenshot_formats[] [static] |
{
{"PNG", "png", &MakePNGImage},
{"BMP", "bmp", &MakeBMPImage},
{"PCX", "pcx", &MakePCXImage},
}
Definition at line 523 of file screenshot.cpp.
1.7.1