home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 November / CDVD1105.ISO / Software / Freeware / programare / graphics32 / Examples / Clx / FineResample_Ex / MainUnit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2004-07-16  |  2.8 KB  |  105 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.   Qt, Types, QForms, QControls, QGraphics, QStdCtrls, QExtCtrls,
  32.   {$IFDEF LINUX}Libc,{$ENDIF}
  33.   {$IFDEF MSWINDOWS}Windows, {$ENDIF}
  34.   Classes, SysUtils, GR32, GR32_Image, GR32_Transforms;
  35.   
  36. type
  37.   TForm1 = class(TForm)
  38.     RadioGroup1: TRadioGroup;
  39.     CheckBox1: TCheckBox;
  40.     Image32: TImage32;
  41.     procedure FormCreate(Sender: TObject);
  42.     procedure RadioGroup1Click(Sender: TObject);
  43.     procedure CheckBox1Click(Sender: TObject);
  44.   private
  45.     { Private declarations }
  46.   public
  47.     { Public declarations }
  48.   end;
  49.  
  50. var
  51.   Form1: TForm1;
  52.  
  53. implementation
  54.  
  55. {$R *.xfm}
  56.  
  57. procedure TForm1.FormCreate(Sender: TObject);
  58. var
  59.   I, J: Integer;
  60. begin
  61.   Image32.Bitmap.SetSize(16, 16);
  62.   for I := 0 to 15 do
  63.     for J := 0 to 15 do
  64.       if (I + J) mod 2 = 0 then Image32.Bitmap.Pixel[I, J] := clBlack32
  65.       else Image32.Bitmap.Pixel[I, J] := clWhite32;
  66.   for I := 0 to 15 do
  67.   begin
  68.     Image32.Bitmap.Pixel[I, 9] := Gray32(I * 255 div 15);
  69.     Image32.Bitmap.Pixel[I, 10] := Gray32(I * 255 div 15);
  70.   end;
  71.  
  72.   for I := 0 to 7 do
  73.   begin
  74.     Image32.Bitmap.Pixel[I * 2, 11] := Gray32(I * 255 div 7);
  75.     Image32.Bitmap.Pixel[I * 2 + 1, 11] := Gray32(I * 255 div 7);
  76.     Image32.Bitmap.Pixel[I * 2, 12] := Gray32(I * 255 div 7);
  77.     Image32.Bitmap.Pixel[I * 2 + 1, 12] := Gray32(I * 255 div 7);
  78.     Image32.Bitmap.Pixel[I * 2, 13] := Gray32(I * 255 div 7);
  79.     Image32.Bitmap.Pixel[I * 2 + 1, 13] := Gray32(I * 255 div 7);
  80.   end;
  81.  
  82.   with Image32.Bitmap do
  83.   begin
  84.     for I := 1 to 4 do
  85.       for J := 1 to 4 do
  86.         Pixels[I, J] := $FF5F5F5F;
  87.     for I := 2 to 3 do
  88.       for J := 2 to 3 do
  89.         Pixels[I, J] := $FFAFAFAF;
  90.   end;
  91. end;
  92.  
  93. procedure TForm1.RadioGroup1Click(Sender: TObject);
  94. begin
  95.   Image32.Bitmap.StretchFilter := TStretchFilter(RadioGroup1.ItemIndex);
  96. end;
  97.  
  98. procedure TForm1.CheckBox1Click(Sender: TObject);
  99. begin
  100.   GR32_Transforms.FullEdge := CheckBox1.Checked;
  101.   Image32.Bitmap.Changed;
  102. end;
  103.  
  104. end.
  105.