Converting a PicHandle to format for use with imageData

Trevor DeVore lists at mangomultimedia.com
Tue Dec 30 12:51:10 CST 2003


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



More information about the use-livecode mailing list