home *** CD-ROM | disk | FTP | other *** search
- { Project IoDib.DPR Delphi 2.0 Demos
-
- Description:- IoDib.Dpr Project:-
-
- Demonstrates the use of:
-
- 1) 'DuplicateDib'
- 2) 'ExportDib'
- 3) 'ImportDib'
- 4) 'Hdib'
-
- Date of Origin: 16/04/96
- Original Author: Andrew Hutchison
- Modification History:
-
- Date Person Change
- ----------------------------------------------------
- 16/04/96 A Hutchison Created
-
- (c) Copyright Media Architects Inc. 1996.
- All rights reserved. No part of this program may be
- photocopied, reproduced, translated to another programming
- language or transported to any computer system without the
- prior written consent of Media Architects Inc.}
-
- unit UIodib;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Menus, ExtCtrls, Buttons, OleCtrls, ImageKnife32;
-
- type
- TForm1 = class(TForm)
- Bevel1: TBevel;
- MainMenu1: TMainMenu;
- File1: TMenuItem;
- LoadSourceImage1: TMenuItem;
- LoadDestinationImage1: TMenuItem;
- N1: TMenuItem;
- Exit1: TMenuItem;
- Picbufsrc: TPicbuf;
- Picbufdest: TPicbuf;
- ExportDest: TSpeedButton;
- ImportDest: TSpeedButton;
- OpenDialog: TOpenDialog;
- procedure FormCreate(Sender: TObject);
- procedure ExportDestClick(Sender: TObject);
- procedure LoadSourceImage1Click(Sender: TObject);
- procedure LoadDestinationImage1Click(Sender: TObject);
- procedure ImportDestClick(Sender: TObject);
- procedure Exit1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- {-------------------------------------------------------------------------------}
- {Load Source Image - PicbufSrc- using standard calls and an Common Dialog Control}
- procedure TForm1.LoadSourceImage1Click(Sender: TObject);
- begin
- {Open Common Dialog}
- if Opendialog.execute then
- begin
- {Set FileName}
- Picbufsrc.filename:=Opendialog.filename;
- {Call Load Method}
- Picbufsrc.Load;
- end;
- end;
-
-
-
- {-------------------------------------------------------------------------------}
- {Load Destination Image - Picbufdest - using standard calls and an Common Dialog
- Control}
- procedure TForm1.LoadDestinationImage1Click(Sender: TObject);
- begin
- {Open Common Dialog}
- if Opendialog.execute then
- begin
- {Set FileName}
- Picbufdest.filename:=Opendialog.filename;
- {Call Load Method}
- Picbufdest.Load;
- end;
- end;
-
-
- {-------------------------------------------------------------------------------}
- {Transfer the Source Image to the Destination Image Using the Export and Import
- Dib Methods.}
- procedure TForm1.ExportDestClick(Sender: TObject);
- var
- hdibexport:integer;{Holds Handle DIB}
- begin
- {Call Function to Export DIB from Source Picbuf}
- hDIBExport := Picbufsrc.ExportDib(True);
- {Place DIB into Destination Image ie IMPORT it}
- Picbufdest.ImportDib(hDIBExport, True)
- end;
-
-
- {-------------------------------------------------------------------------------}
- {Transfer the Destination Image to the Source Image using the Export and Import
- Dib Methods. }
- procedure TForm1.ImportDestClick(Sender: TObject);
- Var
- hDibExport : Integer;{Holds Handle to DIB}
- begin
- {Get the DIB from the Destination Image}
- hDIBExport := Picbufdest.ExportDib(True);
- {Copy the retreived Dib into the Source Image}
- Picbufsrc.ImportDib(hDIBExport, True);
- end;
-
-
- {-------------------------------------------------------------------------------}
- {Set up Delphi Defaults}
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- Application.HintPause := 10;
- Application.HintColor:= clAqua;
- end;
-
-
- {-------------------------------------------------------------------------------}
- {Shutdown}
- procedure TForm1.Exit1Click(Sender: TObject);
- begin
- Halt;
- end;
-
- end.
-