On 09 Jan 2004, at 13:00, [EMAIL PROTECTED] wrote:


Message: 5
Date: Fri, 9 Jan 2004 00:12:41 -0700
From: Dar Scott <[EMAIL PROTECTED]>
Subject: Re: Rev Crash Again!  ... cardImage() function
To: How to use Revolution <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed


On Wednesday, January 7, 2004, at 10:00 PM, Dar Scott wrote:


Here is my function:

Here is a revision that handles the unusual case of the stack in defaultFolder not being open or otherwise not containing a valid value.

-- Returns an image (PNG) of current card even if obscured
-- or off screen. In addition this works when
-- lock screen is on, allowing PNGs of other cards to be obtained.
-- This is based on code by Ken Ray and Brian Yennie.
function cardImage
local tCurrentCardImage, tOldBuffer, tID
put the alwaysBuffer of this stack into tOldBuffer
set the alwaysBuffer of this stack to false
set the alwaysBuffer of this stack to true
put the windowID of this stack into wID
put the pixMapID of this stack into pID
if not ((pID is wID) or (pID is 0)) then
create invisible image
put the imagePixMapID of last image into tID
set the imagePixMapID of last image to (the pixMapID of this stack)
export last image to tCurrentCardImage as PNG
set the imagePixMapID of last image to tID
set the alwaysBuffer of this stack to tOldBuffer
delete last image
end if
return tCurrentCardImage
end cardImage


If one tries making a variation of this that is more like imag007, then
the stack should be checked to be among the lines of openStacks().  If
this function is used as is to look at other stacks, then care must be
made in setting the default stack and openStacks() can be checked then,
too.

In tinkering with this, one might ask whether the temporary image
should be in the stack getting its portrait or in some utility stack.
I suspect "create invisible image" will put it on this card, the one
getting its picture taken.  Is that good or bad?

Dar Scott

Here is a little change on that:


#### = 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
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
set the alwaysBuffer of stack theStack to false
set the cantmodify of stack theStack to tCMOldBuffer ####
delete last image
end if
return tCurrentCardImage
end cardImage



Greetings,


WA

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to