MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / bitmap_write

Function bitmap_write

TheForceEngine/TFE_Jedi/Level/rtexture.cpp:719–752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

717 }
718
719 void bitmap_write(const char* filePath, u16 width, u16 height, u8* image, u8 flags)
720 {
721 const u32 pixelCount = u32(width) * u32(height);
722
723 FileStream bmFile;
724 if (bmFile.open(filePath, Stream::MODE_WRITE))
725 {
726 char fheader[3] = { 'B', 'M', ' ' };
727 bmFile.writeBuffer(fheader, 3);
728
729 u8 version = DF_BM_VERSION;
730 bmFile.write(&version);
731
732 u8 logSizeY = TFE_Math::log2(height);
733 u8 compressed = 0;
734 u8 unused = 0;
735 bmFile.write(&width);
736 bmFile.write(&height);
737 bmFile.write(&width); // uvWidth
738 bmFile.write(&height); // uvHeight
739 bmFile.write(&flags);
740 bmFile.write(&logSizeY);
741 bmFile.write(&compressed);
742 bmFile.write(&unused);
743 bmFile.write(&pixelCount); // dataSize
744
745 u8 padding[12] = { 0 };
746 bmFile.writeBuffer(padding, 12);
747
748 // Image data.
749 bmFile.writeBuffer(image, pixelCount);
750 bmFile.close();
751 }
752 }
753
754 void bitmap_writeOpaque(const char* filePath, u16 width, u16 height, u8* image)
755 {

Callers 2

bitmap_writeOpaqueFunction · 0.85
bitmap_writeTransparentFunction · 0.85

Calls 5

log2Function · 0.85
openMethod · 0.45
writeBufferMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected