home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 November / CDVD1105.ISO / Software / Freeware / programare / graphics32 / Examples / Clx / ImgView_Layers_Ex / RGBALoaderUnit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2004-07-14  |  3.1 KB  |  123 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.   SysUtils, Classes, QGraphics, QForms, QDialogs, QStdCtrls, QControls,
  32.   QExtCtrls, QButtons, GR32_Image, GR32_Filters;
  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.     SpeedButton1: TSpeedButton;
  49.     SpeedButton2: TSpeedButton;
  50.     SpeedButton3: TSpeedButton;
  51.     SpeedButton4: TSpeedButton;
  52.     Button5: TButton;
  53.     OpenPictureDialog: TOpenDialog;
  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.     procedure FormCreate(Sender: TObject);
  62.   private
  63.     { Private declarations }
  64.   public
  65.     { Public declarations }
  66.   end;
  67.  
  68. var
  69.   RGBALoaderForm: TRGBALoaderForm;
  70.  
  71. implementation
  72.  
  73. {$R *.xfm}
  74.  
  75. procedure TRGBALoaderForm.Button1Click(Sender: TObject);
  76. begin
  77.   with OpenPictureDialog do
  78.     if Execute then ImgRGB.Bitmap.LoadFromFile(FileName);
  79. end;
  80.  
  81. procedure TRGBALoaderForm.Button2Click(Sender: TObject);
  82. begin
  83.   with OpenPictureDialog, ImgAlpha do
  84.     if Execute then
  85.     begin
  86.       Bitmap.LoadFromFile(FileName);
  87.       ColorToGrayscale(Bitmap, Bitmap);
  88.     end;
  89. end;
  90.  
  91. procedure TRGBALoaderForm.SpeedButton1Click(Sender: TObject);
  92. begin
  93.   ImgRGB.Scale := ImgRGB.Scale * 1.5;
  94. end;
  95.  
  96. procedure TRGBALoaderForm.SpeedButton2Click(Sender: TObject);
  97. begin
  98.   ImgRGB.Scale := ImgRGB.Scale / 1.5;
  99. end;
  100.  
  101. procedure TRGBALoaderForm.SpeedButton3Click(Sender: TObject);
  102. begin
  103.   ImgAlpha.Scale := ImgAlpha.Scale * 1.5;
  104. end;
  105.  
  106. procedure TRGBALoaderForm.SpeedButton4Click(Sender: TObject);
  107. begin
  108.   ImgAlpha.Scale := ImgAlpha.Scale / 1.5;
  109. end;
  110.  
  111. procedure TRGBALoaderForm.Button5Click(Sender: TObject);
  112. begin
  113.   ImgRGB.Scale := 1;
  114.   ImgAlpha.Scale := 1;
  115. end;
  116.  
  117. procedure TRGBALoaderForm.FormCreate(Sender: TObject);
  118. begin
  119.   OpenPictureDialog.Filter := GraphicFilter(TGraphic, True); 
  120. end;
  121.  
  122. end.
  123.