Hi,

I have written a simple SuperSampling function.

It is simple and slow, but it could be a simple start for you.

You can use scanline or even assembler or change it, so it can

manage not only quadratic images. I hope it is usefull for you.

The function works great with text, but some images became

some kind of dull-colors, it seems as they became wrong palette ,

if you solve this problem let me know.

{******************* Minimize *************************}

function Minimize(Source:TBitmap;factor:integer):TBitmap;

var

x,y,i,j: Integer;

r, g, b : Integer;

tr, tg, tb, len : Integer;

begin

Result:=TBitmap.Create;

Result.PixelFormat:=Source.PixelFormat;

Result.Width:=Source.Width div factor;

Result.Height:=Source.Height div factor;

len:=factor*factor;

for x:=0 to Result.Width do

begin

for y:=0 to Result.Height do

begin

tr:=0;tg:=0;tb:=0;

for i:=0 to factor-1 do

for j:=0 to factor-1 do

begin

SeparateColor(Source.Canvas.Pixels[x*factor+j,y*factor+i],r,g,b);

tr:=tr+(r div len);

tg:=tg+(g div len);

tb:=tb+(b div len);

end;

Result.Canvas.Pixels[x,y]:=RGB(tr,tg,tb);

end;

end;

end;

{RGB *************************}

function RGB(r, g, b : Integer) : TColor;

begin

Result := r + 256 * (g + 256 * b);

end;

{SeparateColor *************************}

procedure SeparateColor(color : TColor; var r, g, b : Integer);

begin

r := color Mod 256;

g := (color Div 256) Mod 256;

b := color Div 65536;

end;