Board index » delphi » 16 Colour Bitmaps Problem

16 Colour Bitmaps Problem

Note the following:-

var
  bitmap:tbitmap;
begin
  bitmap:=tbitmap.create;

  bitmap.width:=100;
  bitmap.height:=100;

  { DO SOME SIMPLE DRAWING ON THE CANVAS INVOLVING
  { DRAWING LINES USING ABOUT 6 COLOURS (All of which
    are 'standard' colours) }

  bitmap.savetofile('TEST.BMP');

  bitmap.free;
end;

I have no problem with the above code, but the resulting
file that is generated is in 16 million colours, which
results in a large BMP file.

Is there any way of setting the bitmap to 16 colours
when i create the bitmap, or when i save it to file.

PS: I am using DELPHI 1.

--

-------------------------------------------------------
   Richard Hosking, BSC (Hons) Software Eng, Year 2
   EMAIL:  se9...@dmu.ac.uk
   WWW Home Page:  http://www.cms.dmu.ac.uk/~se95rh/
   US WWW Page:  http://members.tripod.com/~rhosking
-------------------------------------------------------

 

Re:16 Colour Bitmaps Problem


Quote
Richard Hosking wrote:

> Note the following:-

> var
>   bitmap:tbitmap;
> begin
>   bitmap:=tbitmap.create;

>   bitmap.width:=100;
>   bitmap.height:=100;

>   { DO SOME SIMPLE DRAWING ON THE CANVAS INVOLVING
>   { DRAWING LINES USING ABOUT 6 COLOURS (All of which
>     are 'standard' colours) }

>   bitmap.savetofile('TEST.BMP');

>   bitmap.free;
> end;

> I have no problem with the above code, but the resulting
> file that is generated is in 16 million colours, which
> results in a large BMP file.

> Is there any way of setting the bitmap to 16 colours
> when i create the bitmap, or when i save it to file.

        Not with TBitmap.SaveToFile. (Unless you're running on
a 16-color system - then TBitmap.SaveToFile will save 16-color
bitmaps whether you want it to or not.)

--
David Ullrich

?his ?s ?avid ?llrich's ?ig ?ile
(Someone undeleted it for me...)

Other Threads