You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: renderers/rasterizer/rasterizer.go
+42-68
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,14 @@ package rasterizer
2
2
3
3
import (
4
4
"image"
5
+
"image/color"
5
6
"math"
6
7
8
+
"github.com/srwiley/rasterx"
9
+
"github.com/srwiley/scanx"
7
10
"github.com/tdewolff/canvas"
8
11
"golang.org/x/image/draw"
9
12
"golang.org/x/image/math/f64"
10
-
"golang.org/x/image/vector"
11
13
)
12
14
13
15
// TODO: add ASM optimized version for NRGBA images, since those are much faster to write as PNG
@@ -27,7 +29,8 @@ type Rasterizer struct {
27
29
resolution canvas.Resolution
28
30
colorSpace canvas.ColorSpace
29
31
30
-
ras*vector.Rasterizer// reuse
32
+
spanner*scanx.ImgSpanner
33
+
scanner*scanx.Scanner
31
34
}
32
35
33
36
// New returns a renderer that draws to a rasterized image. The final width and height of the image is the width and height (mm) multiplied by the resolution (px/mm), thus a higher resolution results in larger images. By default the linear color space is used, which assumes input and output colors are in linearRGB. If the sRGB color space is used for drawing with an average of gamma=2.2, the input and output colors are assumed to be in sRGB (a common assumption) and blending happens in linearRGB. Be aware that for text this results in thin stems for black-on-white (but wide stems for white-on-black).
0 commit comments