openMSX
Public Types | Public Member Functions | Protected Member Functions | List of all members
openmsx::OutputSurface Class Referenceabstract

A frame buffer where pixels can be written to. More...

#include <OutputSurface.hh>

Inheritance diagram for openmsx::OutputSurface:
Inheritance graph
[legend]

Public Types

using Pixel = uint32_t
 

Public Member Functions

 OutputSurface (const OutputSurface &)=delete
 
OutputSurfaceoperator= (const OutputSurface &)=delete
 
virtual ~OutputSurface ()=default
 
int getLogicalWidth () const
 
int getLogicalHeight () const
 
gl::ivec2 getLogicalSize () const
 
gl::ivec2 getPhysicalSize () const
 
gl::ivec2 getViewOffset () const
 
gl::ivec2 getViewSize () const
 
gl::vec2 getViewScale () const
 
uint32_t mapRGB (gl::vec3 rgb) const
 Returns the pixel value for the given RGB color. More...
 
uint32_t mapRGB255 (gl::ivec3 rgb) const
 Same as mapRGB, but RGB components are in range [0..255]. More...
 
Pixel getKeyColor () const
 Returns the color key for this output surface. More...
 
virtual void saveScreenshot (const std::string &filename)=0
 Save the content of this OutputSurface to a PNG file. More...
 

Protected Member Functions

 OutputSurface ()=default
 
void calculateViewPort (gl::ivec2 logSize, gl::ivec2 physSize)
 

Detailed Description

A frame buffer where pixels can be written to.

It could be an in-memory buffer or a video buffer visible to the user (see *OffScreenSurface and *VisibleSurface classes).

The OutputSurface class itself knows about its dimensions and pixel format. But the actual pixel storage is left for the subclasses.

Definition at line 19 of file OutputSurface.hh.

Member Typedef Documentation

◆ Pixel

Definition at line 22 of file OutputSurface.hh.

Constructor & Destructor Documentation

◆ OutputSurface() [1/2]

openmsx::OutputSurface::OutputSurface ( const OutputSurface )
delete

◆ ~OutputSurface()

virtual openmsx::OutputSurface::~OutputSurface ( )
virtualdefault

◆ OutputSurface() [2/2]

openmsx::OutputSurface::OutputSurface ( )
protecteddefault

Member Function Documentation

◆ calculateViewPort()

void openmsx::OutputSurface::calculateViewPort ( gl::ivec2  logSize,
gl::ivec2  physSize 
)
protected

Definition at line 6 of file OutputSurface.cc.

References gl::min_component(), and gl::scale().

Referenced by openmsx::OffScreenSurface::OffScreenSurface().

◆ getKeyColor()

Pixel openmsx::OutputSurface::getKeyColor ( ) const
inline

Returns the color key for this output surface.

Definition at line 58 of file OutputSurface.hh.

Referenced by openmsx::V9990SDLRasterizer::resetPalette(), and openmsx::V9990SDLRasterizer::setPalette().

◆ getLogicalHeight()

int openmsx::OutputSurface::getLogicalHeight ( ) const
inline

Definition at line 30 of file OutputSurface.hh.

Referenced by openmsx::GLScopedClip::GLScopedClip().

◆ getLogicalSize()

gl::ivec2 openmsx::OutputSurface::getLogicalSize ( ) const
inline

◆ getLogicalWidth()

int openmsx::OutputSurface::getLogicalWidth ( ) const
inline

Definition at line 29 of file OutputSurface.hh.

Referenced by openmsx::OSDWidget::getScaleFactor().

◆ getPhysicalSize()

gl::ivec2 openmsx::OutputSurface::getPhysicalSize ( ) const
inline

Definition at line 32 of file OutputSurface.hh.

Referenced by openmsx::OffScreenSurface::OffScreenSurface().

◆ getViewOffset()

gl::ivec2 openmsx::OutputSurface::getViewOffset ( ) const
inline

◆ getViewScale()

gl::vec2 openmsx::OutputSurface::getViewScale ( ) const
inline

Definition at line 36 of file OutputSurface.hh.

Referenced by openmsx::GLScopedClip::GLScopedClip().

◆ getViewSize()

gl::ivec2 openmsx::OutputSurface::getViewSize ( ) const
inline

◆ mapRGB()

uint32_t openmsx::OutputSurface::mapRGB ( gl::vec3  rgb) const
inline

Returns the pixel value for the given RGB color.

No effort is made to ensure that the returned pixel value is not the color key for this output surface.

Definition at line 42 of file OutputSurface.hh.

References mapRGB255().

Referenced by openmsx::V9990SDLRasterizer::preCalcPalettes().

◆ mapRGB255()

uint32_t openmsx::OutputSurface::mapRGB255 ( gl::ivec3  rgb) const
inline

Same as mapRGB, but RGB components are in range [0..255].

Definition at line 49 of file OutputSurface.hh.

References openmsx::PixelOperations::combine(), and g.

Referenced by mapRGB(), and openmsx::V9990SDLRasterizer::preCalcPalettes().

◆ operator=()

OutputSurface & openmsx::OutputSurface::operator= ( const OutputSurface )
delete

◆ saveScreenshot()

virtual void openmsx::OutputSurface::saveScreenshot ( const std::string &  filename)
pure virtual

Save the content of this OutputSurface to a PNG file.

Exceptions
MSXExceptionIf creating the PNG file fails.

Implemented in openmsx::VisibleSurface.


The documentation for this class was generated from the following files: