MCPcopy Create free account
hub / github.com/DentonW/DevIL / GetAlphaBlock

Function GetAlphaBlock

DevIL/src-IL/src/il_dds-save.cpp:941–960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939
940
941ILboolean GetAlphaBlock(ILubyte *Block, ILubyte *Data, ILimage *Image, ILuint XPos, ILuint YPos)
942{
943 ILuint x, y, i = 0, Offset = YPos * Image->Width + XPos;
944
945 for (y = 0; y < 4; y++) {
946 for (x = 0; x < 4; x++) {
947 if (XPos + x < Image->Width && YPos + y < Image->Height)
948 Block[i++] = Data[Offset + x];
949 else
950 // Variant of bugfix from https://sourceforge.net/forum/message.php?msg_id=5486779.
951 // If we are out of bounds of the image, just copy the adjacent data.
952 Block[i++] = Data[Offset];
953 }
954 // We do not want to read past the end of the image.
955 if (YPos + y + 1 < Image->Height)
956 Offset += Image->Width;
957 }
958
959 return IL_TRUE;
960}
961
962ILboolean Get3DcBlock(ILubyte *Block, ILubyte *Data, ILimage *Image, ILuint XPos, ILuint YPos, int channel)
963{

Callers 1

CompressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected