small
This commit is contained in:
parent
a252dad7b3
commit
e1c98b0822
2 changed files with 8 additions and 8 deletions
|
@ -47,9 +47,10 @@ proc toPremultipliedAlpha*(c: Color): Color {.inline.} =
|
|||
|
||||
proc toStraightAlpha*(c: Color): Color {.inline.} =
|
||||
## Converts a color to from premultiplied alpha to straight.
|
||||
if c.a == 0:
|
||||
return
|
||||
result.r = c.r / c.a
|
||||
result.g = c.g / c.a
|
||||
result.b = c.b / c.a
|
||||
result.a = c.a
|
||||
if c.a != 0 and c.a != 1:
|
||||
result = c
|
||||
else:
|
||||
result.r = c.r / c.a
|
||||
result.g = c.g / c.a
|
||||
result.b = c.b / c.a
|
||||
result.a = c.a
|
||||
|
|
|
@ -437,10 +437,9 @@ proc encodePng*(
|
|||
raise newException(PixieError, "Invalid PNG number of channels")
|
||||
|
||||
let data = cast[ptr UncheckedArray[uint8]](data)
|
||||
const signature = [137.uint8, 80, 78, 71, 13, 10, 26, 10]
|
||||
|
||||
# Add the PNG file signature
|
||||
result.add(signature)
|
||||
result.add(pngSignature)
|
||||
|
||||
# Add IHDR
|
||||
result.addUint32(13.uint32.swap())
|
||||
|
|
Loading…
Reference in a new issue