procedure TAPOS.Bitmap24Print(X, Y: Integer; Bmp: TBitmap);
var
YLp: Integer;
XLp: Integer;
b: Byte;
ABmp: TBitmap;
P : PByteArray;
S: String;
W: Integer;
H: Integer;
begin
try
ABmp := TBitmap.Create;
ABmp.Width := Bmp.Width;
ABmp.Height := Bmp.Height;
ABmp.Assign(Bmp);
ABmp.PixelFormat := pf1bit;
ABmp.Monochrome := True; Sendc(ESC);
Sends('I'); S := format('%4.4d', [X + FAdjustPoint]);
S := Copy(S, 1, 4);
Sends(S);//倃埵抲 S := format('%4.4d', [Y + FLine]);
S := Copy(S, 1, 4);
Sends(S);//倄埵抲 W := ABmp.Width div 8;
H := ABmp.Height; S := format('%3.3d', [W]);
S := Copy(S, 1, 3);
Sends(S);//暆僶僀僩悢
S := format('%3.3d', [H]);
S := Copy(S, 1, 3);
Sends(S);//儔僀儞悢
for YLp := 0 to H - 1 do
begin
P := ABmp.ScanLine[YLp];
for XLp := 0 to W - 1 do
begin
b := not P[XLp];
Sendc(b);
end;
end;
//ABmp.SaveToFile('MINTEST.BMP');
finally
ABmp.Free;
end;
end;主要是:
for YLp := 0 to H - 1 do
begin
P := ABmp.ScanLine[YLp];
for XLp := 0 to W - 1 do
begin
b := not P[XLp];
Sendc(b);
end;
end;
这段搞不懂,还有P的定义。意思大概懂,就是ScanLine,在C#里是什么方法
var
YLp: Integer;
XLp: Integer;
b: Byte;
ABmp: TBitmap;
P : PByteArray;
S: String;
W: Integer;
H: Integer;
begin
try
ABmp := TBitmap.Create;
ABmp.Width := Bmp.Width;
ABmp.Height := Bmp.Height;
ABmp.Assign(Bmp);
ABmp.PixelFormat := pf1bit;
ABmp.Monochrome := True; Sendc(ESC);
Sends('I'); S := format('%4.4d', [X + FAdjustPoint]);
S := Copy(S, 1, 4);
Sends(S);//倃埵抲 S := format('%4.4d', [Y + FLine]);
S := Copy(S, 1, 4);
Sends(S);//倄埵抲 W := ABmp.Width div 8;
H := ABmp.Height; S := format('%3.3d', [W]);
S := Copy(S, 1, 3);
Sends(S);//暆僶僀僩悢
S := format('%3.3d', [H]);
S := Copy(S, 1, 3);
Sends(S);//儔僀儞悢
for YLp := 0 to H - 1 do
begin
P := ABmp.ScanLine[YLp];
for XLp := 0 to W - 1 do
begin
b := not P[XLp];
Sendc(b);
end;
end;
//ABmp.SaveToFile('MINTEST.BMP');
finally
ABmp.Free;
end;
end;主要是:
for YLp := 0 to H - 1 do
begin
P := ABmp.ScanLine[YLp];
for XLp := 0 to W - 1 do
begin
b := not P[XLp];
Sendc(b);
end;
end;
这段搞不懂,还有P的定义。意思大概懂,就是ScanLine,在C#里是什么方法
ScanLine你得找delphi的help,看看是啥意思了
我觉得这个你就得读懂delphi的代码,然后再用C#去实现相同的功能了