[Gtk-sharp-list] Strange Behaviour with Graphics.Clear and Graphics.DrawImage
Aaron Radich
aaron at radich.com
Fri Jul 30 14:29:15 EDT 2010
Fixed. The Render() method was being called direction when it should
have been queue up via the DrawingArea.QueueDraw()
method.
Aaron
>
>
>
> I'm
seeing some strange behavior when debugging Graphics.Clear() and
>
Graphics.DrawImage() method calls in my Render() method code below.
The
> first time Render is called it works fine. The 2nd time the
call to
> Graphics.Clear caused the debugger to jump down X lines
to the
> " g.DrawImage(rightImage, xr, yr);"
line. When
> Graphics.DrawImage is called, the application is
then killed without an
> exception being raised. Any idea what
might be going on?
> "buffer" is defined as a
>
DrawingArea.
> Aaron
>
=======================================
> public
> void
Render()
> {
> if (buffer.GdkWindow == null)
>
> return;
>
> // Init the placement
values
> if (x == -1)
>
> {
>
x = (sceneWidth / 2) - (centerImage.Width / 2);
> y =
sceneHeight / 10;
> yl = y;
> yr = y;
> }
>
> using (Graphics g =
>
Gtk.DotNet.Graphics.FromDrawable(buffer.GdkWindow, true))
>
{
> // the next statement works the first time Render() is
called, but
> the 2nd time it forces the debugger to
>
// jump down do
> 'g.DrawImage(rightImage, xr, yr);', where
that statment then kills the
> application
> // no
exception is raised
>
> g.Clear(background);
> // first draw the center image
>
>
g.DrawImage(centerImage, x, y - centerGrowRate);
>
>
if
> (leftImage != null)
> {
>
// next we do the left
> one.
> xl = x -
objectSeparation - leftImage.Width;
>
g.DrawImage(leftImage, xl, yl);
> }
>
>
> if (rightImage != null)
> {
>
// finally the right
> one
> xr = x +
objectSeparation +
> centerImage.Width;
> // the
next line kills the application
> on the 2nd call to Render()
> g.DrawImage(rightImage, xr,
> yr);
>
}
> } // using Graphics
> }
>
>
_______________________________________________
> Gtk-sharp-list
maillist - Gtk-sharp-list at lists.ximian.com
>
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100730/8a3fd202/attachment.html
More information about the Gtk-sharp-list
mailing list