Graphic takes on look of image below.

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
windowsLC
Posts: 26
Joined: Sat Dec 16, 2017 5:58 am

Graphic takes on look of image below.

Post by windowsLC » Fri Dec 29, 2017 9:53 pm

this one is killing me because I know there is a great demo stack of this out there but cant find it again. :x

I am placing a regular polygon graphic over an image and I want the polygon to take on the the look of the section of image below it. I cant remember if it was Ink, imagedata or background pattern that was the key do this.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2125
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Graphic takes on look of image below.

Post by richmond62 » Fri Dec 29, 2017 10:25 pm

switch.jpg
Better version available lower down!

Code: Select all

on mouseUp
   if the backGroundPattern of grc "PG" is the id of img "GG" then
      set the backGroundPattern of grc "PG" to the id of img "BB"
      else
         set the backGroundPattern of grc "PG" to the id of img "GG"
         end if
end mouseUp
Last edited by richmond62 on Sat Dec 30, 2017 9:44 am, edited 1 time in total.

Klaus
Posts: 9760
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Graphic takes on look of image below.

Post by Klaus » Fri Dec 29, 2017 10:30 pm

Maybe you mean "backgroundpattern"?

Code: Select all

...
set the BackGroundPattern of grc "your graphic here..." to 1003
## Or what ID your image may have.
...
The image itself does not need to be visible for this.

Klaus
Posts: 9760
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Graphic takes on look of image below.

Post by Klaus » Fri Dec 29, 2017 10:30 pm

I really need to type faster! :D

windowsLC
Posts: 26
Joined: Sat Dec 16, 2017 5:58 am

Re: Graphic takes on look of image below.

Post by windowsLC » Fri Dec 29, 2017 11:35 pm

Yes! backgroundpattern thanks, that is what I was trying to remember.

bogs
Posts: 1161
Joined: Sat Feb 25, 2017 10:45 pm

Re: Graphic takes on look of image below.

Post by bogs » Fri Dec 29, 2017 11:51 pm

Klaus wrote:
Fri Dec 29, 2017 10:30 pm
I really need to type faster! :D
I thought typing speeds were capped by the theory of relativity :twisted:
ImageImage

Klaus
Posts: 9760
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Graphic takes on look of image below.

Post by Klaus » Sat Dec 30, 2017 12:19 am

Sorry, you know how it is, I could tell you, but then I would have to kill you! :twisted:

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2125
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Graphic takes on look of image below.

Post by richmond62 » Sat Dec 30, 2017 10:20 am

Lost control of my own enthusiasm:

Code: Select all

on mouseUp
   if the backGroundPattern of grc "PG" is the id of img "GG" then
      set the polySides of grc "PG" to 5
      set the backGroundPattern of grc "PG" to the id of img "BB"
   else
      set the polySides of grc "PG" to 7
         set the backGroundPattern of grc "PG" to the id of img "GG"
         end if
end mouseUp
https://www.dropbox.com/s/1nnpsxnqy0bmx ... e.zip?dl=0
PolyBlob.jpg

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”