Archived

This topic is now archived and is closed to further replies.

bitmap scaling .....help!!

This topic is 5775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok basicly like that topic says i''m trying to scale a bitmap to make it bigger or smaller but well i don''t know how i''v looked on the net and found some docs but they didn''t really make ay sense so i''m hoping some one could explain it in easy to understand terms with or without code cause once i under stand it i''m sure i can write something up thx for any help

Share this post


Link to post
Share on other sites
The easist method is to use a little algorithm like this:

  
for DestY := 0 to ImageHeight do
begin
for DestX := 0 to ImageWidth do
begin
{calculate the source pixels based on the scale and our current destination pixel}
SrcY:=DestY/Scale;
SrcX:=DestX/Scale;

{if the source pixel coordinate is within the source image...}
if (SrcX > 0) and (SrcX < ImageWidth) and
(SrcY > 0) and (SrcY < ImageHeight) then
{...copy this source pixel into the destination}
DestImg[DestX][DestY]:=SrcImg[SrcX][SrcY];
end;
end;

That will go through the pixels in the destination image, selecting which pixel to copy from the source.

Share this post


Link to post
Share on other sites