Rev Crash Again! ... cardImage() function

Wouter wouter.abraham at pi.be
Fri Jan 9 16:49:52 EST 2004


  This thread should now be called : No rev crash again and metacard 
neither,
or something :^))

On 09 Jan 2004, at 22:04, use-revolution-request at lists.runrev.com wrote:

>
> Message: 10
> Date: Fri, 9 Jan 2004 13:03:35 -0800 (PST)
> From: Alejandro Tejada <capellan2000 at yahoo.com>
> Subject: Re: Rev Crash Again!  ... cardImage() function
> To: use-revolution at lists.runrev.com
> Message-ID: <20040109210335.30630.qmail at web40506.mail.yahoo.com>
> Content-Type: text/plain; charset=us-ascii
>
>

snip



> How did you call this function?
>
> I wrote in the message box the following
>
> get cardImage(Home)
> put it
>
> and the result is the binary PNG data in
> the message box and a temporal image that
> dissapears when I click on it.
>
> al



Ok here is an example  based on the idea of
Jim  to make thumbnails. But this are not real thumbnails,
only resized images. To make a real thumbnail take a screenshot
(import or export can both be used) from the produced image.

1.  make list field named "list"
2.  a btn to put the windows in fld "list"

3. a second btn with the following script:

on mouseup
   put line (the hilitedline of fld "list") of fld "list" into sname
   if sname is not in the windows then
     answer "First update the window list"
     exit to top
   end if
   if sname is not empty then put cardImage(sname) into a
   if there is not an img "test" then
     create invisible img
     set the name of last img to "test"
   end if
   if there is an img "test" then set the text of img "test" to a
   put the width of img "test" into x
   put the height of img "test" into y
### if a resizing is wanted you can do this for example
### adapt to your own needs
   if x > y then put x div 100 into theFactor
   else put y div 100 into theFactor
   if theFactor > 0 then
     set the width of img "test" to x div theFactor
     set the height of img "test" to y div theFactor
   end if
   show img "test"
   choose browse tool
end mouseup

#### = changed
function cardImage theStack ####
   local tCurrentCardImage, tOldBuffer, tID
   put the alwaysBuffer of stack theStack into tOldBuffer
   put the cantmodify of stack theStack into tCMOldBuffer  ####
   set the cantmodify of  stack theStack to false   ####
   set the alwaysBuffer of  stack theStack to false
   set the alwaysBuffer of stack theStack to true
   put the windowID of stack theStack into wID
   put the pixMapID of  stack theStack into pID
   if not ((pID is wID) or (pID is 0)) then
     create invisible image
     --put the imagePixMapID of last image into tID ### you can safely 
omit this line
     set the imagePixMapID of last image to (the pixMapID of stack 
theStack)
     export last image to tCurrentCardImage as PNG
     --set the imagePixMapID of last image to tID  ### you can safely 
omit this line
     set the alwaysBuffer of  stack theStack to false
     set the cantmodify of stack theStack to tCMOldBuffer  ####
     delete last image
   else  #### add your own error text here
     answer "Sorry no deal, no picture data could be taken"
     exit to metacard
   end if
   return tCurrentCardImage
end cardImage

Have fun

WA.



More information about the use-livecode mailing list