programer1389
یک شنبه 23 شهریور 1393, 04:09 صبح
procedure ChangeTextColor(imgSource: TImage; x1, y1, x2, y2: Integer;
SelectColor: TColor; LineSpace: Integer);
var
i, j: Integer;
begin
j := y1;
if (j < (y2 - (LineSpace * 2 - 1))) then
begin
while j < y2 - LineSpace do
begin
for i := 0 to x1 do
if imgSource.Picture.Bitmap.Canvas.Pixels[i, j] <> clWhite then
imgSource.Picture.Bitmap.Canvas.Pixels[i, j] := SelectColor;
if y1 + LineSpace < j then
x1 := imgSource.Picture.Bitmap.Width -1;
inc(j);
end;
for j := y2 - LineSpace to y2 do
for i := x2 to imgSource.Picture.Bitmap.Width -1 do
if imgSource.Picture.Bitmap.Canvas.Pixels[i, j] <> clWhite then
imgSource.Picture.Bitmap.Canvas.Pixels[i, j] := SelectColor;
end
else
begin
i := y2 - y1;
i := i - LineSpace;
y2 := y2 - i;
for i := y1 to y2 do
for j := x2 to x1 do
if imgSource.Picture.Bitmap.Canvas.Pixels[j, i] <> clWhite then
imgSource.Picture.Bitmap.Canvas.Pixels[j, i] := SelectColor;
end;
end;
من برخی از کد رو متوجه نمیشم کسی میتونه کمک کنه؟
SelectColor: TColor; LineSpace: Integer);
var
i, j: Integer;
begin
j := y1;
if (j < (y2 - (LineSpace * 2 - 1))) then
begin
while j < y2 - LineSpace do
begin
for i := 0 to x1 do
if imgSource.Picture.Bitmap.Canvas.Pixels[i, j] <> clWhite then
imgSource.Picture.Bitmap.Canvas.Pixels[i, j] := SelectColor;
if y1 + LineSpace < j then
x1 := imgSource.Picture.Bitmap.Width -1;
inc(j);
end;
for j := y2 - LineSpace to y2 do
for i := x2 to imgSource.Picture.Bitmap.Width -1 do
if imgSource.Picture.Bitmap.Canvas.Pixels[i, j] <> clWhite then
imgSource.Picture.Bitmap.Canvas.Pixels[i, j] := SelectColor;
end
else
begin
i := y2 - y1;
i := i - LineSpace;
y2 := y2 - i;
for i := y1 to y2 do
for j := x2 to x1 do
if imgSource.Picture.Bitmap.Canvas.Pixels[j, i] <> clWhite then
imgSource.Picture.Bitmap.Canvas.Pixels[j, i] := SelectColor;
end;
end;
من برخی از کد رو متوجه نمیشم کسی میتونه کمک کنه؟