Re: [gtk-list] gdk_draw_rectangle problems




Is is possible that the update_rect.width and update_rect.height in
your example are not being set?  Your example doesn't set them and if
they're zero you might get a point.  

 -Eric

---Brian Gregor <bgregor@buphy.bu.edu> wrote:
>
> 
> I am having trouble getting gdk_draw_rectangle to draw anything
> but points...  The code is reading color data from a file, and 
> then displaying it in a drawing area as blocks (to make an image
> from a simulation).  
> 
> I have created several graphics contexts for red, green, and blue, 
> and these work ok. Looping  through the data, I use this:
> 
>   for (y = 0; y < simul_data.ny; y++) {
>       for (time = 0; time < simul_data.nt; time++) which updates the {
>           for (x = 0; x < simul_data.nx; x++) {
>               update_rect.x = (gint) (gint) x + (gint) x_diff;
>               update_rect.y = (gint) (gint) y + (gint) y_diff;
>               switch (simul_data.data[time*simul_data.nt+x+y]) {
>                 case '1':
>                   gdk_draw_rectangle (pixmap,
>                                       gc_red,
>                                       TRUE,
>                                       update_rect.x, update_rect.y,
>                                       update_rect.width,
>                                       update_rect.height);
>                   break;
> .....etc for the switch statement....
> 
> and in the outermost loop there is:
> 
>         gtk_widget_draw (draw_area, NULL);
> 
> to update everything all at once.  The drawing area is connected
> to handlers for configure_event and expose_event as per the 'scribble'
> example in the tutorial.  I have checked the values in update_rect
> (a GdkRectangle variable) and they are correct, i.e. it should def.
> be drawing blocks, not points!!  They are all drawn in the uppermost
> left corner, as expected...  The same thing happens when each 
> gdk_draw_rectangle is followed by a gtk_widget_draw, except that 
> things run much slower.
> 
> Can anyone help?  I am quite new to GTK, and this one has me
mystified.
> 
> 
> 
> Thanks,
> 
> Brian
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com <
/dev/null
> 
> 

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]