RSS/Atom feed Twitter
Site is read-only, email is disabled

difference between canvas_draw and draw_tool_draw functions

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

11 of 11 messages available
Toggle history

Please log in to manage your subscriptions.

difference between canvas_draw and draw_tool_draw functions Olivier 30 Sep 10:56
  difference between canvas_draw and draw_tool_draw functions Sven Neumann 30 Sep 11:27
   difference between canvas_draw and draw_tool_draw functions Olivier 30 Sep 12:10
    difference between canvas_draw and draw_tool_draw functions Sven Neumann 30 Sep 12:46
     difference between canvas_draw and draw_tool_draw functions Olivier 30 Sep 12:59
      difference between canvas_draw and draw_tool_draw functions Sven Neumann 30 Sep 13:01
       difference between canvas_draw and draw_tool_draw functions Olivier 30 Sep 13:15
        difference between canvas_draw and draw_tool_draw functions Sven Neumann 30 Sep 13:34
      difference between canvas_draw and draw_tool_draw functions Sven Neumann 30 Sep 14:41
    difference between canvas_draw anddraw_tool_draw functions Austin Donnelly 30 Sep 12:55
     difference between canvas_draw anddraw_tool_draw functions Sven Neumann 30 Sep 13:28
Olivier
2004-09-30 10:56:31 UTC (over 19 years ago)

difference between canvas_draw and draw_tool_draw functions

Hi all,

what is the difference between for example gimp_canvas_draw_rectangle and gimp_draw_tool_draw_rectangle?

when should one use which function?

thanks, Olivier

Sven Neumann
2004-09-30 11:27:17 UTC (over 19 years ago)

difference between canvas_draw and draw_tool_draw functions

Hi,

lists@olivier.pk.wau.nl (Olivier) writes:

what is the difference between for example gimp_canvas_draw_rectangle and gimp_draw_tool_draw_rectangle?

The GimpDrawTool API takes image coordinates while the (lowerlevel) GimpCanvas API takes display coordinates.

when should one use which function?

Whenever possible the tools should draw using the GimpDrawTool API and only GimpDrawTool should use the GimpCanvas API.

Sven

Olivier
2004-09-30 12:10:26 UTC (over 19 years ago)

difference between canvas_draw and draw_tool_draw functions

On Thu, Sep 30, 2004 at 11:27:17AM +0200, Sven Neumann wrote:

what is the difference between for example gimp_canvas_draw_rectangle and gimp_draw_tool_draw_rectangle?

The GimpDrawTool API takes image coordinates while the (lowerlevel) GimpCanvas API takes display coordinates.

the drawtool always paints using GIMP_CANVAS_STYLE_XOR, correct? I'm creating a patch to add an option to the crop tool to blind the region outside the crop area, so you can see how the image will look after cropping. I've not decided yet if XOR is good, or if the area should become black. Anybody a preference?

another question, how can I 'undraw' a section, after the user for example changed the location of a handle? If I use XOR this is not a problem, but if I draw the area black, this is a problem.

thanks, Olivier

Sven Neumann
2004-09-30 12:46:02 UTC (over 19 years ago)

difference between canvas_draw and draw_tool_draw functions

Hi,

lists@olivier.pk.wau.nl (Olivier) writes:

On Thu, Sep 30, 2004 at 11:27:17AM +0200, Sven Neumann wrote:

what is the difference between for example gimp_canvas_draw_rectangle and gimp_draw_tool_draw_rectangle?

The GimpDrawTool API takes image coordinates while the (lowerlevel) GimpCanvas API takes display coordinates.

the drawtool always paints using GIMP_CANVAS_STYLE_XOR, correct? I'm creating a patch to add an option to the crop tool to blind the region outside the crop area, so you can see how the image will look after cropping. I've not decided yet if XOR is good, or if the area should become black. Anybody a preference?

I think neither XOR nor black are an option here. What we would want to see is a less saturated and darkened version of the image being shown outside the crop region. That is not going to be a trivial change though.

Sven

Austin Donnelly
2004-09-30 12:55:46 UTC (over 19 years ago)

difference between canvas_draw anddraw_tool_draw functions

the drawtool always paints using GIMP_CANVAS_STYLE_XOR, correct? I'm creating a patch to add an option to the crop tool to blind the region outside the crop area, so you can see how the image will look after cropping. I've not decided yet if XOR is good, or if the area should become
black. Anybody a preference?

I'd vote for greying/dimming the image outside the crop area, much like the QuickMask feature turns stuff red. In fact, you could look at the quickmask code to see how that does it.

