PixmapID still not workng?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
PixmapID still not workng?
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
Any other ways to grab the entire bitmap of a stack even when obscured or offscreen?
thanks
- TJ
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
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
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
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
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
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
Hey Malte.. long time no chat!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
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.
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Try the "from <obj>" option instead of "from <rect>":
http://revjournal.com/blog.irv?pid=1253632044.696527
http://revjournal.com/blog.irv?pid=1253632044.696527
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
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
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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Only if you call 10 seconds to save a file "slow"Mark wrote: OP already tried this and said this is very slow.
Best,
Mark

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.
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.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.
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
