From 215e3e863003d8c62600507b5e302a7f4da2de55 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Tue, 21 Aug 2018 20:47:06 +0200 Subject: xgb-render: add some comments Some containing code to list out potentially interesting information from the X server. --- prototypes/xgb-xrender.go | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/prototypes/xgb-xrender.go b/prototypes/xgb-xrender.go index 73b5fed..3ae51ad 100644 --- a/prototypes/xgb-xrender.go +++ b/prototypes/xgb-xrender.go @@ -73,11 +73,34 @@ func main() { _ = xproto.MapWindow(X, wid) + /* + rfilters, err := render.QueryFilters(X, xproto.Drawable(wid)).Reply() + if err != nil { + log.Fatalln(err) + } + + filters := []string{} + for _, f := range rfilters.Filters { + filters = append(filters, f.Name) + } + + log.Printf("filters: %v\n", filters) + */ + pformats, err := render.QueryPictFormats(X).Reply() if err != nil { log.Fatalln(err) } + /* + for _, pf := range pformats.Formats { + log.Printf("format %2d: depth %2d, RGBA %3x %3x %3x %3x\n", + pf.Id, pf.Depth, + pf.Direct.RedMask, pf.Direct.GreenMask, pf.Direct.BlueMask, + pf.Direct.AlphaMask) + } + */ + // Similar to XRenderFindVisualFormat. // The DefaultScreen is almost certain to be zero. var pformat render.Pictformat @@ -100,6 +123,8 @@ func main() { if err != nil { log.Fatalln(err) } + + // Dithering is not supported. :( render.CreatePicture(X, pid, xproto.Drawable(wid), pformat, 0, []uint32{}) // Reserve an ID for the gradient. @@ -133,6 +158,7 @@ func main() { return } + // We could also use a transformation matrix for changes in size. _ = render.CreateLinearGradient(X, gid, render.Pointfix{F64ToFixed(0), F64ToFixed(0)}, render.Pointfix{F64ToFixed(0), F64ToFixed(float64(h) - 100)}, @@ -172,5 +198,4 @@ func main() { gradient() } } - } -- cgit v1.2.3-70-g09d2