Merging Graphics?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Merging Graphics?

Post by Jellobus » Fri Sep 12, 2014 6:01 pm

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

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Merging Graphics?

Post by magice » Fri Sep 12, 2014 8:05 pm

I have done this in the past by aligning the images in a group, and using "export snapshot from group".

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Merging Graphics?

Post by bn » Fri Sep 12, 2014 9:03 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Merging Graphics?

Post by Simon » Fri Sep 12, 2014 9:46 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: Merging Graphics?

Post by Jellobus » Fri Sep 12, 2014 10:01 pm

Hi Bernd,

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

Cheer,

Louis

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Merging Graphics?

Post by bn » Fri Sep 12, 2014 10:02 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Merging Graphics?

Post by bn » Fri Sep 12, 2014 10:12 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Merging Graphics?

Post by bn » Fri Sep 12, 2014 10:31 pm

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

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: Merging Graphics?

Post by Jellobus » Thu Sep 18, 2014 5:39 am

Hi Bernd,

Thanks for your advice. Your code perfectly works fine.

Cheers,

Louis

Post Reply