How to test 2 objets are the same color,No Mousecolour Func

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

How to test 2 objets are the same color,No Mousecolour Func

Post by Fasasoftware » Fri Jul 03, 2015 11:51 am

Hi to everybody,

I need to test 2 objects if they are the same colour in a specified location, without using a Mousecolour Function...because block my app functionality.

In other words, i have an rectagle object with different colour inside and with another little rectangle for example black , each up on each its, if the 2 object are the same colour in the same location of my window app then beep.

I have seen the function Itersect don't do this.

Is there's a manner to do this???

I thank you so much!

Lestroso :oops:

www.fasasoftware.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: How to test 2 objets are the same color,No Mousecolour F

Post by dunbarx » Fri Jul 03, 2015 10:17 pm

Hi.

Perhaps I am misunderstanding, but what happens if you compare the backColors of each of those two objects? In other words, if your problem was to determine if the two were aligned vertically, you might compare their "lefts". So is there a color property that fits the bill?

Craig Newman

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

Re: How to test 2 objets are the same color,No Mousecolour F

Post by Fasasoftware » Fri Jul 03, 2015 11:04 pm

Hy dunbarks,


well i would like a function , or a script, to retrieve like the same "MOUSECOLOR" instruction but not that, because every second, i want to test in a certain image, in a specified location, what colors there is...

i have tryed to do this...it works but it the wrong way and not right for my problem.

Code: Select all

global test1
global test2

on mouseUp
 
   get the effective backgroundColor of graphic "white"
   put it into test1
   get the effective backgroundColor of graphic "red"
   put it into test2
   
   if test1 =  test2   then answer "They are The Same Colors!!"
    if test1 <>  test2   then answer "Sorry They are NOT The Same Colors!!"
end mouseUp

You should create yourself 2 graphics in the same colors and different colors to test this script..
But i need to test the color in a certain point inside of a image,without mouse color...

I seen the intersect function, but do not test the color of 2 objects...

Can you help me please???

Thanks a lot,

Lestroso :oops:

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

Re: How to test 2 objets are the same color,No Mousecolour F

Post by Fasasoftware » Sat Jul 04, 2015 2:00 pm

Hi To EveryBody,
searching on the forum, i found a very useful script by "Bernd", this boy i think live on the moon, his script is perfect for me!!!Solved in full My Problem!!!

I attached the link below, where there's also the script to download made by Bernd...

Thanks a lot to everybody!!!

Lestroso :D

http://forums.livecode.com/viewtopic.php?f=7&t=7398

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: How to test 2 objets are the same color,No Mousecolour F

Post by dunbarx » Mon Jul 06, 2015 10:57 pm

Hi.

If you have a solution, you probably do not need to investigate further. But I still do not exactly know what you wanted. If you have a colored object, and this does not work for you:

Code: Select all

on mouseUp
   answer  mouseColor()
end mouseUp
Is it that you want to specify a location (or two), and find the colors at that point?

Code: Select all

on mouseUp
   ask "Where to test?" --assume you have x,y properly formatted with two integers
   set the screenMouseLoc to item 1 of the rect of this stack + item 1 of it & "," & item 2 of the rect of this stack + item 2 of it
   answer mouseColor()
end mouseUp
You can do this with two objects and compare, of course. But is this what you were asking for?

Craig

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

Re: How to test 2 objets are the same color,No Mousecolour F

Post by Fasasoftware » Tue Jul 07, 2015 1:45 pm

Hi Craig,

Thanks for your answer , but i cannot use the mousecolor function, because block my software.

Now i'm using the script of bernt, that use a snapshot to retrieve a color in a certain position, very useful.

Thanks again a lot,

Lestroso :D

Post Reply