openMSX
Public Types | Public Member Functions | List of all members
openmsx::BitmapConverter Class Reference

Utility class for converting VRAM contents to host pixels. More...

#include <BitmapConverter.hh>

Public Types

using Pixel = uint32_t
 
using DPixel = uint64_t
 

Public Member Functions

 BitmapConverter (std::span< const Pixel, 16 *2 > palette16, std::span< const Pixel, 256 > palette256, std::span< const Pixel, 32768 > palette32768)
 Create a new bitmap scanline converter.
 
void convertLine (std::span< Pixel > buf, std::span< const byte, 128 > vramPtr)
 Convert a line of V9938 VRAM to 256 or 512 host pixels.
 
void convertLinePlanar (std::span< Pixel > buf, std::span< const byte, 128 > vramPtr0, std::span< const byte, 128 > vramPtr1)
 Convert a line of V9938 VRAM to 256 or 512 host pixels.
 
void setDisplayMode (DisplayMode mode_)
 Select the display mode to use for scanline conversion.
 
void palette16Changed ()
 Inform this class about changes in the palette16 array.
 

Detailed Description

Utility class for converting VRAM contents to host pixels.

Definition at line 15 of file BitmapConverter.hh.

Member Typedef Documentation

◆ DPixel

Definition at line 19 of file BitmapConverter.hh.

◆ Pixel

Definition at line 18 of file BitmapConverter.hh.

Constructor & Destructor Documentation

◆ BitmapConverter()

openmsx::BitmapConverter::BitmapConverter ( std::span< const Pixel, 16 *2 >  palette16,
std::span< const Pixel, 256 >  palette256,
std::span< const Pixel, 32768 >  palette32768 
)

Create a new bitmap scanline converter.

Parameters
palette16Pointer to 2*16-entries array that specifies VDP color index to host pixel mapping. This is kept as a pointer, so any changes to the palette are immediately picked up by convertLine. Though to allow some internal optimizations, this class should be informed about changes in this array (not needed for the next two), see palette16Changed(). Used for display modes Graphic4, Graphic5 and Graphic6. First 16 entries are for even pixels, next 16 are for odd pixels
palette256Pointer to 256-entries array that specifies VDP color index to host pixel mapping. This is kept as a pointer, so any changes to the palette are immediately picked up by convertLine. Used for display mode Graphic7.
palette32768Pointer to 32768-entries array that specifies VDP color index to host pixel mapping. This is kept as a pointer, so any changes to the palette are immediately picked up by convertLine. Used when YJK filter is active.

Definition at line 15 of file BitmapConverter.cc.

Member Function Documentation

◆ convertLine()

void openmsx::BitmapConverter::convertLine ( std::span< Pixel buf,
std::span< const byte, 128 >  vramPtr 
)

Convert a line of V9938 VRAM to 256 or 512 host pixels.

Call this method in non-planar display modes (Graphic4 and Graphic5).

Parameters
bufBuffer where host pixels will be written to. Depending on the screen mode, the buffer must contain at least 256 or 512 pixels, but more is allowed (the extra pixels aren't touched).
vramPtrPointer to VRAM contents.

Definition at line 40 of file BitmapConverter.cc.

References openmsx::DisplayMode::getByte(), openmsx::DisplayMode::GRAPHIC4, openmsx::DisplayMode::GRAPHIC5, openmsx::DisplayMode::GRAPHIC6, openmsx::DisplayMode::GRAPHIC7, UNREACHABLE, openmsx::DisplayMode::YAE, and openmsx::DisplayMode::YJK.

◆ convertLinePlanar()

void openmsx::BitmapConverter::convertLinePlanar ( std::span< Pixel buf,
std::span< const byte, 128 >  vramPtr0,
std::span< const byte, 128 >  vramPtr1 
)

Convert a line of V9938 VRAM to 256 or 512 host pixels.

Call this method in planar display modes (Graphic6 and Graphic7).

Parameters
bufBuffer where host pixels will be written to. Depending on the screen mode, the buffer must contain at least 256 or 512 pixels, but more is allowed (the extra pixels aren't touched).
vramPtr0Pointer to VRAM contents, first plane.
vramPtr1Pointer to VRAM contents, second plane.

Definition at line 72 of file BitmapConverter.cc.

References openmsx::DisplayMode::getByte(), openmsx::DisplayMode::GRAPHIC4, openmsx::DisplayMode::GRAPHIC5, openmsx::DisplayMode::GRAPHIC6, openmsx::DisplayMode::GRAPHIC7, UNREACHABLE, openmsx::DisplayMode::YAE, and openmsx::DisplayMode::YJK.

◆ palette16Changed()

void openmsx::BitmapConverter::palette16Changed ( )
inline

Inform this class about changes in the palette16 array.

Definition at line 79 of file BitmapConverter.hh.

Referenced by openmsx::SDLRasterizer::setPalette().

◆ setDisplayMode()

void openmsx::BitmapConverter::setDisplayMode ( DisplayMode  mode_)
inline

Select the display mode to use for scanline conversion.

Parameters
mode_The new display mode.

Definition at line 72 of file BitmapConverter.hh.

Referenced by openmsx::SDLRasterizer::setDisplayMode().


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