Difference between revisions of "API-Truecolor"

Jump to navigation Jump to search
707 bytes added ,  15:17, 25 October 2018
m
Text replacement - "</source>" to "</syntaxhighlight>"
m (added missing Graphics:: namespace prefix to crossBlit references)
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(3 intermediate revisions by 3 users not shown)
Line 39: Line 39:
==== Example ====
==== Example ====
Here is an example of a simple engine that uses the best color depth available to display and color-cycle this gradient: [[Image:QuuxGradientRGB565.png]]
Here is an example of a simple engine that uses the best color depth available to display and color-cycle this gradient: [[Image:QuuxGradientRGB565.png]]
<syntax type="C++">
<syntaxhighlight lang="cpp">
Common::Error QuuxEngine::run() {
Common::Error QuuxEngine::run() {
Graphics::PixelFormat ourFormat;
Graphics::PixelFormat ourFormat;
Line 156: Line 156:
return Common::kNoError;
return Common::kNoError;
}
}
</syntax>
</syntaxhighlight>


=== Backend initialization protocol ===
=== Backend initialization protocol ===
Line 184: Line 184:
*inline Graphics::PixelFormat Graphics::findCompatibleFormat(Common::List<Graphics::PixelFormat> backend, Common::List<Graphics::PixelFormat> frontend)
*inline Graphics::PixelFormat Graphics::findCompatibleFormat(Common::List<Graphics::PixelFormat> backend, Common::List<Graphics::PixelFormat> frontend)
**Returns the first entry on the backend list that also occurs in the frontend list, or CLUT8 if there is no matching format.
**Returns the first entry on the backend list that also occurs in the frontend list, or CLUT8 if there is no matching format.
*inline Graphics::PixelFormat (void)
**creates an uninitialized PixelFormat.
*inline Graphics::PixelFormat(byte BytesPerPixel, byte RBits, byte GBits, byte BBits, byte ABits, byte RShift, byte GShift, byte BShift, byte AShift)
**creates an initialized PixelFormat.
**[_]Bits is the width in bits of the relevant channel
***RBits = red bits, GBits = green bits, BBits = blue bits, ABits = alpha bits.
**[_]Shift is the number (starting from 0) of the least significant bit in the relevant channel, which is equal to the bitshift required to make a channel.
***In RGB565, RShift is 11, GShift is 5, and BShift is 0.
***In RGBA4444, RShift is 12, GShift is 8, BShift is 4, and AShift is 0.
*static inline Graphics::PixelFormat Graphics::PixelFormat::createFormatCLUT8(void)
*static inline Graphics::PixelFormat Graphics::PixelFormat::createFormatCLUT8(void)
**creates a PixelFormat set to indicate 256 color paletted mode
**creates a PixelFormat set to indicate 256 color paletted mode
TrustedUser
2,147

edits

Navigation menu