program console_gdi;
uses
windows;
type pixel=object
x,y:integer;
c:COLORREF;
end;
type aop=array of pixel;
procedure capture(fx,fy,lx,ly:integer;var p:aop);
var
h:hdc;
x,y:integer;
counter :int32=0;
colour:COLORREF;
begin
h:=getdc(GetConsoleWindow());
for y := fy to ly do
begin
for x:=fx to lx do
begin
setlength(p,counter+1);
p[counter].x:=x;
p[counter].y:=y;
p[counter].c:=getpixel(h,x,y);
counter:=counter+1;
end;
end;
end;
procedure rewrite(dx:integer;dy:integer; p:aop);
var
h:hdc;
i:int32;
begin
h:=getdc(GetConsoleWindow());
for i:=0 to high(p) do
begin
setpixel(h,p[i].x+dx,p[i].y+dy, RGB(GetBValue(p[i].c),GetGValue(p[i].c),GetRValue(p[i].c)));
end;
end;
var
s:ansistring='abcdefghijklmnopqrstuvwxyz' + chr(10);
pix:aop;
begin
s:=s+s;
s:=s+s;
writeln(s);
writeln('Please wait a few seconds');
capture(0,0,215,100,pix);
rewrite(250,100,pix);
writeln('Done, press return to end ...');
readln;
end.