Pixels from QT 
Author Message
 Pixels from QT

I'm still having trouble with this. I do the following to open a DV sized QT

At sm=f.OpenEditableMovie everything seems fine but examination shows the
graphics property of the picture property is nil, even after the
q.findfirstsample, so when I get to whatever=sm.picture.graphics.pixel(i,j)
I get an unhandled nil pointer.

I'm mind-locked after two nights with this and all the documentation and
examples I can find. I'm ready to go Codewarrior and a QT plug-in at this

dim f as folderItem
dim i,j as integer
dim pA as picture
dim sm as editablemovie
dim q as qttrack
dim pix as color

if f <> nil then
for j = 1 to 480 step 2
for i= 0 to 720
canvas1.graphics.pixel(i,j) = sm.picture.graphics.pixel(i,j)


for j = 0 to 480 step 2
for i= 0 to 720

Mon, 08 Jul 2002 03:00:00 GMT  
 Pixels from QT

Here is some code for you in 3 easy steps. :-)


*** 1st:  Create a window containing a canvas and a property "PictureOut
as Picture"

*** 2nd: Put this code in the window's open event handler:

dim theFile as folderItem
dim i,x,y,MovieWidth, MovieHeight  as integer
dim ReferencePicture as picture
dim theEditableMovie as editablemovie
dim theTrack as qttrack

//user picks a quicktime file
theFile = GetOpenFolderItem("video/quicktime")

if theFile <> nil then
//create an EditableMovie from the Quicktime File
theEditableMovie= theFile.OpenEditableMovie
MovieWidth = theEditableMovie.Picture.width
MovieHeight = theEditableMovie.Picture.height

//resize the window and canvas
width = MovieWidth+20
height = MovieHeight+20
canvas1.width = MovieWidth
canvas1.height = MovieHeight

//create a copy of the editable movie's video track
//note: the video track is not necessarily track 1!
for i = 1 to theEditableMovie.TrackCount
if theTrack.MediaType = "vide" then
end if

//create pictures for output & processing the size of the Editable Movie

//Find the first frame of the video track

//create a picture of the current frame for reference
ReferencePicture.graphics.drawpicture theEditableMovie.picture,0,0

//show the window so we can watch the processing

for y= 1 to MovieHeight step 2
for x= 0 to MovieWidth
//change the canvas so the image processing is visible
canvas1.graphics.pixel(x,y) = ReferencePicture.graphics.pixel(x,y)
//image processing to create PictureOut
PictureOut.graphics.pixel(x,y) = ReferencePicture.graphics.pixel(x,y)

end if

*** 3rd:  put this code in the window's MouseDown handler code:

canvas1.graphics.drawpicture PictureOut,0,0

*****  To try out the code:
- run the project
- pick a quicktime movie file
- you'll see the image processing happen, then the window will go blank
- click on the window to view the result of the processing (now stored
in PictureOut)

I had a lot of fun working on your code and learned a lot myself.  I
Hope this is useful to you!  :-)

- Aaron

Aaron Melgares, Junior Programmer
AppleScript, Frontier, FoxPro, FileMaker Pro, MacOS Toolbox in C, and REALBasic

Fri, 12 Jul 2002 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Qt/Tcl, Qt-Tcl, Qt Tcl

2. Win32 ASM programming of Sound and Painting to screen Pixel by pixel

3. Win32 ASM programming of Sound and Painting to screen Pixel by pixel

4. Direct pixel-by-pixel drawing (with Tk)

5. ExternalInterface and qT (GTK)

6. QT movie with mask

7. quality of scalize in RB/QT very dirty ...

8. QT instance variable can't be modified

9. how to get QT version on win32?

10. Edit window with qt

11. Saving a QT 4.0 stream?

12. Need to Declare a QuickTime function on Win, but dunno which's Win QT DLL


Powered by phpBB® Forum Software