Skip to content

Commit f747ee4

Browse files
committed
Fix wrong palette write order in WriteIndexedBitmapFromPixmap
1 parent f7471df commit f747ee4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Types/IndexedImageWriter.bmx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ Type IndexedImageWriter
102102
WriteInt(outputStream, 256) 'Number of colors in the color palette (4 bytes)
103103
WriteInt(outputStream, 0) 'Number of important colors (4 bytes) - 0 when every color is important
104104

105-
'Color Table (4 bytes (RGBA) times the amount of colors in the palette)
105+
'Color Table (4 bytes (BGRA (little-endian)) times the amount of colors in the palette)
106106
For Local paletteIndex:RGBColor = EachIn m_Palette
107-
WriteByte(outputStream, paletteIndex.m_R) 'Blue (1 byte)
107+
WriteByte(outputStream, paletteIndex.m_B) 'Blue (1 byte)
108108
WriteByte(outputStream, paletteIndex.m_G) 'Green (1 byte)
109-
WriteByte(outputStream, paletteIndex.m_B) 'Red (1 byte)
109+
WriteByte(outputStream, paletteIndex.m_R) 'Red (1 byte)
110110
WriteByte(outputStream, 0) 'Reserved (1 byte) - Alpha channel, irrelevant for indexed bitmaps
111111
Next
112112

Types/IndexedPixmap.bmx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Type IndexedPixmap
2929
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3030

3131
Method PixelPtr:Byte Ptr(x:Int, y:Int)
32-
Return m_Pixels + (y * m_Width) + (x * BytesPerPixel[PF_I8])
32+
Return m_Pixels + (y * m_Width) + x
3333
EndMethod
3434

3535
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)