screenshot.cpp File Reference

The creation of screenshots! More...

#include "stdafx.h"
#include "openttd.h"
#include "fileio_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "screenshot.h"
#include "variables.h"
#include "blitter/factory.hpp"
#include "zoom_func.h"
#include "core/alloc_func.hpp"
#include "core/endian_func.hpp"
#include "map_func.h"
#include "saveload/saveload.h"
#include "company_func.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  RgbTriplet
 Pixel data in 24bpp BMP. 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)
 assert_compile (sizeof(RgbTriplet)==3)
static bool MakeBmpImage (const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 Generic .BMP writer.
 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 (int 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 char * MakeScreenshotName (const char *ext)
void SetScreenshotType (ScreenshotType t)
bool IsScreenshotRequested ()
static bool MakeSmallScreenshot ()
static bool MakeWorldScreenshot ()
bool MakeScreenshot ()

Variables

char _screenshot_format_name [8]
uint _num_screenshot_formats
uint _cur_screenshot_format
char _screenshot_name [128]
ScreenshotType current_screenshot_type
struct BitmapFileHeader GCC_PACK
 BMP File Header (stored in little endian).
static const ScreenshotFormat _screenshot_formats []


Detailed Description

The creation of screenshots!

Definition in file screenshot.cpp.


Function Documentation

static void LargeWorldCallback ( void *  userdata,
void *  buf,
uint  y,
uint  pitch,
uint  n 
) [static]

generate a large piece of the world

Parameters:
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 519 of file screenshot.cpp.

References _screen_disable_anim, ViewPort::left, min(), ScaleByZoom(), ViewPort::top, ViewPort::virtual_left, ViewPort::virtual_top, ViewPort::width, and ViewPort::zoom.

static bool MakeBmpImage ( const char *  name,
ScreenshotCallback *  callb,
void *  userdata,
uint  w,
uint  h,
int  pixelformat,
const Colour *  palette 
) [static]

Generic .BMP writer.

Parameters:
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
paletter colour paletter (for 8bpp mode)
Returns:
was everything ok?

Definition at line 89 of file screenshot.cpp.

References Align(), AllocaM, RgbTriplet::b, BitmapInfoHeader::bitcount, RgbQuad::blue, Clamp(), BitmapInfoHeader::clrimp, BitmapInfoHeader::clrused, BitmapInfoHeader::compression, RgbTriplet::g, RgbQuad::green, BitmapInfoHeader::height, min(), BitmapFileHeader::off_bits, BitmapInfoHeader::planes, RgbTriplet::r, RgbQuad::red, RgbQuad::reserved, BitmapFileHeader::reserved, BitmapInfoHeader::size, BitmapFileHeader::size, BitmapInfoHeader::sizeimage, BitmapFileHeader::type, BitmapInfoHeader::width, BitmapInfoHeader::xpels, and BitmapInfoHeader::ypels.


Variable Documentation

const ScreenshotFormat _screenshot_formats[] [static]

Initial value:

 {



  {"BMP", "bmp", &MakeBmpImage},
  {"PCX", "pcx", &MakePCXImage},
}

Definition at line 472 of file screenshot.cpp.


Generated on Wed Dec 23 20:13:00 2009 for OpenTTD by  doxygen 1.5.6