home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / scnote / trnsfrmr.020 / UTransformer.p < prev   
Encoding:
Text File  |  1989-10-01  |  4.7 KB  |  169 lines

  1. {[j=20/57/1$]}
  2. {[f-]}
  3. {------------------------------------------------------------------------------
  4. #
  5. #    Apple Macintosh Developer Technical Support
  6. #
  7. #    BitMap Transformer
  8. #
  9. #    UTransformer.p    -    Pascal Source
  10. #
  11. #    Copyright ⌐ 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:
  15. #                1.0                         10/89
  16. #
  17. #    Components:
  18. #                MTransformer.p                October 1, 1989
  19. #                UTransformer.p                October 1, 1989
  20. #                UTransformer.inc1.p         October 1, 1989
  21. #                Transformer.c                October 1, 1989
  22. #                Transformer.r                October 1, 1989
  23. #                Transformer.MAMake            October 1, 1989
  24. #                ProjInit                    October 1, 1989
  25. #                The BitMap Transmogrifier    October 1, 1989
  26. #
  27. #    Requirements:
  28. #                MacApp¿ 2.0º9                July 10, 1989
  29. #
  30. # "Transformers" is a sample program that demonstrates how to translate,
  31. # rotate, and scale bitmaps. It uses a MacApp shell to open file, open
  32. # windows, and handle menus, but the core routine is written in vanilla C.
  33. #
  34. ------------------------------------------------------------------------------}
  35. {[f+]}
  36.  
  37. {$MC68020-}                                             { The program must be universal code }
  38. {$MC68881-}
  39.  
  40. UNIT UTransformer;
  41.  
  42.     INTERFACE
  43.  
  44.         USES
  45.             { Ñ MacApp }
  46.             UMacApp,
  47.  
  48.             { Ñ Building Blocks }
  49.             UDialog,
  50.  
  51.             { Ñ Implementation Use }
  52.             CursorCtl, SANE;
  53.  
  54.         CONST
  55.  
  56.             kSignature            = 'KAAR';                { Application signature}
  57.             kMacPaintFileType    = 'PNTG';
  58.  
  59.             kRowBytes            = 72;
  60.             kHeight             = 720;
  61.             kWidth                = kRowBytes * 8;
  62.  
  63.             kOptionsDialog        = 1100;
  64.  
  65.             cNormal             = 1000;
  66.             cRot90                = 1001;
  67.             cRot45                = 1002;
  68.             cScale2             = 1003;
  69.             cScaleHalf            = 1004;
  70.             cRot45ScaleHalf     = 1005;
  71.             cCustom             = 1006;
  72.  
  73.         TYPE
  74.  
  75. {--------------------------------------------------------------------------------------------------}
  76.             { T T r a n s f o r m e r A p p l i c a t i o n }
  77. {--------------------------------------------------------------------------------------------------}
  78.  
  79.             TTransformerApplication = OBJECT (TApplication)
  80.  
  81.                 PROCEDURE TTransformerApplication.ITransformerApplication(itsMainFileType: OSType);
  82.  
  83.                 FUNCTION TTransformerApplication.AlreadyOpen(fileName: Str255;
  84.                                                              volRefnum: INTEGER): TDocument;
  85.                     OVERRIDE;
  86.  
  87.                 FUNCTION TTransformerApplication.DoMakeDocument(itsCmdNumber: CmdNumber): TDocument;
  88.                     OVERRIDE;
  89.  
  90.                 PROCEDURE TTransformerApplication.HandleFinderRequest; OVERRIDE;
  91.  
  92.                 END;
  93.  
  94. {--------------------------------------------------------------------------------------------------}
  95.             { T B i t M a p D o c u m e n t }
  96. {--------------------------------------------------------------------------------------------------}
  97.  
  98.             TBitMapDocument     = OBJECT (TDocument)
  99.  
  100.                 fOrigBitMap        : BitMap;
  101.  
  102.                 PROCEDURE TBitMapDocument.IBitMapDocument;
  103.  
  104.                 PROCEDURE TBitMapDocument.Free; OVERRIDE;
  105.  
  106.                 PROCEDURE TBitMapDocument.CopyOrigBits(aBitMap: BitMap);
  107.  
  108.                 PROCEDURE TBitMapDocument.DoRead(aRefNum: INTEGER; rsrcExists,
  109.                                                  forPrinting: Boolean); OVERRIDE;
  110.  
  111.                 PROCEDURE TBitMapDocument.Fields(PROCEDURE
  112.                                                  DoToField(fieldName: Str255; fieldAddr: Ptr;
  113.                                                            fieldType: INTEGER)); OVERRIDE;
  114.  
  115.                 PROCEDURE TBitMapDocument.GetOrigBitMap(VAR aBitMap: BitMap);
  116.  
  117.                 END;
  118.  
  119. {--------------------------------------------------------------------------------------------------}
  120.             { T B i t M a p V i e w }
  121. {--------------------------------------------------------------------------------------------------}
  122.  
  123.             TBitMapView         = OBJECT (TView)
  124.  
  125.                 fTransBitMap       : BitMap;
  126.  
  127.                 PROCEDURE TBitMapView.IRes(itsDocument: TDocument; itsSuperview: TView;
  128.                                            VAR itsParams: Ptr); OVERRIDE;
  129.  
  130.                 PROCEDURE TBitMapView.Free; OVERRIDE;
  131.  
  132.                 PROCEDURE TBitMapView.CallTransform(rotation: INTEGER; Sx, Sy: Extended);
  133.  
  134.                 FUNCTION TBitMapView.DoMenuCommand(aCmdNumber: CmdNumber): TCommand; OVERRIDE;
  135.  
  136.                 PROCEDURE TBitMapView.DoSetupMenus; OVERRIDE;
  137.  
  138.                 PROCEDURE TBitMapView.Draw(area: Rect); OVERRIDE;
  139.  
  140.                 PROCEDURE TBitMapView.Fields(PROCEDURE
  141.                                              DoToField(fieldName: Str255; fieldAddr: Ptr;
  142.                                                        fieldType: INTEGER)); OVERRIDE;
  143.                 END;
  144.  
  145. {--------------------------------------------------------------------------------------------------}
  146.             { T E x t N u m b e r T e x t }
  147. {--------------------------------------------------------------------------------------------------}
  148.  
  149.             TExtNumberText        = OBJECT (TNumberText)
  150.  
  151.                 FUNCTION TExtNumberText.GetExtValue: Extended;
  152.  
  153.                 PROCEDURE TExtNumberText.SetExtValue(ext: Extended; redraw: Boolean);
  154.  
  155.                 FUNCTION TExtNumberText.Validate: LONGINT; OVERRIDE;
  156.  
  157.                 END;
  158.  
  159. {--------------------------------------------------------------------------------------------------}
  160.             { G L O B A L S }
  161. {--------------------------------------------------------------------------------------------------}
  162.  
  163.         PROCEDURE ClearBitMap(aBitMap: BitMap);
  164.  
  165.     IMPLEMENTATION
  166.  
  167.         {$I UTransformer.inc1.p}
  168. END.
  169.