MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getColor

Method getColor

Engine/source/gfx/bitmap/gBitmap.cpp:642–684  ·  view source on GitHub ↗

--------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

640
641//--------------------------------------------------------------------------
642bool GBitmap::getColor(const U32 x, const U32 y, ColorI& rColor) const
643{
644 if (x >= mWidth || y >= mHeight)
645 return false;
646
647 const U8* pLoc = getAddress(x, y);
648
649 switch (mInternalFormat) {
650 case GFXFormatA8:
651 case GFXFormatL8:
652 rColor.set( *pLoc, *pLoc, *pLoc, *pLoc );
653 break;
654
655 case GFXFormatR8G8B8:
656 case GFXFormatR8G8B8X8:
657 rColor.set( pLoc[0], pLoc[1], pLoc[2], 255 );
658 break;
659
660 case GFXFormatR8G8B8A8:
661 rColor.set( pLoc[0], pLoc[1], pLoc[2], pLoc[3] );
662 break;
663
664 case GFXFormatR5G5B5A1:
665#if defined(TORQUE_OS_MAC)
666 rColor.set( (*((U16*)pLoc) >> 0) & 0x1F,
667 (*((U16*)pLoc) >> 5) & 0x1F,
668 (*((U16*)pLoc) >> 10) & 0x1F,
669 ((*((U16*)pLoc) >> 15) & 0x01) ? 255 : 0 );
670#else
671 rColor.set( *((U16*)pLoc) >> 11,
672 (*((U16*)pLoc) >> 6) & 0x1f,
673 (*((U16*)pLoc) >> 1) & 0x1f,
674 (*((U16*)pLoc) & 1) ? 255 : 0 );
675#endif
676 break;
677
678 default:
679 AssertFatal(false, "Bad internal format");
680 return false;
681 }
682
683 return true;
684}
685
686
687//--------------------------------------------------------------------------

Callers 15

buildPolyListMethod · 0.45
_convertToVertexDataMethod · 0.45
resolveColorMethod · 0.45
resolveLightColorFunction · 0.45
resolveTransparencyMethod · 0.45
getBitmapModulationMethod · 0.45
sReadMNGFunction · 0.45
_scoreLightsMethod · 0.45
_update4LightConstsMethod · 0.45
setLightParametersMethod · 0.45
setShaderParamsMethod · 0.45

Calls 1

setMethod · 0.45

Tested by

no test coverage detected