home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-30 | 1.8 KB | 76 lines | [TEXT/PJMM] |
- unit DemoPictures;
-
- { WASTE DEMO PROJECT: }
- { Object Handlers for embedded pictures }
-
- { Copyright © 1993-1994 Merzwaren }
- { All Rights Reserved }
-
- interface
- uses
- DemoIntf;
-
- function HandleNewPicture (var defaultObjectSize: Point;
- objectRef: WEObjectReference): OSErr;
- function HandleDisposePicture (objectRef: WEObjectReference): OSErr;
- function HandleDrawPicture (destRect: Rect;
- objectRef: WEObjectReference): OSErr;
- function HandleDrawSound (destRect: Rect;
- objectRef: WEObjectReference): OSErr;
-
- implementation
-
- function HandleNewPicture (var defaultObjectSize: Point;
- objectRef: WEObjectReference): OSErr;
- var
- thePicture: PicHandle;
- frame: Rect;
- begin
-
- { get handle to object data (in this case, a picture handle) }
- thePicture := PicHandle(WEGetObjectDataHandle(objectRef));
-
- { figure out the default object size by looking at the picFrame record }
- frame := thePicture^^.picFrame;
- OffsetRect(frame, -frame.left, -frame.top);
- defaultObjectSize := frame.botRight;
-
- { return error code }
- HandleNewPicture := noErr;
-
- end; { HandleNewPicture }
-
- function HandleDisposePicture (objectRef: WEObjectReference): OSErr;
- var
- thePicture: PicHandle;
- begin
-
- { get handle to object data (in this case, a picture handle) }
- thePicture := PicHandle(WEGetObjectDataHandle(objectRef));
-
- { kill the picture }
- KillPicture(thePicture);
-
- { return error code }
- HandleDisposePicture := MemError;
-
- end; { HandleDisposePicture }
-
- function HandleDrawPicture (destRect: Rect;
- objectRef: WEObjectReference): OSErr;
- var
- thePicture: PicHandle;
- begin
-
- { get handle to object data (in this case, a picture handle) }
- thePicture := PicHandle(WEGetObjectDataHandle(objectRef));
-
- { draw the picture }
- DrawPicture(thePicture, destRect);
-
- { return error code }
- HandleDrawPicture := noErr;
-
- end; { HandleDrawPicture }
-
- end.