home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 November / CDVD1105.ISO / Software / Freeware / programare / graphics32 / Examples / Vcl / FineResample_Ex / MainUnit.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2004-07-14  |  2.8 KB  |  103 lines

  1. unit MainUnit;
  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, Variants, Classes, Graphics, Controls, Forms,
  32.   Dialogs, StdCtrls, ExtCtrls, GR32, GR32_Image, GR32_Transforms;
  33.  
  34. type
  35.   TForm1 = class(TForm)
  36.     Image32: TImage32;
  37.     RadioGroup1: TRadioGroup;
  38.     CheckBox1: TCheckBox;
  39.     procedure FormCreate(Sender: TObject);
  40.     procedure RadioGroup1Click(Sender: TObject);
  41.     procedure CheckBox1Click(Sender: TObject);
  42.   private
  43.     { Private declarations }
  44.   public
  45.     { Public declarations }
  46.   end;
  47.  
  48. var
  49.   Form1: TForm1;
  50.  
  51. implementation
  52.  
  53. {$R *.dfm}
  54.  
  55. procedure TForm1.FormCreate(Sender: TObject);
  56. var
  57.   I, J: Integer;
  58. begin
  59.   Image32.Bitmap.SetSize(16, 16);
  60.   for I := 0 to 15 do
  61.     for J := 0 to 15 do
  62.       if (I + J) mod 2 = 0 then Image32.Bitmap.Pixel[I, J] := clBlack32
  63.       else Image32.Bitmap.Pixel[I, J] := clWhite32;
  64.   for I := 0 to 15 do
  65.   begin
  66.     Image32.Bitmap.Pixel[I, 9] := Gray32(I * 255 div 15);
  67.     Image32.Bitmap.Pixel[I, 10] := Gray32(I * 255 div 15);
  68.   end;
  69.  
  70.   for I := 0 to 7 do
  71.   begin
  72.     Image32.Bitmap.Pixel[I * 2, 11] := Gray32(I * 255 div 7);
  73.     Image32.Bitmap.Pixel[I * 2 + 1, 11] := Gray32(I * 255 div 7);
  74.     Image32.Bitmap.Pixel[I * 2, 12] := Gray32(I * 255 div 7);
  75.     Image32.Bitmap.Pixel[I * 2 + 1, 12] := Gray32(I * 255 div 7);
  76.     Image32.Bitmap.Pixel[I * 2, 13] := Gray32(I * 255 div 7);
  77.     Image32.Bitmap.Pixel[I * 2 + 1, 13] := Gray32(I * 255 div 7);
  78.   end;
  79.  
  80.   with Image32.Bitmap do
  81.   begin
  82.     for I := 1 to 4 do
  83.       for J := 1 to 4 do
  84.         Pixels[I, J] := $FF5F5F5F;
  85.     for I := 2 to 3 do
  86.       for J := 2 to 3 do
  87.         Pixels[I, J] := $FFAFAFAF;
  88.   end;
  89. end;
  90.  
  91. procedure TForm1.RadioGroup1Click(Sender: TObject);
  92. begin
  93.   Image32.Bitmap.StretchFilter := TStretchFilter(RadioGroup1.ItemIndex);
  94. end;
  95.  
  96. procedure TForm1.CheckBox1Click(Sender: TObject);
  97. begin
  98.   GR32_Transforms.FullEdge := CheckBox1.Checked;
  99.   Image32.Bitmap.Changed;
  100. end;
  101.  
  102. end.
  103.