hello experts:
i want to separate the borderline on paintbox.canvas,on the paintbox.canvas,the canvas is here:
http://www26.brinkster.com/jbaswjy/default.htm
change the borderline to clblack color and change the other color
to clwhite.
my code not work well; help me!,thanks!
for I:=0 to paintbox1.Width-1 do
begin
for J:=0 to paintbox1.Height-1 do
begin
SBln:=false;
TempColor:=paintbox1.Canva
s.Pixels[I
,J];
Templcolor:=paintbox1.Canv
as.Pixels[
I-1,J];
Temprcolor:=paintbox1.Canv
as.Pixels[
I+1,J];
Temptcolor:=paintbox1.Canv
as.Pixels[
I,J-1];
Tempdcolor:=paintbox1.Canv
as.Pixels[
I,J+1];
if (TempColor=Templcolor)
or (TempColor=Temprcolor)
or (TempColor=Temptcolor)
or (TempColor=TempDcolor) then
SBln=true;
if SBln=true then
simulate.pntbx.Canvas.Pixe
ls[I,J]:=c
lblack
else
simulate.pntbx.Canvas.Pixe
ls[I,J]:=c
lwhite;
end;
end;
I saved the web page and then saved the image as a bitmap.
Then with my program I first loaded the bitmap. To do this, first by double clicking in the image area
and follow the instructions and then size to fit. Run the program, press the Process button, observe ,
If you like it then Save it to a some name different than the original, Close the program
unit EEPixlHelperUnit1;
// I loaded the internet image into an image on the form.
// then processed the image. I first 'raised the few
// shapes that were black to be gray
// I then got each pixel and then outlined each shape in black
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
Button2: TButton;
Button3: TButton;
SaveDialog1: TSaveDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender
var
IA, IB, M: Integer;
begin
for IA := 1 to Form1.Image1.Picture.Width
begin
for IB := 1 to Form1.Image1.Picture.Heigh
begin
// $000000 is Black
// $FFFFFF is White
// the 2 black images are being raised to a lighter color
if Form1.Image1.Canvas.Pixels
Form1.Image1.Canvas.Pixels
if Form1.Image1.Canvas.Pixels
Form1.Image1.Canvas.Pixels
end; //end for IB
end; // end IA
for IA := 1 to Form1.Image1.Picture.Width
begin
for IB := 1 to Form1.Image1.Picture.Heigh
begin
// $000000 is Black
// $FFFFFF is White
M := Form1.Image1.Canvas.Pixels
if Form1.Image1.Canvas.Pixels
Form1.Image1.Canvas.Pixels
if Form1.Image1.Canvas.Pixels
Form1.Image1.Canvas.Pixels
end; //end for IB
end; // end IA
repaint;
end;
procedure TForm1.Button2Click(Sender
begin
if Form1.SaveDialog1.Execute then
Form1.Image1.Picture.SaveT
end;
procedure TForm1.Button3Click(Sender
begin
Application.Terminate;
end;
end.
form as Text:
object Form1: TForm1
Left = 211
Top = 120
Width = 495
Height = 316
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 120
TextHeight = 16
object Image1: TImage
Left = 104
Top = 32
Width = 257
Height = 193
end
object Button1: TButton
Left = 392
Top = 72
Width = 75
Height = 25
Caption = 'Process'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 392
Top = 120
Width = 75
Height = 25
Caption = 'Save'
TabOrder = 1
OnClick = Button2Click
end
object Button3: TButton
Left = 392
Top = 168
Width = 75
Height = 25
Caption = 'Close'
TabOrder = 2
OnClick = Button3Click
end
object SaveDialog1: TSaveDialog
Left = 384
Top = 8
end
end
Delphi3