Re: [Gimp-developer] copy-paste-anchor shifting my position

2002-09-05 Thread Simon Budig

Roland Roberts ([EMAIL PROTECTED]) wrote:
 I'm trying to copy a layer from one image to another.  Below is a
 fragment of the code to do this; new-image has already been created
 with the same base type as the old-image.
 
[...]
 (gimp-selection-all old-image)
 (gimp-edit-copy old-layer)

It *might* (just tested with the GUI) be a better idea to use
(gimp-selection-none old-image), since  If there is no selection, then
the specified drawable's contents will be stored in the internal GIMP
edit buffer and gimp does not try to optimize the amount that gets
stored in the buffer.

 (gimp-floating-sel-anchor (car (gimp-edit-paste new-layer 1)))
 (apply gimp-layer-set-offsets (append (list new-layer)
   (gimp-drawable-offsets old-layer)))

Also you might want to use gimp-floating-sel-to-layer and use 
(gimp-layer-set-offsets ..) on this newly created layer. So you can
avoid weird placement effects if the floating selection is smaller or
bigger than the target layer.

However, it is an annoyance that gimp-layer-copy restricts the usage of
the result to the originating image. This is weird, since the GUI can
handle drag'n'drop of layers to other images quite fine.

Bye,
Simon

-- 
  [EMAIL PROTECTED]   http://www.home.unix-ag.org/simon/
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



Re: [Gimp-developer] copy-paste-anchor shifting my position

2002-09-05 Thread Roland Roberts

 Simon == Simon Budig [EMAIL PROTECTED] writes:

Simon Roland Roberts ([EMAIL PROTECTED]) wrote:
 I'm trying to copy a layer from one image to another.  Below is a
 fragment of the code to do this; new-image has already been created
 with the same base type as the old-image.
 
Simon [...]
 (gimp-selection-all old-image)
 (gimp-edit-copy old-layer)

Simon It *might* (just tested with the GUI) be a better idea to
Simon use (gimp-selection-none old-image),  [...]

Thanks for this suggestion.  It turns out that using
gimp-selection-none on both the old and new images gets things pasted
into the right locations.

Simon Also you might want to use gimp-floating-sel-to-layer and
Simon use (gimp-layer-set-offsets ..) on this newly created
Simon layer. [...]

Naively using this results in twice as many layers as what I started
with.  And gimp-floating-sel-to-layer is documented to return nothing,
so I'm not sure how I am supposed to find the newly created layer.
Maybe I should have used gimp-selection-float to create the layer?

In any event, just removing the selection from both images results in
an exact copy.

Simon However, it is an annoyance that gimp-layer-copy restricts
Simon the usage of the result to the originating image. [...]

I agree...I first thought that was exactly what I wanted until I read
the comments to realize I could only copy within an image.

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer