xgb-render: give up on composite alpha
This commit is contained in:
parent
9424579c75
commit
23586eae01
|
@ -234,13 +234,10 @@ func main() {
|
||||||
bounds := f.Bounds(fixed.Int26_6(opts.Size * float64(opts.DPI) *
|
bounds := f.Bounds(fixed.Int26_6(opts.Size * float64(opts.DPI) *
|
||||||
(64.0 / 72.0)))
|
(64.0 / 72.0)))
|
||||||
|
|
||||||
var rgbFormat render.Pictformat
|
var alphaFormat render.Pictformat
|
||||||
for _, pf := range pformats.Formats {
|
for _, pf := range pformats.Formats {
|
||||||
// Hopefully. Might want to check ARGB/BGRA.
|
if pf.Depth == 8 && pf.Direct.AlphaMask == 0xff {
|
||||||
if pf.Depth == 32 && pf.Direct.AlphaMask != 0 {
|
alphaFormat = pf.Id
|
||||||
rgbFormat = pf.Id
|
|
||||||
log.Printf("%+v\n", pf)
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,11 +247,12 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: A depth of 24 will not work, the server always rejects it.
|
// NOTE: A depth of 24 will not work, the server always rejects it.
|
||||||
_ = render.CreateGlyphSet(X, gsid, rgbFormat)
|
// Composite alpha doesn't make sense since golang/freetype can't use it.
|
||||||
|
_ = render.CreateGlyphSet(X, gsid, alphaFormat)
|
||||||
|
|
||||||
// TODO: Seems like we want to use NRGBA. Or RGBA if the A is always 1.
|
// NOTE: We could do gamma post-correction in higher precision if we
|
||||||
// Or implement our own image.Image for direct gamma-corrected RGB!
|
// implemented our own clone of the image.Image implementation.
|
||||||
nrgb := image.NewRGBA(image.Rect(
|
nrgb := image.NewGray(image.Rect(
|
||||||
+bounds.Min.X.Floor(),
|
+bounds.Min.X.Floor(),
|
||||||
-bounds.Min.Y.Floor(),
|
-bounds.Min.Y.Floor(),
|
||||||
+bounds.Max.X.Ceil(),
|
+bounds.Max.X.Ceil(),
|
||||||
|
|
Loading…
Reference in New Issue