protected override Gdk.Pixmap Create(Gdk.Color fg, Gdk.Color bg) { Gdk.Window win = widget.GdkWindow; Gdk.GC gc = new Gdk.GC(win); Gdk.Pixmap pix = new Gdk.Pixmap(win, 256*2*width, height, -1); // draw the background gc.RgbFgColor = bg; pix.DrawRectangle(gc, true, 0, 0, 256*2*width, height); // render the bytes string s; if (info.Uppercase == false) s = HexDrawer.HexTableLower; else s = HexDrawer.HexTableUpper; //System.Console.WriteLine(s); pangoLayout.SetText(s); gc.RgbFgColor = fg; pix.DrawLayout(gc, 0, 0, pangoLayout); return pix; }
protected override Gdk.Pixmap Create(Gdk.Color fg, Gdk.Color bg) { Gdk.Window win = widget.GdkWindow; Gdk.GC gc = new Gdk.GC(win); Gdk.Pixmap pix = new Gdk.Pixmap(win, 4*2*width, height, -1); // draw the background gc.RgbFgColor = bg; pix.DrawRectangle(gc, true, 0, 0, 4*2*width, height); // render the bytes string s = "00011011"; //Console.WriteLine(s); pangoLayout.SetText(s); gc.RgbFgColor = fg; pix.DrawLayout(gc, 0, 0, pangoLayout); return pix; }
protected override Gdk.Pixmap Create(Gdk.Color fg, Gdk.Color bg) { Gdk.Window win = widget.GdkWindow; Gdk.GC gc = new Gdk.GC(win); Gdk.Pixmap pix = new Gdk.Pixmap(win, 256 * 2 * width, height, -1); // draw the background gc.RgbFgColor = bg; pix.DrawRectangle(gc, true, 0, 0, 256 * 2 * width, height); // render the bytes string s; if (info.Uppercase == false) { s = HexDrawer.HexTableLower; } else { s = HexDrawer.HexTableUpper; } //System.Console.WriteLine(s); gc.RgbFgColor = fg; // Render the text in two parts (256 printable characters each). We do // this to work around a bug in some drivers that fail to render text // that ends up wider than 4096 pixels. pangoLayout.SetText(s.Substring(0, 256)); pix.DrawLayout(gc, 0, 0, pangoLayout); // The second part also contains the two Zero Width Non-Joiner // characters, so it's actually 258 string characters, although still // 256 printable characters. pangoLayout.SetText(s.Substring(256)); pix.DrawLayout(gc, 128 * 2 * width, 0, pangoLayout); return(pix); }
protected override Gdk.Pixbuf RenderInitialPixbuf (Gdk.Window parentwindow, Gdk.Rectangle bounds) { //FIXME add a drop shadow on the pixmap, and expand the bounds to include this using (Gdk.Pixmap pixmap = new Gdk.Pixmap (parentwindow, bounds.Width, bounds.Height)) { using (var bgGc = new Gdk.GC(pixmap)) { bgGc.RgbFgColor = CairoExtensions.CairoColorToGdkColor (marker.colorMatrix[0, 0, 0, 0, 0]); pixmap.DrawRectangle (bgGc, true, 0, 0, bounds.Width, bounds.Height); pixmap.DrawLayout (marker.gc, 4, (bounds.Height - marker.Layouts[0].Height) / 2, marker.Layouts[0].Layout); } return Gdk.Pixbuf.FromDrawable (pixmap, Colormap, 0, 0, 0, 0, bounds.Width, bounds.Height); } }
protected override Gdk.Pixbuf RenderInitialPixbuf(Gdk.Window parentwindow, Gdk.Rectangle bounds) { //FIXME add a drop shadow on the pixmap, and expand the bounds to include this using (Gdk.Pixmap pixmap = new Gdk.Pixmap(parentwindow, bounds.Width, bounds.Height)) { using (var bgGc = new Gdk.GC(pixmap)) { bgGc.RgbFgColor = CairoExtensions.CairoColorToGdkColor(marker.colorMatrix[0, 0, 0, 0, 0]); pixmap.DrawRectangle(bgGc, true, 0, 0, bounds.Width, bounds.Height); pixmap.DrawLayout(marker.gc, 4, (bounds.Height - marker.Layouts[0].Height) / 2, marker.Layouts[0].Layout); } return(Gdk.Pixbuf.FromDrawable(pixmap, Colormap, 0, 0, 0, 0, bounds.Width, bounds.Height)); } }