morepretty

This commit is contained in:
Ryan Oldenburg 2021-05-31 20:41:03 -05:00
parent 3b6474b565
commit 7ea0a37013
7 changed files with 42 additions and 36 deletions

View file

@ -108,16 +108,26 @@ proc main() =
# Figure out the right size of the window we want.
var rect: lean.RECT
rect.left = 0
rect.top = 0
rect.right = w
rect.left = 0
rect.top = 0
rect.right = w
rect.bottom = h
AdjustWindowRectEx(cast[LPRECT](rect.addr), WS_OVERLAPPEDWINDOW, 0, 0)
# Open the window.
hwnd = CreateWindow(appName, "Win32/Pixie", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top,
0, 0, hInstance, nil)
hwnd = CreateWindow(
appName,
"Win32/Pixie",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
rect.right - rect.left,
rect.bottom - rect.top,
0,
0,
hInstance,
nil
)
ShowWindow(hwnd, SW_SHOW)
UpdateWindow(hwnd)

View file

@ -1,4 +1,4 @@
import pixie, wNim/[wApp, wFrame, wPaintDC, wImage]
import pixie, wFrame, wImage], wNim/[wApp, wPaintDC
let
w = 256

View file

@ -1,10 +1,6 @@
import opengl, pixie, pixie/context
import opengl, pixie, pixie/context, staticglfw except Image
export pixie
import staticglfw except Image
export staticglfw except Image
export pixie, staticglfw except Image
var
dpi: float32 = 1.0

View file

@ -18,8 +18,8 @@ type
lineHeight*: float32 ## The line height in pixels or AutoLineHeight for the font's default line height.
paint*: Paint
textCase*: TextCase
underline*: bool ## Apply an underline.
strikethrough*: bool ## Apply a strikethrough.
underline*: bool ## Apply an underline.
strikethrough*: bool ## Apply a strikethrough.
noKerningAdjustments*: bool ## Optionally disable kerning pair adjustments
Span* = ref object
@ -27,11 +27,11 @@ type
font*: Font
Arrangement* = ref object
lines*: seq[(int, int)] ## The (start, stop) of the lines of text.
spans*: seq[(int, int)] ## The (start, stop) of the spans in the text.
fonts*: seq[Font] ## The font for each span.
runes*: seq[Rune] ## The runes of the text.
positions*: seq[Vec2] ## The positions of the glyphs for each rune.
lines*: seq[(int, int)] ## The (start, stop) of the lines of text.
spans*: seq[(int, int)] ## The (start, stop) of the spans in the text.
fonts*: seq[Font] ## The font for each span.
runes*: seq[Rune] ## The runes of the text.
positions*: seq[Vec2] ## The positions of the glyphs for each rune.
selectionRects*: seq[Rect] ## The selection rects for each glyph.
HAlignMode* = enum

View file

@ -1,4 +1,4 @@
import pixie, random, os
import os, pixie, random
when not defined(pixieLeakCheck):
quit("Requires -d:pixieLeakCheck")

View file

@ -1,4 +1,4 @@
import pixie, random, pixie/fileformats/svg
import pixie, pixie/fileformats/svg, random
when not defined(pixieLeakCheck):
quit("Requires -d:pixieLeakCheck")
@ -8,7 +8,7 @@ randomize()
let data = readFile("tests/images/svg/Ghostscript_Tiger.svg")
for i in 0 ..< 100_000:
var image = decodeSvg(data, rand(300 .. 1800), rand(30 .. 1800))
var image = decodeSvg(data, rand(300 .. 1800), rand(30 .. 1800))
# image.writeFile("tests/fuzz_leaks3.png")
# break

View file

@ -499,20 +499,20 @@ block:
var y = 15.float32
proc drawDashedLine(pattern: seq[float32]) =
ctx.beginPath();
ctx.setLineDash(pattern);
ctx.moveTo(0, y);
ctx.lineTo(300, y);
ctx.stroke();
y += 20;
ctx.beginPath()
ctx.setLineDash(pattern)
ctx.moveTo(0, y)
ctx.lineTo(300, y)
ctx.stroke()
y += 20
drawDashedLine(@[]);
drawDashedLine(@[1.float32, 1]);
drawDashedLine(@[10.float32, 10]);
drawDashedLine(@[20.float32, 5]);
drawDashedLine(@[15.float32, 3, 3, 3]);
drawDashedLine(@[20.float32, 3, 3, 3, 3, 3, 3, 3]);
drawDashedLine(@[12.float32, 3, 3]);
drawDashedLine(@[])
drawDashedLine(@[1.float32, 1])
drawDashedLine(@[10.float32, 10])
drawDashedLine(@[20.float32, 5])
drawDashedLine(@[15.float32, 3, 3, 3])
drawDashedLine(@[20.float32, 3, 3, 3, 3, 3, 3, 3])
drawDashedLine(@[12.float32, 3, 3])
image.writeFile("tests/images/context/setLineDash_1.png")