Hello,
> > * What kind of samples are missing?
>
> I'm looking for the features to implement a right-to-left, smooth-scrolling
> graph displaying real-time data. I have an (old) Win32 application which uses
> low-level stuff like BitBlt's etc to achieve this. I'm not sure at what
> level I
> could implement the same thing in Gtk#, or whether other Gnome (GnomeCanvas?)
> stuff is needed, though I need it to work on both linux and Win32.
I have attached a program that does the right-to-left rendering using
BitBlt. It depends on an image called "/tmp/a.png" to be available as
this is the image rendered.
This program uses Gdk.Pixbufs (which are client-side images), because it
was fast for me to use, but you might want to use server-side for a
sample like this as you would avoid sending the images from your app to
X on every iteration.
Also, this program has no error checking ;-)
Miguel.
using System;
using Gtk;
using GLib;
class Demo {
static DrawingArea d;
static int x;
static Gdk.Pixbuf pixbuf;
static void Main ()
{
Application.Init ();
Window w = new Window ("H");
d = new DrawingArea ();
d.SetSizeRequest (200, 200);
d.ExposeEvent += new ExposeEventHandler (ExposeHandler);
w.Add (d);
w.ShowAll ();
pixbuf = new Gdk.Pixbuf ("/tmp/a.png");
GLib.Timeout.Add (100, new TimeoutHandler (queue_repaint));
Application.Run ();
}
static bool queue_repaint ()
{
x += 5;
d.QueueDrawArea (0, 0, d.Allocation.Width, d.Allocation.Height);
if (x == pixbuf.Width)
return false;
return true;
}
static void ExposeHandler (object a , Gtk.ExposeEventArgs args)
{
Gdk.Window win = args.Event.Window;
win.DrawPixbuf (d.Style.WhiteGC, pixbuf, 0, 0, d.Allocation.Width-x, 0, x, d.Allocation.Height, Gdk.RgbDither.None, 0, 0);
}
}