Page 1 of 1

Merging Graphics?

Posted: Fri Sep 12, 2014 6:01 pm
by Jellobus
Hi,

I have graphics in the stack but how can I merge them and make them in one single graphic? :roll:

Thanks in advance!

Louis

Re: Merging Graphics?

Posted: Fri Sep 12, 2014 8:05 pm
by magice
I have done this in the past by aligning the images in a group, and using "export snapshot from group".

Re: Merging Graphics?

Posted: Fri Sep 12, 2014 9:03 pm
by bn
Hi Louis,

do you want to merge graphics or images into one?

Graphics in Livecode are made of points that are connected by a line.

Images are made of pixels and of type jpg or png for example.
If you want to merge images into one then I would do what magice proposes.

Kind regards

Bernd

Re: Merging Graphics?

Posted: Fri Sep 12, 2014 9:46 pm
by Simon
Hi Bernd,
You got me thinking about image blending and my brain ran off on px by px interleaving...
Then I just set the blend level of the top image :)
I think it works.

Simon

Re: Merging Graphics?

Posted: Fri Sep 12, 2014 10:01 pm
by Jellobus
Hi Bernd,

I want merge multiple Graphics into one but not image... any tricks?

Cheer,

Louis

Re: Merging Graphics?

Posted: Fri Sep 12, 2014 10:02 pm
by bn
Hi Simon,


I did the blending here but it is awfully complicated.

http://forums.livecode.com/viewtopic.ph ... +watermark

Your idea of setting the blendlevel is exactly what does the job and you can even take snapshots of that combo.

[OT]
did you have time to look at the scrolling thingie?
would love to get some feedback off-list.
[/OT]

Kind regards
Bernd

Re: Merging Graphics?

Posted: Fri Sep 12, 2014 10:12 pm
by bn
Hi Louis,

if you want to combine multiple polygon graphics you can just take the points of each of the graphics and set the points of a polygon graphic to those points BUT between the points of the individual graphic leave an empty line.

something like this assuming you have 2 graphics made of points and you create a third graphic

set the points of graphic "thirdGraphic" to the points of graphic "firstGraphic"
put cr after the points of graphic "thirdGraphic"
put the points of graphic "secondGraphic" after the points of graphic "thirdGraphic"

this only works with graphics made up of points. Oval rectangle and round rectangle aren not made up of points and you can not use this technique. Polygon and freehand and line are made of points.
As of LC 6.7 you have the effective points of graphics that are not made from points, so that could be a solution for those.

Kind regards

Bernd

Re: Merging Graphics?

Posted: Fri Sep 12, 2014 10:31 pm
by bn
Hi Louis,

here is some real code instead of the pseudocode from above

assuming your graphic 1 is called "g1" and the second "g2"

Code: Select all

on mouseUp
   set the style of the templateGraphic to polygon
   create graphic "g3"
   set the points of graphic "g3" to the points of graphic "g1" & cr & cr & the points of graphic "g2"
end mouseUp
at first you will not notice the new graphic since its points are the same as the two separate graphics. Just select the graphic and move it around.

Kind regards
Bernd

Re: Merging Graphics?

Posted: Thu Sep 18, 2014 5:39 am
by Jellobus
Hi Bernd,

Thanks for your advice. Your code perfectly works fine.

Cheers,

Louis