Converting a PicHandle to format for use with imageData

Thierry Arbellot thierry.arbellot at wanadoo.fr
Tue Dec 30 14:24:31 CST 2003


Looks like the image in Rev doesn't have the same width and height as 
the grabbed picture.
If it's the case, adjust the width and height before putting the 
picture into the imageData

Hope it helps.

Thierry.

On Tuesday, Dec 30, 2003, at 19:51 Europe/Paris, Trevor DeVore wrote:

> On Dec 29, 2003, at 3:29 PM, Thierry Arbellot wrote:
>> So, the code should look like this:
>
> Okay, I've implemented your code example and am able to get a picture 
> into an image object in Revolution.  The pictures I grab from stills 
> or movies don't look right however.  You can see what the image should 
> look like here 
> <http://www.mangomultimedia.com/developer/revolution/good_image.jpg> 
> and what the image I am getting in Revolution looks like here 
> <http://www.mangomultimedia.com/developer/revolution/bad_image.jpg>.
>
> I have tried various methods of putting an image into the GWorld 
> (going to a certain time in the movie and putting that into the GWorld 
> as well as using the QT API call GetMoviePict/GetMoviePosterPic) with 
> the same result.
>
> Any ideas on what might be happening?
>
>
> Here is the code:
>
> // Get movie dimensions and create offscreen GWorld
> GetMovieBox(mv, &movieFrame);
> NewGWorld(&theGWorld, k32ARGBPixelFormat, &movieFrame, NULL, NULL, 
> (GWorldFlags)0);
>
> SetGWorld(theGWorld, NULL);
>
> // get image from movie and put into GWorld
> thePicHandle = GetMoviePosterPict (mv);
> EraseRect(&movieFrame);
> DrawPicture(thePicHandle, &movieFrame);
>
> LockPixels(GetPortPixMap(theGWorld));
> thePixMap = *(GetPortPixMap(theGWorld));
>
> if (thePixMap->baseAddr != NULL) {
> 	rdata.sptr = thePixMap->baseAddr;
> 	rdata.length = movieFrame.right * movieFrame.bottom * 4;
> 	
> 	SetVariableEx(args[0], "", &rdata, &retvalue);
> 	
> 	retstr = (char *)malloc(8);
> 	sprintf(retstr, "%s", "Success");
> } else {
> 	retstr = (char *)malloc(8);
> 	sprintf(retstr, "%s", "Failure");
> }
>
> UnlockPixels(GetPortPixMap(theGWorld));
> DisposeGWorld(theGWorld);
> DisposeHandle((Handle)thePicHandle);
> CloseMovieFile(refnum);
> DisposeMovie(mv);
>
> -- 
> Trevor DeVore
> Blue Mango Multimedia
> trevor at mangomultimedia.com
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list