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

Function ILAPIENTRY ilDefaultImage

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

Creates an ugly 64x64 black and yellow checkerboard image.

Source from the content-addressed store, hash-verified

805
806//! Creates an ugly 64x64 black and yellow checkerboard image.
807ILboolean ILAPIENTRY ilDefaultImage()
808{
809 ILubyte *TempData;
810 ILubyte Yellow[3] = { 18, 246, 243 };
811 ILubyte Black[3] = { 0, 0, 0 };
812 ILubyte *ColorPtr = Yellow; // The start color
813 ILboolean Color = IL_TRUE;
814
815 // Loop Variables
816 ILint v, w, x, y;
817
818 if (iCurImage == NULL) {
819 ilSetError(IL_ILLEGAL_OPERATION);
820 return IL_FALSE;
821 }
822
823 if (!ilTexImage(64, 64, 1, 3, IL_BGR, IL_UNSIGNED_BYTE, NULL)) {
824 return IL_FALSE;
825 }
826 iCurImage->Origin = IL_ORIGIN_LOWER_LEFT;
827 TempData = iCurImage->Data;
828
829 for (v = 0; v < 8; v++) {
830 // We do this because after a "block" line ends, the next row of blocks
831 // above starts with the ending colour, but the very inner loop switches them.
832 if (Color) {
833 Color = IL_FALSE;
834 ColorPtr = Black;
835 }
836 else {
837 Color = IL_TRUE;
838 ColorPtr = Yellow;
839 }
840
841 for (w = 0; w < 8; w++) {
842 for (x = 0; x < 8; x++) {
843 for (y = 0; y < 8; y++, TempData += iCurImage->Bpp) {
844 TempData[0] = ColorPtr[0];
845 TempData[1] = ColorPtr[1];
846 TempData[2] = ColorPtr[2];
847 }
848
849 // Switch to alternate between black and yellow
850 if (Color) {
851 Color = IL_FALSE;
852 ColorPtr = Black;
853 }
854 else {
855 Color = IL_TRUE;
856 ColorPtr = Yellow;
857 }
858 }
859 }
860 }
861
862 return IL_TRUE;
863}
864

Callers

nothing calls this directly

Calls 1

ilSetErrorFunction · 0.85

Tested by

no test coverage detected