The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MyQuickDrawView.h File Reference

#import <Cocoa/Cocoa.h>
#import <QuickTime/QuickTime.h>
#import "FindFacesInGWorld.h"

Include dependency graph for MyQuickDrawView.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Classes

class  MyQuickDrawView

Functions

pascal OSErr mySGDataProc (SGChannel c, Ptr p, long len, long *offset, long chRefCon, TimeValue time, short writeType, long refCon)
void saveQDViewObjectForCallback (void *theObject)


Function Documentation

pascal OSErr mySGDataProc SGChannel  c,
Ptr  p,
long  len,
long *  offset,
long  chRefCon,
TimeValue  time,
short  writeType,
long  refCon
 

Definition at line 523 of file MyQuickDrawView.mm.

References BailErr, MyQuickDrawView::boundsRect, decomSeq(), MyQuickDrawView::FindFaces, gLastFps, gLastTime, gTimeScale, MyQuickDrawView::gworld, gworld(), myQDViewObject, p, sgChanVideo(), and sprintf().

Referenced by doSeqGrab:().

00531 {
00532 #pragma unused(offset,chRefCon,time,writeType)
00533     
00534     CodecFlags          ignore;
00535     ComponentResult     err = noErr;
00536     CGrafPtr            theSavedPort;
00537     GDHandle            theSavedDevice;
00538     char                status[64];
00539     Str255              theString;
00540     Rect                bounds;
00541     float               fps;
00542     
00543     /* grab the time scale for use with our fps calculations - but this 
00544         needs to be done only once */
00545     if (gTimeScale == 0)
00546     {        
00547         err = SGGetChannelTimeScale([myQDViewObject sgChanVideo], &gTimeScale);
00548         BailErr(err);
00549     }
00550     
00551     if([myQDViewObject gworld]) 
00552     {
00553         // decompress a frame into the GWorld - can queue a frame for async decompression when passed in a completion proc
00554         // once the image is in the GWorld it can be manipulated at will
00555         err = DecompressSequenceFrameS([myQDViewObject decomSeq],       // sequence ID returned by DecompressSequenceBegin
00556                                                                         p,                                              // pointer to compressed image data
00557                                                                         len,                                    // size of the buffer
00558                                                                         0,                                              // in flags
00559                                                                         &ignore,                                // out flags
00560                                                                         NULL);                                  // async completion proc
00561         BailErr(err);
00562 
00563         // ******  IMAGE IS NOW IN THE GWORLD ****** //
00564 
00565         }
00566     
00567     /* compute and display frames-per-second */
00568     [myQDViewObject FindFaces];
00569     GetGWorld(&theSavedPort, &theSavedDevice);
00570     SetGWorld([myQDViewObject gworld], NULL);
00571     TextSize(12);
00572     TextMode(srcCopy);
00573     bounds = [myQDViewObject boundsRect];
00574     MoveTo(bounds.left, bounds.bottom-3);
00575     fps = (float)((float)gTimeScale / (float)(time - gLastTime));
00576     fps = 0.03f*fps + 0.97f*gLastFps;
00577     //sprintf(status, "fps:%5.1f", fps);
00578     sprintf(status, "fps:%2.0f", fps);
00579     CopyCStringToPascal(status, theString);
00580     DrawString(theString);
00581     SetGWorld(theSavedPort, theSavedDevice);
00582     
00583     /* remember current time, so next time this routine is called
00584         we can compute the frames-per-second */
00585     gLastTime = time;
00586     gLastFps = fps;
00587     /* calling the display method will invoke this NSView's lockFocus, drawRect and unlockFocus methods as necessary.
00588         Our drawRect method (above) is used to decompress one of a sequence of frames. This method draws the image
00589         back to the window from the GWorld and could be used as a "preview" */
00590     [myQDViewObject display];
00591 bail:
00592     
00593         return err;
00594 }

Here is the call graph for this function:

void saveQDViewObjectForCallback void *  theObject  ) 
 

Definition at line 607 of file MyQuickDrawView.mm.

References myQDViewObject.

Referenced by MyObject::awakeFromNib.

00608 {
00609    myQDViewObject = (MyQuickDrawView *)theObject;
00610 }


Generated on Mon Nov 8 17:08:15 2004 for MPT by  doxygen 1.3.9.1