Converting a PicHandle to format for use with imageData
thierry.arbellot at wanadoo.fr
Mon Dec 29 17:29:07 EST 2003
I have written an external to drive a video grabber, and copy the
bitmap into the imageData of an image object.
the GWorld must be 32 bit pixel depth and with the same resolution as
the image in Rev
*(GetPortPixMap(GWorld)) return a pointer to the PixMap
in the PixMap structure, baseAddr is a pointer to the bitmap, that can
be copied into the imageData of the image object in Rev.
Before manipulating the bitmap, even just for copy, it's needed to lock
and to unlock it after use
So, the code should look like this:
trackFrame.top = 0;
trackFrame.left = 0;
trackFrame.right = 320; // if image is 320*240
trackFrame.bottom = 240;
// here put your code to get the image from the movie and put it into
thePixMap = *(GetPortPixMap(theGWorld));
rdata.sptr = thePixMap->baseAddr;
rdata.length = 320*240*4;
set the imageData of image "theImage" to theImageData
I have not tested this code, I hope there is no mistake.
On Monday, Dec 29, 2003, at 20:30 Europe/Paris, Trevor DeVore wrote:
> On Dec 29, 2003, at 11:59 AM, Thierry Arbellot wrote:
>> Hi Trevor,
>> Apple gives a sample code on how to get a video frame from a QT movie
>> and draw it into a GWorld.
>> Then you can copy the PixMap of this GWorld directly into the
>> imageData of an image object.
> Thanks for the info. This is fairly new territory for me so I'm not
> quite sure how you would copy the PixMap of the GWorld to the
> imageData of the image object. Would I assign the bitmap returned
> from GetPortBitMapForCopyBits(gSrcGWorld) to the imageData of the
> image object?
> Trevor DeVore
> Blue Mango Multimedia
> trevor at mangomultimedia.com
> use-revolution mailing list
> use-revolution at lists.runrev.com
More information about the Use-livecode