home *** CD-ROM | disk | FTP | other *** search
- {[j=20/57/1$]}
- {[f-]}
- {------------------------------------------------------------------------------
- #
- # Apple Macintosh Developer Technical Support
- #
- # BitMap Transformer
- #
- # UTransformer.p - Pascal Source
- #
- # Copyright ⌐ 1989 Apple Computer, Inc.
- # All rights reserved.
- #
- # Versions:
- # 1.0 10/89
- #
- # Components:
- # MTransformer.p October 1, 1989
- # UTransformer.p October 1, 1989
- # UTransformer.inc1.p October 1, 1989
- # Transformer.c October 1, 1989
- # Transformer.r October 1, 1989
- # Transformer.MAMake October 1, 1989
- # ProjInit October 1, 1989
- # The BitMap Transmogrifier October 1, 1989
- #
- # Requirements:
- # MacApp¿ 2.0º9 July 10, 1989
- #
- # "Transformers" is a sample program that demonstrates how to translate,
- # rotate, and scale bitmaps. It uses a MacApp shell to open file, open
- # windows, and handle menus, but the core routine is written in vanilla C.
- #
- ------------------------------------------------------------------------------}
- {[f+]}
-
- {$MC68020-} { The program must be universal code }
- {$MC68881-}
-
- UNIT UTransformer;
-
- INTERFACE
-
- USES
- { Ñ MacApp }
- UMacApp,
-
- { Ñ Building Blocks }
- UDialog,
-
- { Ñ Implementation Use }
- CursorCtl, SANE;
-
- CONST
-
- kSignature = 'KAAR'; { Application signature}
- kMacPaintFileType = 'PNTG';
-
- kRowBytes = 72;
- kHeight = 720;
- kWidth = kRowBytes * 8;
-
- kOptionsDialog = 1100;
-
- cNormal = 1000;
- cRot90 = 1001;
- cRot45 = 1002;
- cScale2 = 1003;
- cScaleHalf = 1004;
- cRot45ScaleHalf = 1005;
- cCustom = 1006;
-
- TYPE
-
- {--------------------------------------------------------------------------------------------------}
- { T T r a n s f o r m e r A p p l i c a t i o n }
- {--------------------------------------------------------------------------------------------------}
-
- TTransformerApplication = OBJECT (TApplication)
-
- PROCEDURE TTransformerApplication.ITransformerApplication(itsMainFileType: OSType);
-
- FUNCTION TTransformerApplication.AlreadyOpen(fileName: Str255;
- volRefnum: INTEGER): TDocument;
- OVERRIDE;
-
- FUNCTION TTransformerApplication.DoMakeDocument(itsCmdNumber: CmdNumber): TDocument;
- OVERRIDE;
-
- PROCEDURE TTransformerApplication.HandleFinderRequest; OVERRIDE;
-
- END;
-
- {--------------------------------------------------------------------------------------------------}
- { T B i t M a p D o c u m e n t }
- {--------------------------------------------------------------------------------------------------}
-
- TBitMapDocument = OBJECT (TDocument)
-
- fOrigBitMap : BitMap;
-
- PROCEDURE TBitMapDocument.IBitMapDocument;
-
- PROCEDURE TBitMapDocument.Free; OVERRIDE;
-
- PROCEDURE TBitMapDocument.CopyOrigBits(aBitMap: BitMap);
-
- PROCEDURE TBitMapDocument.DoRead(aRefNum: INTEGER; rsrcExists,
- forPrinting: Boolean); OVERRIDE;
-
- PROCEDURE TBitMapDocument.Fields(PROCEDURE
- DoToField(fieldName: Str255; fieldAddr: Ptr;
- fieldType: INTEGER)); OVERRIDE;
-
- PROCEDURE TBitMapDocument.GetOrigBitMap(VAR aBitMap: BitMap);
-
- END;
-
- {--------------------------------------------------------------------------------------------------}
- { T B i t M a p V i e w }
- {--------------------------------------------------------------------------------------------------}
-
- TBitMapView = OBJECT (TView)
-
- fTransBitMap : BitMap;
-
- PROCEDURE TBitMapView.IRes(itsDocument: TDocument; itsSuperview: TView;
- VAR itsParams: Ptr); OVERRIDE;
-
- PROCEDURE TBitMapView.Free; OVERRIDE;
-
- PROCEDURE TBitMapView.CallTransform(rotation: INTEGER; Sx, Sy: Extended);
-
- FUNCTION TBitMapView.DoMenuCommand(aCmdNumber: CmdNumber): TCommand; OVERRIDE;
-
- PROCEDURE TBitMapView.DoSetupMenus; OVERRIDE;
-
- PROCEDURE TBitMapView.Draw(area: Rect); OVERRIDE;
-
- PROCEDURE TBitMapView.Fields(PROCEDURE
- DoToField(fieldName: Str255; fieldAddr: Ptr;
- fieldType: INTEGER)); OVERRIDE;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- { T E x t N u m b e r T e x t }
- {--------------------------------------------------------------------------------------------------}
-
- TExtNumberText = OBJECT (TNumberText)
-
- FUNCTION TExtNumberText.GetExtValue: Extended;
-
- PROCEDURE TExtNumberText.SetExtValue(ext: Extended; redraw: Boolean);
-
- FUNCTION TExtNumberText.Validate: LONGINT; OVERRIDE;
-
- END;
-
- {--------------------------------------------------------------------------------------------------}
- { G L O B A L S }
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE ClearBitMap(aBitMap: BitMap);
-
- IMPLEMENTATION
-
- {$I UTransformer.inc1.p}
- END.
-