unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ExtDlgs, ExtCtrls, JPEG, StdCtrls, Gauges, Spin, ComCtrls;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
Datei1: TMenuItem;
ffnen1: TMenuItem;
Speichern1: TMenuItem;
Schlieen1: TMenuItem;
Anzeige: TImage;
OpenPictureDialog1: TOpenPictureDialog;
test1: TMenuItem;
Genauigkeit: TSpinEdit;
LGenauigkeit: TLabel;
LGroesse: TLabel;
Groesse: TSpinEdit;
ASCII: TRichEdit;
procedure Schlieen1Click(Sender: TObject);
procedure ffnen1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure test1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Schlieen1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.ffnen1Click(Sender: TObject);
begin
with OpenPictureDialog1 do
if Execute then
Anzeige.Picture.LoadFromFile(FileName);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Anzeige.Height:=Form1.ClientHeight-Genauigkeit.Height;
Anzeige.Width:=Form1.ClientWidth div 3;
ASCII.Left:=Form1.ClientWidth div 3;
ASCII.Width:=Form1.ClientWidth-Form1.ClientWidth div 3;
ASCII.Height:=Form1.ClientHeight;
DoubleBuffered:=true;
end;
procedure TForm1.test1Click(Sender: TObject);
var i,j:integer;
Farbe:TColor;
begi
ASCII.Clear;
ASCII.Font.Size:=Groesse.Value;
i:=0;
j:=0;
while i < Anzeige.Picture.Graphic.Height do
begin
while j < Anzeige.Picture.Graphic.Width do
begin
Farbe:=Anzeige.Canvas.Pixels[j,i];
if (GetRValue(Farbe)<100) and (GetGValue(Farbe)<100) and (GetBValue(Farbe)<100) then
ASCII.Text:=
ASCII.Text+'#'
else
ASCII.Text:=
ASCII.Text+' ';
j:=j+Genauigkeit.Value;
end;
i:=i+Genauigkeit.Value;
ASCII.Text:=
ASCII.Text+#13#10;
Application.ProcessMessages;
j:=0;
end;
end;
end.