libretro.api.video.frame¶
Pixel format and software framebuffer types.
Corresponds to the retro_pixel_format and retro_framebuffer types
in libretro.h.
Module Attributes
Render a single video frame. |
Classes
Flags describing allowed memory access for a framebuffer. |
|
Flags describing the type of memory behind a framebuffer. |
|
Pixel format for video output. |
|
Corresponds to |
- retro_video_refresh_t¶
Render a single video frame.
Registered by the frontend and called by the core once per
retro_run()to deliver a frame of pixel data. PassingNone(or the value ofHW_FRAME_BUFFER_VALIDfor hardware rendering) fordataindicates that the frontend should reuse the previous frame.- Parameters:
data – A
c_void_ptrto the framebuffer. The pixel format is the one most recently set withRETRO_ENVIRONMENT_SET_PIXEL_FORMAT, defaulting toPixelFormat.RGB1555.width – Width of the frame, in pixels.
height – Height of the frame, in pixels.
pitch – Length of one row in
data, in bytes.
Note
For best performance the framebuffer should be packed (i.e.
pitch == width * bytes_per_pixel).Corresponds to
retro_video_refresh_tinlibretro.h.
- class PixelFormat[source]¶
Bases:
IntEnumPixel format for video output.
Corresponds to
retro_pixel_formatinlibretro.h.>>> from libretro.api.video import PixelFormat >>> PixelFormat.XRGB8888.bytes_per_pixel 4
- RGB1555 = 0¶
- XRGB8888 = 1¶
- RGB565 = 2¶
- property bytes_per_pixel¶
Size of a single pixel in this format, in bytes.
- property pillow_mode¶
PIL-compatible mode string for this pixel format.
- __new__(value)¶
- classmethod value in self¶
Return True if value is in cls.
value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members. 3) value is a pseudo-member (flags)
- classmethod self[name]¶
Return the member matching name.
- __init__()¶
- classmethod iter(self)¶
Return members in definition order.
- classmethod len(self)¶
Return the number of members (no aliases)
- class MemoryAccess[source]¶
Bases:
IntFlagFlags describing allowed memory access for a framebuffer.
Corresponds to the
RETRO_MEMORY_ACCESS_*constants inlibretro.h.- NONE = 0¶
- WRITE = 1¶
- READ = 2¶
- __new__(value)¶
- other in self¶
Returns True if self has at least the same flags set as other.
- iter(self)¶
Returns flags in definition order.
- len(self)¶
Return the number of members (no aliases)
- classmethod self[name]¶
Return the member matching name.
- __init__()¶
- class MemoryType[source]¶
Bases:
IntFlagFlags describing the type of memory behind a framebuffer.
Corresponds to the
RETRO_MEMORY_TYPE_*constants inlibretro.h.- NONE = 0¶
- CACHED = 1¶
- __new__(value)¶
- other in self¶
Returns True if self has at least the same flags set as other.
- iter(self)¶
Returns flags in definition order.
- len(self)¶
Return the number of members (no aliases)
- classmethod self[name]¶
Return the member matching name.
- __init__()¶
- class retro_framebuffer[source]¶
Bases:
StructureCorresponds to
retro_framebufferinlibretro.h.Describes a framebuffer obtained from the frontend.
>>> from libretro.api.video import retro_framebuffer >>> fb = retro_framebuffer() >>> fb.data is None True
- data¶
Pointer to the framebuffer’s pixel data.
- width¶
Width of the framebuffer in pixels.
- height¶
Height of the framebuffer in pixels.
- pitch¶
Number of bytes per row.
- format¶
Pixel format of the framebuffer.
- __init__(*args, **kwargs)¶
- classmethod __new__(*args, **kwargs)¶
- access_flags¶
Allowed memory access flags.
- memory_flags¶
Memory type flags.
- __deepcopy__(_)[source]¶
Create a deep copy of this framebuffer, including the pixel data. Intended for use by
copy.deepcopy().