morepretty

This commit is contained in:
Ryan Oldenburg 2021-10-27 16:44:22 -05:00
parent a718fb6b1b
commit 4a0d9c29b8
5 changed files with 17 additions and 14 deletions

View file

@ -10,7 +10,7 @@ var
frameCount = 0 frameCount = 0
image = Image(w, h) image = Image(w, h)
app = App() app = App()
frame = Frame(title="wNim/Pixie") frame = Frame(title = "wNim/Pixie")
proc draw() = proc draw() =
# draw shiny sphere on gradient background # draw shiny sphere on gradient background

View file

@ -808,7 +808,9 @@ proc parseKernTable(buf: string, offset: int): KernTable =
else: else:
failUnsupported("Kern version") failUnsupported("Kern version")
proc parseCFFIndexOffsets(buf: string, start: var int, stripZero = false): seq[(int, int)] = proc parseCFFIndexOffsets(
buf: string, start: var int, stripZero = false
): seq[(int, int)] =
proc getOffset(buf: string, offset, offSize: int): int = proc getOffset(buf: string, offset, offSize: int): int =
var v = 0 var v = 0

View file

@ -32,6 +32,7 @@ import chroma, pixie, pixie/fileformats/bmp
block: block:
for bits in [32, 24]: for bits in [32, 24]:
let image = let image = decodeBmp(readFile(
decodeBmp(readFile("tests/fileformats/bmp/knight." & $bits & ".master.bmp")) "tests/fileformats/bmp/knight." & $bits & ".master.bmp"
))
writeFile("tests/fileformats/bmp/knight." & $bits & ".bmp", encodeBmp(image)) writeFile("tests/fileformats/bmp/knight." & $bits & ".bmp", encodeBmp(image))

View file

@ -244,10 +244,10 @@ block:
b = readImage(&"tests/images/turtle.png") b = readImage(&"tests/images/turtle.png")
a.fill(rgba(255, 255, 255, 255)) a.fill(rgba(255, 255, 255, 255))
let m = translate(vec2(50, 50)) * rotate(-5.toRadians) let m = translate(vec2(50, 50)) * rotate(-5.toRadians)
a.draw(b, m * translate(vec2(0,0))) a.draw(b, m * translate(vec2(0, 0)))
a.draw(b, m * translate(vec2(-40,0))) a.draw(b, m * translate(vec2(-40, 0)))
a.draw(b, m * translate(vec2(-40,-40))) a.draw(b, m * translate(vec2(-40, -40)))
a.draw(b, m * translate(vec2(0,-40))) a.draw(b, m * translate(vec2(0, -40)))
doDiff(a, "smooth12") doDiff(a, "smooth12")
block: block:

View file

@ -2,10 +2,10 @@ import pixie, stb_truetype, unicode
let fontFiles = [ let fontFiles = [
# "tests/fonts/Roboto-Regular_1.ttf" # "tests/fonts/Roboto-Regular_1.ttf"
# "tests/fonts/Aclonica-Regular_1.ttf" # "tests/fonts/Aclonica-Regular_1.ttf"
# "tests/fonts/Ubuntu-Regular_1.ttf" # "tests/fonts/Ubuntu-Regular_1.ttf"
# "tests/fonts/IBMPlexSans-Regular_2.ttf" # "tests/fonts/IBMPlexSans-Regular_2.ttf"
# "tests/fonts/NotoSans-Regular_4.ttf" # "tests/fonts/NotoSans-Regular_4.ttf"
"tests/fonts/Pacifico-Regular_4.ttf" "tests/fonts/Pacifico-Regular_4.ttf"
] ]
@ -38,5 +38,5 @@ for fontFile in fontFiles:
echo "DISAGREE: ", a, " != ", b, " <<<<<<<<<<<<<<<<<<<<<<<<<<<" echo "DISAGREE: ", a, " != ", b, " <<<<<<<<<<<<<<<<<<<<<<<<<<<"
# quit() # quit()
# echo stbtt.getCodepointKernAdvance(Rune('r'), Rune('s')).float32 # echo stbtt.getCodepointKernAdvance(Rune('r'), Rune('s')).float32
# echo font.typeface.getKerningAdjustment(Rune('r'), Rune('s')) # echo font.typeface.getKerningAdjustment(Rune('r'), Rune('s'))