MCPcopy Create free account
hub / github.com/DentonW/DevIL / ILAPIENTRY ilClampNTSC

Function ILAPIENTRY ilClampNTSC

DevIL/src-IL/src/il_manip.cpp:1129–1154  ·  view source on GitHub ↗

Clamps data values of unsigned bytes from 16 to 235 for display on an NTSC television. Reasoning for this is given at http://msdn.microsoft.com/en-us/library/bb174608.aspx.

Source from the content-addressed store, hash-verified

1127// NTSC television. Reasoning for this is given at
1128// http://msdn.microsoft.com/en-us/library/bb174608.aspx.
1129ILboolean ILAPIENTRY ilClampNTSC(void)
1130{
1131 ILuint x, y, z, c;
1132 ILuint Offset = 0;
1133
1134 if (iCurImage == NULL) {
1135 ilSetError(IL_ILLEGAL_OPERATION);
1136 return IL_FALSE;
1137 }
1138
1139 if (iCurImage->Type != IL_UNSIGNED_BYTE) // Should we set an error here?
1140 return IL_FALSE;
1141
1142 for (z = 0; z < iCurImage->Depth; z++) {
1143 for (y = 0; y < iCurImage->Height; y++) {
1144 for (x = 0; x < iCurImage->Width; x++) {
1145 for (c = 0; c < iCurImage->Bpp; c++) {
1146 iCurImage->Data[Offset + c] = IL_LIMIT(iCurImage->Data[Offset + c], 16, 235);
1147 }
1148 Offset += iCurImage->Bpp;
1149 }
1150 }
1151 }
1152
1153 return IL_TRUE;
1154}

Callers

nothing calls this directly

Calls 1

ilSetErrorFunction · 0.85

Tested by

no test coverage detected