After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 342548 - gimp_drawable_transform_scale_default behavior is not to spec
gimp_drawable_transform_scale_default behavior is not to spec
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: libgimp
2.2.x
Other All
: High normal
: 2.2
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-05-22 06:39 UTC by Leeksoup
Modified: 2008-01-15 13:08 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
test script to show behavior of gimp_drawable_transform_scale_default (698 bytes, text/plain)
2006-05-22 22:18 UTC, Leeksoup
Details

Description Leeksoup 2006-05-22 06:39:21 UTC
Please describe the problem:
When using gimp_drawable_transform_scale_default to scale an object, the
parameters specify that the "new" i.e. target top-left and bottom-right x,y
coordinate pairs should be entered. However, the actual behavior is to scale to
the right size but the location is mysterious. If only scaling is the intended
behavior, then the function should simply take the new width & height, and not
ask for coordinates. As it is, the behavior is highly non-intuitive.

Steps to reproduce:
working from script-fu
1. create a simple object (say a rectangle):
(gimp-rect-select inImage 100 100 50 50 2 FALSE 0)
(gimp-edit-bucket-fill inLayer 0 NORMAL 100 0 0 0 0)
2. float selection
(set! floating-selection (car (gimp-selection-float inLayer 0 0)))
3. (gimp_drawable_transform_scale_default floating-selection 0 0 20 20 TRUE FALSE)


Actual results:
the selection is scaled but is moved not to the given coords but to ~ (40,40)
topleft and (60,60) bottomright

Expected results:
the selection should be scaled AND move to the location specified by the x,y
coord pairs given in the parameters, i.e. (0,0) topleft and (20,20) bottomright

Does this happen every time?
yes

Other information:
I thought I could work around this by using gimp-selection-translate, but it is
not clear to me how much to offset. Help?
Comment 1 Sven Neumann 2006-05-22 12:01:40 UTC
Could you perhaps attach a small example image and a script that shows the problem?
Comment 2 saulgoode 2006-05-22 21:56:13 UTC
The location is not so mysterious: it is the original offsets of the drawable (relative to the image) scaled by the same amount as the drawable itself. 

You could correct for this by using "gimp-drawable-offset" after scaling but I would agree that the behavior is peculiar and should be investigated further.
Comment 3 Leeksoup 2006-05-22 22:18:05 UTC
Created attachment 66023 [details]
test script to show behavior of gimp_drawable_transform_scale_default

This small script creates a rectangle, then floats and scales it.
Comment 4 Leeksoup 2006-05-23 05:55:44 UTC
re saulgoode's comment: Thanks. Yes, I see that now. I was looking for some correlation to the coordintes entered as parameters. If this is the intended behavior and/or if it will be too hard to fix, then the procedure interface should be changed to reflect that.
Comment 5 Michael Natterer 2006-05-23 08:43:38 UTC
This is indeed totally broken, all of the transform PDB wrappers
don't care about the layer offset and produce wrong results
if the layer is not at 0,0.

This is so broken, it will be fixed in 2.2 too, even if it
changes behavior of some scripts.
Comment 6 Michael Natterer 2006-05-23 11:13:22 UTC
Fixed in both branches:

2006-05-23  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/drawable_transform.pdb
	* tools/pdbgen/pdb/transform_tools.pdb: add the drawable's offset
	to the x and y returned by gimp_drawable_mask_intersect() because
	all transform functions expect image coordinates.
	Fixes bug #342548.

	* app/pdb/drawable_transform_cmds.c
	* app/pdb/transform_tools_cmds.c: regenerated.
Comment 7 Leeksoup 2006-05-23 15:56:00 UTC
Wow, that was quick! I have never had a bug resolved so quickly in a commercial product. When / in what version will I be able to get the fix?
Thank you!!
Comment 8 Michael Natterer 2006-05-23 19:08:44 UTC
You're welcome :)
The fix will be in 2.2.11 (stable) and 2.3.9 (unstable).
Comment 9 Michael Natterer 2006-05-23 19:09:07 UTC
Um, in 2.2.12 of course.
Comment 10 Leeksoup 2006-05-23 22:32:44 UTC
Re comment #2: Workaround is to do "gimp-layer-set-offsets" after scaling. gimp-drawable-offset does not give the desired result.