OpenTTD Source 20260218-master-g2123fca5ea
SpriteEncoder Class Referenceabstract

Interface for something that can encode a sprite. More...

#include <spriteloader.hpp>

Inheritance diagram for SpriteEncoder:
Blitter OpenGLBackend Blitter_32bppBase Blitter_8bppBase Blitter_Null Blitter_32bppSimple Blitter_8bppOptimized Blitter_8bppSimple Blitter_32bppOptimized Blitter_32bppAnim Blitter_40bppAnim

Public Member Functions

virtual bool Is32BppSupported ()=0
 Can the sprite encoder make use of RGBA sprites?
virtual SpriteEncode (SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)=0
 Convert a sprite from the loader to our own format.
virtual uint GetSpriteAlignment ()
 Get the value which the height and width on a sprite have to be aligned by.

Detailed Description

Interface for something that can encode a sprite.

Definition at line 130 of file spriteloader.hpp.

Member Function Documentation

◆ Encode()

virtual Sprite * SpriteEncoder::Encode ( SpriteType sprite_type,
const SpriteLoader::SpriteCollection & sprite,
SpriteAllocator & allocator )
pure virtual

Convert a sprite from the loader to our own format.

Parameters
sprite_typeThe type of sprite to load.
spriteThe sprites to load.
allocatorThe allocator for the sprite's memory.
Returns
The encoded sprite.

Implemented in Blitter_32bppOptimized, Blitter_32bppSimple, Blitter_40bppAnim, Blitter_8bppOptimized, Blitter_8bppSimple, Blitter_Null, and OpenGLBackend.

Referenced by CoreTextFontCache::InternalGetGlyph(), FreeTypeFontCache::InternalGetGlyph(), Win32FontCache::InternalGetGlyph(), and ReadSprite().

◆ GetSpriteAlignment()

virtual uint SpriteEncoder::GetSpriteAlignment ( )
inlinevirtual

Get the value which the height and width on a sprite have to be aligned by.

Returns
The needed alignment or 0 if any alignment is accepted.

Reimplemented in OpenGLBackend.

Definition at line 154 of file spriteloader.hpp.

◆ Is32BppSupported()

virtual bool SpriteEncoder::Is32BppSupported ( )
pure virtual

Can the sprite encoder make use of RGBA sprites?

Returns
true iff RGBA sprites are supported.

Implemented in Blitter, and OpenGLBackend.

Referenced by ReadSprite().


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