Skip to content

VideoPortAPI ​

cpp
#include <VAmiga.h>
cpp
class VideoPortAPI

Defined in VAmiga.h:1918

API of the video port.

Public Methods ​

ReturnNameDescription
voidlockTextureLocks the emulator texture.
voidunlockTextureUnlocks the emulator texture.
const u32 *getTexture constReturns a pointer to the most recent stable texture.
const u32 *getTexture constReturns the most recent stable texture together with its frame number and long-frame flags.
const u32 *getXrayTexture constReturns a pointer to the most recent stable X-Ray texture.
const u32 *getXrayTexture constReturns the most recent stable X-Ray texture together with its frame number.
voidsaveTexture constSaves the most recent stable texture as a PNG file.
voidsaveTexture constSaves a cutout of the most recent stable texture as a PNG file.
voidsaveXrayTexture constSaves the most recent stable X-Ray texture as a PNG file.
voidsaveXrayTexture constSaves a cutout of the most recent stable X-Ray texture as a PNG file.
voidfindInnerArea constDetermines the area of the texture that contains picture data.
voidfindInnerAreaNormalized constDetermines the picture area relative to the texture size (see findInnerArea()).
const VideoPortConfig &getConfig constReturns the component's current configuration.
const VideoPortInfo &getInfo constReturns the component's current state.
const VideoPortInfo &getCachedInfo constReturns the most recent state snapshot recorded by the emulator thread (see getInfo()).

lockTexture ​

cpp
void lockTexture()

Defined in VAmiga.h:1951

Locks the emulator texture.

This function aquires a mutex that prevents the emulator to modify the stable texture. Call this function prior to getTexture().


unlockTexture ​

cpp
void unlockTexture()

Defined in VAmiga.h:1958

Unlocks the emulator texture.

This function releases the mutex acquired in lockTexture(). Call this function when the pointer returned by getTexture() is no longer needed.


getTexture ​

const

cpp
const u32 * getTexture() const

Defined in VAmiga.h:1970

Returns a pointer to the most recent stable texture.

The texture dimensions are given by constants vamiga::Tex::width and vamiga::Tex::height texels. Each texel is represented by a 32 bit color value.

The second version also returns the frame number (nr) and the long-frame flags of the frame and its predecessor (lof, prevlof), which are needed to weave the fields of an interlaced picture.


getTexture ​

const

cpp
const u32 * getTexture(isize * nr, bool * lof, bool * prevlof) const

Defined in VAmiga.h:1972

Returns the most recent stable texture together with its frame number and long-frame flags.


getXrayTexture ​

const

cpp
const u32 * getXrayTexture() const

Defined in VAmiga.h:1981

Returns a pointer to the most recent stable X-Ray texture.

The texture dimensions are given by constants vamiga::Tex::width and vamiga::Tex::height texels. Each texel is represented by a 32 bit color value. The second version also returns the frame number (nr), which matches the number of the regular texture of the same frame.


getXrayTexture ​

const

cpp
const u32 * getXrayTexture(isize * nr) const

Defined in VAmiga.h:1983

Returns the most recent stable X-Ray texture together with its frame number.


saveTexture ​

const

cpp
void saveTexture(const std::filesystem::path & path) const

Defined in VAmiga.h:1993

Saves the most recent stable texture as a PNG file.

The cutout is given in texels of the texture (x: super-hires pixels, y: lines). The upper bounds x2 and y2 are exclusive. Without a cutout, the entire texture is saved.

Exceptions ​

ExceptionDescription
Errorif the file cannot be written.

saveTexture ​

const

cpp
void saveTexture(const std::filesystem::path & path, isize x1, isize x2, isize y1, isize y2) const

Defined in VAmiga.h:1995

Saves a cutout of the most recent stable texture as a PNG file.


saveXrayTexture ​

const

cpp
void saveXrayTexture(const std::filesystem::path & path) const

Defined in VAmiga.h:2002

Saves the most recent stable X-Ray texture as a PNG file.

Exceptions ​

ExceptionDescription
Errorif the file cannot be written.

saveXrayTexture ​

const

cpp
void saveXrayTexture(const std::filesystem::path & path, isize x1, isize x2, isize y1, isize y2) const

Defined in VAmiga.h:2004

Saves a cutout of the most recent stable X-Ray texture as a PNG file.


findInnerArea ​

const

cpp
void findInnerArea(isize & x1, isize & x2, isize & y1, isize & y2) const

Defined in VAmiga.h:2026

Determines the area of the texture that contains picture data.

The function analyzes the current stable texture. It starts with a large box and shrinks it from all four sides as long as the outermost row or column only consists of pixels in the border color (the color of the pixel in the upper left corner of the box). The result can be used to crop the border of the picture. The emulator thread is suspended while the texture is analyzed. If the texture contains no picture data, all coordinates are 0.

findInnerArea() returns the coordinates in texture pixels, findInnerAreaNormalized() returns them relative to the size of the texture (0.0 ... 1.0).

Parameters ​

ParameterTypeDescription
x1isize &Left edge of the picture area
x2isize &Right edge of the picture area
y1isize &Top edge of the picture area
y2isize &Bottom edge of the picture area

findInnerAreaNormalized ​

const

cpp
void findInnerAreaNormalized(double & x1, double & x2, double & y1, double & y2) const

Defined in VAmiga.h:2028

Determines the picture area relative to the texture size (see findInnerArea()).


getConfig ​

const

cpp
const VideoPortConfig & getConfig() const

Defined in VAmiga.h:1928

Returns the component's current configuration.


getInfo ​

const

cpp
const VideoPortInfo & getInfo() const

Defined in VAmiga.h:1939

Returns the component's current state.

getInfo() reads the live state on the calling thread. The result is only consistent if the emulator is paused or suspended. getCachedInfo() returns the snapshot the emulator thread has recorded most recently, which is the one to use while the emulator runs. Both return references that can be overwritten by a later call or by the emulator thread, so copy the data if you need to keep it.


getCachedInfo ​

const

cpp
const VideoPortInfo & getCachedInfo() const

Defined in VAmiga.h:1941

Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).