Appearance
VideoPortAPI
cpp
#include <VirtualC64.h>cpp
class VideoPortAPIDefined in VirtualC64.h:698
Video Port Public API
Public Methods
| Return | Name | Description |
|---|---|---|
void | lockTexture | Locks the emulator texture. |
void | unlockTexture | Unlocks the emulator texture. |
const u32 * | getTexture const | Returns a pointer to the most recent stable texture. |
const u32 * | getTexture const | Returns the most recent stable texture together with its frame number. |
const u32 * | getXrayTexture const | Returns a pointer to the most recent stable X-Ray texture. |
const u32 * | getXrayTexture const | Returns the most recent stable X-Ray texture together with its frame number. |
void | saveTexture const | Saves the most recent stable texture as a PNG file. |
void | saveTexture const | Saves a cutout of the most recent stable texture as a PNG file (see above). |
void | saveXrayTexture const | Saves the most recent stable X-Ray texture as a PNG file. |
void | saveXrayTexture const | Saves a cutout of the most recent stable X-Ray texture as a PNG file. |
void | findInnerArea const | Determines the area of the texture that contains picture data. |
void | findInnerAreaNormalized const | Same as findInnerArea(), but returns normalized coordinates. |
const VideoPortConfig & | getConfig const | Returns the component's current configuration. |
const VideoPortInfo & | getInfo const | Returns the component's current state. |
const VideoPortInfo & | getCachedInfo const | Returns the most recent state snapshot recorded by the emulator thread (see getInfo()). |
lockTexture
cpp
void lockTexture()Defined in VirtualC64.h:731
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 VirtualC64.h:738
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() constDefined in VirtualC64.h:746
Returns a pointer to the most recent stable texture.
The texture dimensions are given by constants vc64::Tex::width and vc64::Tex::height texels. Each texel is represented by a 32 bit color value.
getTexture
const
cpp
const u32 * getTexture(isize * nr) constDefined in VirtualC64.h:751
Returns the most recent stable texture together with its frame number.
Parameters
| Parameter | Type | Description |
|---|---|---|
nr | isize * | Receives the frame number. |
getXrayTexture
const
cpp
const u32 * getXrayTexture() constDefined in VirtualC64.h:757
Returns a pointer to the most recent stable X-Ray texture.
The texture has the same dimensions as the regular texture.
getXrayTexture
const
cpp
const u32 * getXrayTexture(isize * nr) constDefined in VirtualC64.h:763
Returns the most recent stable X-Ray texture together with its frame number.
Parameters
| Parameter | Type | Description |
|---|---|---|
nr | isize * | Receives the frame number, which matches the number of the regular texture of the same frame. |
saveTexture
const
cpp
void saveTexture(const std::filesystem::path & path) constDefined in VirtualC64.h:772
Saves the most recent stable texture as a PNG file.
The cutout is given in texels of the texture. The upper bounds x2 and y2 are exclusive. Without a cutout, the entire texture is saved.
Exceptions
| Exception | Description |
|---|---|
Error | if the file cannot be written. |
saveTexture
const
cpp
void saveTexture(const std::filesystem::path & path, isize x1, isize x2, isize y1, isize y2) constDefined in VirtualC64.h:774
Saves a cutout of the most recent stable texture as a PNG file (see above).
saveXrayTexture
const
cpp
void saveXrayTexture(const std::filesystem::path & path) constDefined in VirtualC64.h:781
Saves the most recent stable X-Ray texture as a PNG file.
Exceptions
| Exception | Description |
|---|---|
Error | if the file cannot be written. |
saveXrayTexture
const
cpp
void saveXrayTexture(const std::filesystem::path & path, isize x1, isize x2, isize y1, isize y2) constDefined in VirtualC64.h:783
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) constDefined in VirtualC64.h:802
Determines the area of the texture that contains picture data.
The result is meant to be used to crop the border of the picture. The VirtualC64 core does not analyze the texture yet: the functions always return the complete texture. The emulator thread is suspended during the call.
findInnerArea() returns the coordinates in texture pixels, findInnerAreaNormalized() returns them relative to the size of the texture (0.0 ... 1.0).
Parameters
| Parameter | Type | Description |
|---|---|---|
x1 | isize & | Left edge of the picture area |
x2 | isize & | Right edge of the picture area |
y1 | isize & | Top edge of the picture area |
y2 | isize & | Bottom edge of the picture area |
findInnerAreaNormalized
const
cpp
void findInnerAreaNormalized(double & x1, double & x2, double & y1, double & y2) constDefined in VirtualC64.h:804
Same as findInnerArea(), but returns normalized coordinates.
getConfig
const
cpp
const VideoPortConfig & getConfig() constDefined in VirtualC64.h:708
Returns the component's current configuration.
getInfo
const
cpp
const VideoPortInfo & getInfo() constDefined in VirtualC64.h:719
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() constDefined in VirtualC64.h:721
Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).