Permalink

0

Bitmaps: Accessing Big Images

Luis Antonio wrote in message
news:7ksu6u$
c3l14@forums.borland.com…

> Hello:
>
> I’m making a cartographic program that use an TImage with an
> cartographic map image in jpeg format as background. This map is inside a
> scrollbox because is 3500 x 906 pixels (900 Kb) or 6890 x 1790 (3819 Kb).
By
> its quality the second is preferable.
>
> The user will be able to move the map arround, will be able to
make
> searches and will be able to move the mouse over the cities and to know
> information about them. By these reasons the program will have to be
faster
> and agile.
>
> Could somebody advise some component to me better than TImage?
Some
> other advise?
>
> Thanks in advance:
>
> —————–
> Luis Antonio
>

Hi. I have the same problem with images that use 15Mg, you need to make a
program that cut the jpeg in (for example) 6×10 jpeg files.
Then READ ALL the new jpegs. The diferent is that the pc will need less
memory to descompress the images, and it will be very faster.

When i do this i pass, from 60 seconds to load the bigimage, to 4 seconds.
You need to test in how many parts cut it.

use a code like this:

function
const
 cx=3;
  cy=6;
var
  xx,yy,ax,ay,n,p:integer;
  j:tjpegimage;
  b,bs:tbitmap;
begin
 dt:=now;
  j:=tjpegimage.create;
  b:=tbitmap.create;
  bs:=tbitmap.create;
  for n:=1 to 20 do
    begin
      j.LoadFromFile();
      b.assign(j); {you need to assign it to a bitmap, so you can work on
it}

      xx:=b.width div cx;
      yy:=b.height div cy;
      bs.width:=xx; bs.height:=yy;
      for ax:=0 to cx-1 do
       for ay:=0 to cy-1 do
        begin
        bs.canvas.draw(-xx*ax,-yy*ay,b);
          j.Assign(bs);

j.savetofile(‘c:\sal\n’+inttostr(n)+‘p’+inttostr(p)+‘p’+inttostr(ay)+‘.’+int
tostr(ax));
        end;
    end;
  b.free;
  bs.free;
  j.free;
end;

If it’s slowly, you can only read the parts that the user is seeing, plus
the corners.

[tags]Delphi, Graphic[/tags]

Hinterlasse eine Antwort

Pflichtfelder sind mit * markiert.