How to know if an image changed

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

How to know if an image changed

Post by jmburnod » Mon Mar 01, 2010 7:00 pm

Hi All,

i need to know if an image changed after using painting tool
I try a way by imagedata but it not work

Code: Select all

on tMemeIMDT pImage
   set the text of img pImage to ""
   set the MonImageData of img pImage to the imagedata of img pImage --•• MonImageData is a custom propertie
   put VerifMemeImagedata(pImage) into Meme --•• return false
end tMemeIMDT

function VerifMemeImagedata pImage
   if the MonImageData of img pImage = the imagedata of img pImage then
      return true
   else
      return false
   end if
end VerifMemeImagedata
Of cours, an other way is welcome

Regards

Jean-Marc
https://alternatic.ch

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

Re: How to know if an image changed

Post by bn » Mon Mar 01, 2010 7:42 pm

Jean-Marc,
jmburnod wrote: set the text of img pImage to ""
if you set the text of an image to "" or empty you clear everything out of the image, the imagedata will be empty
try without "set the text of image ... to ""
than you say

Code: Select all

 set the MonImageData of img pImage to the imagedata of img pImage --•• MonImageData is a custom propertie
   put VerifMemeImagedata(pImage) --into Meme --•• return false
you set the custom property to the imagedata and right afterwards you ask if the customproperty = imagedata. For me it returns always true as it should, it never had a chance to change. Try to do the setting e.g. when you start going into an image/start paint modus. When ending paint modus and you want to know if anything has changed you make the comparison without first setting the custom property to the actual imagedata.
regards
Bernd

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

Re: How to know if an image changed

Post by bn » Mon Mar 01, 2010 9:22 pm

Jean-Marc,
I just tried your script and to my surprise the imagedata in the customproperty was empty, with text of image it worked

Code: Select all

on tMemeIMDT pImage
   set the MonImageData of img pImage to the text of img pImage --•• MonImageData is a custom propertie
end tMemeIMDT

function VerifMemeImagedata pImage
   return the MonImageData of img pImage = the text of img pImage
end VerifMemeImagedata
I call tMemeIMDT on mouseDown and VerifMemeImagedata with

Code: Select all

put VerifMemeImagedata("nameOfMyImage") into Meme
when I exit the painting routine. That works as expected
regards
Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: How to know if an image changed

Post by jmburnod » Mon Mar 01, 2010 9:50 pm

Yes Bernd,

"text" instead "Imagedata" and the function work

Code: Select all

function VerifMemeImagedata pImage
   return the MonImageData of img pImage = the text of img pImage
end VerifMemeImagedata
It work also after creating a new image empty by set the text of img pImage to ""
That is what i need now (for the painting palette without mousedown)

Thank one more.
I hope i can help you one time

Guten Abend

Jean-Marc
https://alternatic.ch

Post Reply