home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 November / CDVD1105.ISO / Software / Freeware / programare / graphics32 / Examples / Vcl / ImgView_Layers_Ex / RGBALoaderUnit.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2004-07-05  |  3.0 KB  |  117 lines

  1. unit RGBALoaderUnit;
  2.  
  3. (* ***** BEGIN LICENSE BLOCK *****
  4.  * Version: MPL 1.1
  5.  *
  6.  * The contents of this file are subject to the Mozilla Public License Version
  7.  * 1.1 (the "License"); you may not use this file except in compliance with
  8.  * the License. You may obtain a copy of the License at
  9.  * http://www.mozilla.org/MPL/
  10.  *
  11.  * Software distributed under the License is distributed on an "AS IS" basis,
  12.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.  * for the specific language governing rights and limitations under the
  14.  * License.
  15.  *
  16.  * The Original Code is Graphics32
  17.  *
  18.  * The Initial Developer of the Original Code is
  19.  * Alex A. Denisov
  20.  *
  21.  * Portions created by the Initial Developer are Copyright (C) 2000-2004
  22.  * the Initial Developer. All Rights Reserved.
  23.  *
  24.  * Contributor(s):
  25.  *
  26.  * ***** END LICENSE BLOCK ***** *)
  27.  
  28. interface
  29.  
  30. uses
  31.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  32.   StdCtrls, GR32_Image, GR32_Filters, ExtCtrls, ExtDlgs, Buttons;
  33.  
  34. type
  35.   TRGBALoaderForm = class(TForm)
  36.     Panel1: TPanel;
  37.     Bevel1: TBevel;
  38.     Label1: TLabel;
  39.     Label2: TLabel;
  40.     ImgRGB: TImgView32;
  41.     Button1: TButton;
  42.     Label3: TLabel;
  43.     ImgAlpha: TImgView32;
  44.     Button2: TButton;
  45.     Label4: TLabel;
  46.     Button3: TButton;
  47.     Button4: TButton;
  48.     OpenPictureDialog: TOpenPictureDialog;
  49.     SpeedButton1: TSpeedButton;
  50.     SpeedButton2: TSpeedButton;
  51.     SpeedButton3: TSpeedButton;
  52.     SpeedButton4: TSpeedButton;
  53.     Button5: TButton;
  54.     procedure Button1Click(Sender: TObject);
  55.     procedure Button2Click(Sender: TObject);
  56.     procedure SpeedButton1Click(Sender: TObject);
  57.     procedure SpeedButton2Click(Sender: TObject);
  58.     procedure SpeedButton3Click(Sender: TObject);
  59.     procedure SpeedButton4Click(Sender: TObject);
  60.     procedure Button5Click(Sender: TObject);
  61.   private
  62.     { Private declarations }
  63.   public
  64.     { Public declarations }
  65.   end;
  66.  
  67. var
  68.   RGBALoaderForm: TRGBALoaderForm;
  69.  
  70. implementation
  71.  
  72. {$R *.DFM}
  73.  
  74. procedure TRGBALoaderForm.Button1Click(Sender: TObject);
  75. begin
  76.   with OpenPictureDialog do
  77.     if Execute then ImgRGB.Bitmap.LoadFromFile(FileName);
  78. end;
  79.  
  80. procedure TRGBALoaderForm.Button2Click(Sender: TObject);
  81. begin
  82.   with OpenPictureDialog, ImgAlpha do
  83.     if Execute then
  84.     begin
  85.       Bitmap.LoadFromFile(FileName);
  86.       ColorToGrayscale(Bitmap, Bitmap);
  87.     end;
  88. end;
  89.  
  90. procedure TRGBALoaderForm.SpeedButton1Click(Sender: TObject);
  91. begin
  92.   ImgRGB.Scale := ImgRGB.Scale * 1.5;
  93. end;
  94.  
  95. procedure TRGBALoaderForm.SpeedButton2Click(Sender: TObject);
  96. begin
  97.   ImgRGB.Scale := ImgRGB.Scale / 1.5;
  98. end;
  99.  
  100. procedure TRGBALoaderForm.SpeedButton3Click(Sender: TObject);
  101. begin
  102.   ImgAlpha.Scale := ImgAlpha.Scale * 1.5;
  103. end;
  104.  
  105. procedure TRGBALoaderForm.SpeedButton4Click(Sender: TObject);
  106. begin
  107.   ImgAlpha.Scale := ImgAlpha.Scale / 1.5;
  108. end;
  109.  
  110. procedure TRGBALoaderForm.Button5Click(Sender: TObject);
  111. begin
  112.   ImgRGB.Scale := 1;
  113.   ImgAlpha.Scale := 1;
  114. end;
  115.  
  116. end.
  117.