home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / olympus / ik32_15t / delphi2.shr / UIODIB.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-08-01  |  3.8 KB  |  144 lines

  1. {  Project IoDib.DPR Delphi 2.0 Demos
  2.  
  3.    Description:- IoDib.Dpr Project:-
  4.  
  5.    Demonstrates the use of:
  6.  
  7.    1) 'DuplicateDib'
  8.    2) 'ExportDib'
  9.    3) 'ImportDib'
  10.    4) 'Hdib'
  11.  
  12.    Date of Origin: 16/04/96
  13.    Original Author: Andrew Hutchison
  14.    Modification History:
  15.  
  16.    Date        Person                            Change
  17.    ----------------------------------------------------
  18.    16/04/96    A Hutchison                       Created
  19.  
  20.    (c) Copyright Media Architects Inc. 1996.
  21.    All rights reserved.   No part of this program may be
  22.    photocopied, reproduced, translated to another programming
  23.    language or transported to any computer system without the
  24.    prior written consent of Media Architects Inc.}
  25.  
  26. unit UIodib;
  27.  
  28. interface
  29.  
  30. uses
  31.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  32.   Menus, ExtCtrls, Buttons, OleCtrls, ImageKnife32;
  33.  
  34. type
  35.   TForm1 = class(TForm)
  36.     Bevel1: TBevel;
  37.     MainMenu1: TMainMenu;
  38.     File1: TMenuItem;
  39.     LoadSourceImage1: TMenuItem;
  40.     LoadDestinationImage1: TMenuItem;
  41.     N1: TMenuItem;
  42.     Exit1: TMenuItem;
  43.     Picbufsrc: TPicbuf;
  44.     Picbufdest: TPicbuf;
  45.     ExportDest: TSpeedButton;
  46.     ImportDest: TSpeedButton;
  47.     OpenDialog: TOpenDialog;
  48.     procedure FormCreate(Sender: TObject);
  49.     procedure ExportDestClick(Sender: TObject);
  50.     procedure LoadSourceImage1Click(Sender: TObject);
  51.     procedure LoadDestinationImage1Click(Sender: TObject);
  52.     procedure ImportDestClick(Sender: TObject);
  53.     procedure Exit1Click(Sender: TObject);
  54.   private
  55.     { Private declarations }
  56.   public
  57.     { Public declarations }
  58.   end;
  59.  
  60. var
  61.   Form1: TForm1;
  62.  
  63. implementation
  64.  
  65. {$R *.DFM}
  66.  
  67. {-------------------------------------------------------------------------------}
  68. {Load Source Image - PicbufSrc- using standard calls and an Common Dialog Control}
  69. procedure TForm1.LoadSourceImage1Click(Sender: TObject);
  70. begin
  71. {Open Common Dialog}
  72. if Opendialog.execute then
  73. begin
  74. {Set FileName}
  75. Picbufsrc.filename:=Opendialog.filename;
  76. {Call Load Method}
  77. Picbufsrc.Load;
  78. end;
  79. end;
  80.  
  81.  
  82.  
  83. {-------------------------------------------------------------------------------}
  84. {Load Destination Image - Picbufdest - using standard calls and an Common Dialog
  85. Control}
  86. procedure TForm1.LoadDestinationImage1Click(Sender: TObject);
  87. begin
  88. {Open Common Dialog}
  89. if Opendialog.execute then
  90. begin
  91. {Set FileName}
  92. Picbufdest.filename:=Opendialog.filename;
  93. {Call Load Method}
  94. Picbufdest.Load;
  95. end;
  96. end;
  97.  
  98.  
  99. {-------------------------------------------------------------------------------}
  100. {Transfer the Source Image to the Destination Image Using the Export and Import
  101. Dib Methods.}
  102. procedure TForm1.ExportDestClick(Sender: TObject);
  103. var
  104. hdibexport:integer;{Holds Handle DIB}
  105. begin
  106. {Call Function to Export DIB from Source Picbuf}
  107. hDIBExport := Picbufsrc.ExportDib(True);
  108. {Place DIB into Destination Image ie IMPORT it}
  109. Picbufdest.ImportDib(hDIBExport, True)
  110. end;
  111.  
  112.  
  113. {-------------------------------------------------------------------------------}
  114. {Transfer the Destination Image to the Source Image using the Export and Import
  115. Dib Methods. }
  116. procedure TForm1.ImportDestClick(Sender: TObject);
  117. Var
  118. hDibExport : Integer;{Holds Handle to DIB}
  119. begin
  120. {Get the DIB from the Destination Image}
  121. hDIBExport := Picbufdest.ExportDib(True);
  122. {Copy the retreived Dib into the Source Image}
  123. Picbufsrc.ImportDib(hDIBExport, True);
  124. end;
  125.  
  126.  
  127. {-------------------------------------------------------------------------------}
  128. {Set up Delphi Defaults}
  129. procedure TForm1.FormCreate(Sender: TObject);
  130. begin
  131. Application.HintPause := 10;
  132. Application.HintColor:= clAqua;
  133. end;
  134.  
  135.  
  136. {-------------------------------------------------------------------------------}
  137. {Shutdown}
  138. procedure TForm1.Exit1Click(Sender: TObject);
  139. begin
  140. Halt;
  141. end;
  142.  
  143. end.
  144.