Re: Drawing lines in a gtk_layout



On 24 Apr 2001, Havoc Pennington wrote:

> 
> Jose Fernando Diago <jdiago escher puj edu co> writes: 
> > You mean that I should offset the drawing coordinates like this:
> > 
> > gdk_draw_line(GTK_LAYOUT(widget)->bin_window, widget->style->black_gc, xini, yini, xfin + layout->xoffset, yfin + layout->yoffset);
> > 
> 
> xoffset/yoffset are the position of the bin_window in the logical
> coordinate space of the entire scrollable area (i.e. the area defined
> by gtk_layout_set_size()).

Ok, I understand that. But I'm just wondering: what makes the xoffset and
yoffset to change it's value? From what I cant tell from my experience it
changes everytime I put or move something in the layout (am I right?) but
that's not a real explanation, is just an event that changes those
values.

> 
> So say you want to have a line at (100, 100) in the large coordinate
> space (scrollable area). If xoffset, yoffset is currently (10, 10),
> then the bin_window is at 10,10 in the scrollable area. So you have to
> draw to (90,90) in the bin window. i.e. subtract the x/y offset from
> the logical coordinates.
> 
> You need to offset both the start and end of the line (xini, yini as
> well as xfin, yfin).
> 
> Havoc
> 

Jose.





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