Austin

Olivier
2004-09-30 12:59:15 UTC (over 19 years ago)

difference between canvas_draw and draw_tool_draw functions

On Thu, Sep 30, 2004 at 12:46:02PM +0200, Sven Neumann wrote:

the drawtool always paints using GIMP_CANVAS_STYLE_XOR, correct? I'm creating a patch to add an option to the crop tool to blind the region outside the crop area, so you can see how the image will look after cropping. I've not decided yet if XOR is good, or if the area should become black. Anybody a preference?

I think neither XOR nor black are an option here. What we would want to see is a less saturated and darkened version of the image being shown outside the crop region. That is not going to be a trivial change though.

less saturated won't work for grayscale images, but darkened would be OK I think, but I don't think I can do that on my second day of gimp hacking indeed ;-) But black is a useful start, it can always be improved to a darkened image any later time (for now you can always toggle the checkbox if you want to see what the outer region of the image looks like).

regards, Olivier

Sven Neumann
2004-09-30 13:01:03 UTC (over 19 years ago)

difference between canvas_draw and draw_tool_draw functions

Hi,

lists@olivier.pk.wau.nl (Olivier) writes:

But black is a useful start, it can always be improved to a darkened image any later time.

Well, a darkened image would need a completely different approach. I doubt that using black is a useful start and I am not sure if we should accept that change given that it goes into the wrong direction implementation-wise.

Sven

Olivier
2004-09-30 13:15:10 UTC (over 19 years ago)

difference between canvas_draw and draw_tool_draw functions

On Thu, Sep 30, 2004 at 01:01:03PM +0200, Sven Neumann wrote:

Hi,

lists@olivier.pk.wau.nl (Olivier) writes:

But black is a useful start, it can always be improved to a darkened image any later time.

Well, a darkened image would need a completely different approach.

true

I doubt that using black is a useful start

not start as in code, but start as in functionality we're talking about a feature request since 2002: http://bugzilla.gnome.org/show_bug.cgi?id=93360

some people indeed prefer darkened, but as long as nobody is working on that, would black be useful instead of darkened? I do think so. It is currently not about the choice between darkened and black, but between nothing and black (unless somebody steps up to implement 'darkened').

and I am not sure if we
should accept that change given that it goes into the wrong direction implementation-wise.

well, please let me know, because if it's not going to be included I better stop...

regards,
Olivier

Sven Neumann
2004-09-30 13:28:46 UTC (over 19 years ago)

difference between canvas_draw anddraw_tool_draw functions

Hi,

"Austin Donnelly" writes:

I'd vote for greying/dimming the image outside the crop area, much like the QuickMask feature turns stuff red. In fact, you could look at the quickmask code to see how that does it.

Austin, you should know that QuickMask is just a shortcut for using a channel and I don't think that using a channel is a good idea here.

Sven

Sven Neumann
2004-09-30 13:34:04 UTC (over 19 years ago)

difference between canvas_draw and draw_tool_draw functions

Hi,

lists@olivier.pk.wau.nl (Olivier) writes:

not start as in code, but start as in functionality we're talking about a feature request since 2002: http://bugzilla.gnome.org/show_bug.cgi?id=93360

Oh, this request is much older. It's been in the early TODOs, so it's probably around for six or seven years.

some people indeed prefer darkened, but as long as nobody is working on that, would black be useful instead of darkened? I do think so. It is currently not about the choice between darkened and black, but between nothing and black (unless somebody steps up to implement 'darkened').

Well, I doubt that black is useful at all and it would certainly look ugly. But I have thought about it more and I think I see a way to implement darkening based on your approach of drawing the outside area in black. So your change would probably be a start regardless of what I said earlier.

In order to undraw the black you've drawn on top of the image display, you will have to expose that area using gimp_display_shell_expose_area().

Sven

Sven Neumann
2004-09-30 14:41:46 UTC (over 19 years ago)

difference between canvas_draw and draw_tool_draw functions

Hi,

lists@olivier.pk.wau.nl (Olivier) writes:

I don't think I can do that on my second day of gimp hacking indeed

I would like to note that you have choosen the by far most tricky part of the GIMP source code to hack on. Even though we have already put some work into this, the tools code is still a mess and hardly anyone understands in full detail how this stuff is put together. The crop tool is even more evil since it has it's own dialog (or worse: an info dialog) and since it draws directly to the canvas.

Just wanted to mention that so you don't get the impression that all of the GIMP code is in such a bad shape.

Sven