Page 1 of 2
PixmapID still not workng?
Posted: Fri Oct 02, 2009 6:19 pm
by tjframe
The docs say that its not supported in 2.7.. but I'm running 3.5 and it's still returning a 0. This has broken an old stack I wanted to update as well as put a damper on my plans for some new stuff.
Any other ways to grab the entire bitmap of a stack even when obscured or offscreen?
thanks
- TJ
Posted: Fri Oct 02, 2009 7:32 pm
by Mark
Dear tjframe,
Use the export from rect command.
Best,
Mark
Posted: Fri Oct 02, 2009 8:00 pm
by tjframe
That doesn't work - the command does exports a rect larger than the window size but it clips everything to black not currently showing.
I need to access the entire card even the clipped portions.
For example this used to work:
set the imagepixmapID of image miniView to the pixmapID of this stack
..thus giving me a smaller image of the entire card surface. Is there no longer a way to do this in rev?
- TJ
Posted: Fri Oct 02, 2009 8:21 pm
by Mark
Dear tjframe,
This works for me:
export snapshot from fld 1 to file "~/desktop/test.png" as PNG
Best,
Mark
Posted: Fri Oct 02, 2009 9:19 pm
by tjframe
Mark,
No that simply gives you an image of that field.. I need the entire card image.
Try this:
- create a stack that is 1500 by 1500
-put an image on it in the lower right corner
-now resize the stack to 400 by 400
No version of export snapshot that I can come up witth gives you a file that contains the entire card including the image. It only captures the current stack rect.
That's what was so powerful about the pixmapID function since it gave you everything, visible or not. Also export snapshot doesn't give me what pixmapID did because it exports the image to a file. I don't want a file, I want to dump the bitmap data it into an existing image (as you usually do with imagedata, but there is no "imagedata" for an entire full card surface)
- TJ
Posted: Fri Oct 02, 2009 9:35 pm
by Mark
Of course it gives just the image of the field! Try a group.
Best,
Mark
Posted: Fri Oct 02, 2009 10:06 pm
by malte
Hi TJ,
this appears to work:
on mouseUp pMouseBtnNo
local tVar
export snapshot from rect (the rect of this cd) of this cd to tVar as png
put tVar into img 1
end mouseUp
Cheers,
Malte
Posted: Fri Oct 02, 2009 10:07 pm
by tjframe
Ok technically that does work except that I just tried it out with stack of a bunch of controls all grouped into 1 group and had these problems:
The background area around the controls renders black (which is not a big deal since I guess you could use a large white grc as a backdrop)
But the real problem is that it takes 10+ seconds to export with either .jpg or .pmg! This is broken because rather than simply provide the bitmap from the offscreen buffer to the snapshot, it seems like its re-creating the controls internally and then exporting them
Oh well... also this doesn't give me back the functionality I had pre 2.7 since I could instantly transfer the window buffer to an image without creating a file. bummer
Many thanks for your help though!
- TJ
Posted: Fri Oct 02, 2009 10:20 pm
by Mark
10 seconds? Maybe that's another bug ;-)
Mark
Posted: Fri Oct 02, 2009 10:55 pm
by tjframe
malte wrote:Hi TJ,
this appears to work:
on mouseUp pMouseBtnNo
local tVar
export snapshot from rect (the rect of this cd) of this cd to tVar as png
put tVar into img 1
end mouseUp
Cheers,
Malte
Hey Malte.. long time no chat!
Sorry but that just gives you the CURRENT card size, not the full offscreen buffer.
I guess Pixmap ID was the only way to access that full data (back when it worked!)
Hey did you ever finish your tile animation engine? The reason I ask is that recently I've been working on an image manipulation stack that sort of functions like a giant icon editor but for knitting (its for my wife). Anyway I've been dealing with the speed issues surrounding setting the icons of up to 10,000 buttons quickly since the "editing" area of my app is a grid of 100X100 images (used to be btns before I switched)
What I discovered is that by using images instead of buttons and using
set the imagepixmapID command I can swap out the entire array 10 times faster than setting the icons or setting imagedata (ie. 25 ticks vs 215 ticks). Of course the imagepixmapID is volatile and needs to be initialized whenever you load the stack.. but still, 10 times faster is a huge improvement.
Posted: Sat Oct 03, 2009 5:57 am
by FourthWorld
Try the "from <obj>" option instead of "from <rect>":
http://revjournal.com/blog.irv?pid=1253632044.696527
Posted: Sat Oct 03, 2009 9:07 am
by Mark
Yes, Richard, you're right, also see my example, which I posted earlier:
export snapshot from fld 1 to file "~/desktop/test.png" as PNG
and use group instead of field:
export snapshot from grp 1 to file "~/desktop/test.png" as PNG
but, if I understand him correctly, OP already tried this and said this is very slow.
Best,
Mark
Posted: Sat Oct 03, 2009 9:22 pm
by tjframe
Mark wrote: OP already tried this and said this is very slow.
Best,
Mark
Only if you call 10 seconds to save a file "slow"

Not sure what the problem is since have an 8 core machine with 16 gigs of RAM. The card sized group in my test was just a normal sized card with 20 or so controls on it offscreen.
Sigh.. I have bigger problems at the moment though.. imagepixmapID which "does" seem to be working seems flaky and is giving me an empty result sometimes and a valid pointer others. Have no idea why. I've resorted to a loop on startup to ensure that the imagepixmapIDs I request for from permanent, already existing images is delivered. yuck. Sometimes it never gives me a result at all.. so I'll quit the app and restart and it will work again. argh.
I know everyone always wants new features and like internet goodness, but personally I'd prefer some of Rev's weird idiosyncratic stuff to be fixed first. Like why do my images random appear and dissapear on cards (not buttons or fields or grcs.. just images) They are just sourced to normal 12X12pxl pngs.. its not like I'm asking for that much.
Posted: Sun Oct 04, 2009 12:07 am
by mwieder
You're trying to *set* the imagepixmapid? That's supposed to be a read-only property...
anyway, I think something else is going on with your stack. I regularly export snapshots of cards and even of the entire screen area in a fraction of a second.
Posted: Sun Oct 04, 2009 1:14 am
by tjframe
mwieder wrote:You're trying to *set* the imagepixmapid? That's supposed to be a read-only property...
anyway, I think something else is going on with your stack. I regularly export snapshots of cards and even of the entire screen area in a fraction of a second.
Yep.. busted! (sheepish grin) It does work, just not reliably. I guess trying to get the extra speed is not worth it since I can't get it work 100 percent of the time. Going to scrap that approach. This whole pixmapID stuff was cool trick I discovered on the Sons of Thunder Tips and Tricks page but a lot of those are years old and perhaps not as applicable anymore.
The Rev gods must be smiling upon me today because I went back to the export grp thing and created another new stack to see if I could figure out whats wrong and this time it worked normally (38 ticks for a 14kb file).
Anyway thanks for the help to everyone who contributed
