mirror of
https://github.com/robmcmullen/asmgen.git
synced 2025-02-21 21:29:13 +00:00
Determine palette bit from first *non-black* pixel on the row
This commit is contained in:
parent
a5907dc2e3
commit
2c4a951a27
10
HiSprite.py
10
HiSprite.py
@ -500,11 +500,18 @@ class HGR(ScreenFormat):
|
|||||||
|
|
||||||
for row in range(source.height):
|
for row in range(source.height):
|
||||||
bitStream = ""
|
bitStream = ""
|
||||||
|
highBit = "0"
|
||||||
|
highBitFound = False
|
||||||
|
|
||||||
# Compute raw bitstream for row from PNG pixels
|
# Compute raw bitstream for row from PNG pixels
|
||||||
for pixelIndex in range(source.width):
|
for pixelIndex in range(source.width):
|
||||||
pixel = self.pixelColor(source.pixelData,row,pixelIndex)
|
pixel = self.pixelColor(source.pixelData,row,pixelIndex)
|
||||||
bitStream += bitDelegate(pixel)
|
bitStream += bitDelegate(pixel)
|
||||||
|
|
||||||
|
# Determine palette bit from first non-black pixel on each row
|
||||||
|
if not highBitFound and pixel != self.black and pixel != self.key:
|
||||||
|
highBit = highBitDelegate(pixel)
|
||||||
|
highBitFound = True
|
||||||
|
|
||||||
# Shift bit stream as needed
|
# Shift bit stream as needed
|
||||||
bitStream = shiftStringRight(bitStream, shift, self.bitsPerPixel)
|
bitStream = shiftStringRight(bitStream, shift, self.bitsPerPixel)
|
||||||
@ -530,9 +537,6 @@ class HGR(ScreenFormat):
|
|||||||
|
|
||||||
bitChunk = bitChunk[::-1]
|
bitChunk = bitChunk[::-1]
|
||||||
|
|
||||||
# Determine palette bit from first pixel on each row
|
|
||||||
highBit = highBitDelegate(source.pixelData[row][0])
|
|
||||||
|
|
||||||
byteSplits[byteIndex] = highBit + bitChunk
|
byteSplits[byteIndex] = highBit + bitChunk
|
||||||
bitPos += 7
|
bitPos += 7
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user