Board index » delphi » changing a 256 color bitmap palette

changing a 256 color bitmap palette

Hello,

how can I change a palette entry of a 256 color bitmap?

thanks

Armindo

 

Re:changing a 256 color bitmap palette


Quote
ADS wrote:

> how can I change a palette entry of a 256 color bitmap?

Earls site has info on thus:

http://www.efg2.com/Lab/Library/Delphi/Graphics/Color.htm

Look under 'Pallete Examples'

--
Charles Hacker
Lecturer in Electronics and Computing
School of Engineering
Griffith University - Gold Coast
Australia

Re:changing a 256 color bitmap palette


This topic got a good airing last month under "How can I change a color
in a bitmap palette ?"

Here is how to load a 256 bitmap, change the first palette entry to
blue and display the changed bitmap.

Var
  bmp: TBitmap;
  NewCol: TRGBQuad;
begin
  bmp := TBitmap.Create;
  bmp.LoadFromFile('chemical.bmp');

  NewCol.rgbBlue := 255;
  NewCol.rgbGreen := 0;
  NewCol.rgbRed := 0;
  NewCol.rgbReserved := 0;

  SetDIBColorTable(bmp.Canvas.Handle, 255, 1, NewCol);

  Image1.Picture.Graphic:= bmp;
  bmp.Free;
end;

Bob
---
Sent using Virtual Access 5.01 - download your freeware copy now
http://www.atlantic-coast.com/downloads/vasetup.exe

Re:changing a 256 color bitmap palette


thanks

Armindo

Quote
> This topic got a good airing last month under "How can I change a color
> in a bitmap palette ?"

> Here is how to load a 256 bitmap, change the first palette entry to
> blue and display the changed bitmap.

> Var
>   bmp: TBitmap;
>   NewCol: TRGBQuad;
> begin
>   bmp := TBitmap.Create;
>   bmp.LoadFromFile('chemical.bmp');

>   NewCol.rgbBlue := 255;
>   NewCol.rgbGreen := 0;
>   NewCol.rgbRed := 0;
>   NewCol.rgbReserved := 0;

>   SetDIBColorTable(bmp.Canvas.Handle, 255, 1, NewCol);

>   Image1.Picture.Graphic:= bmp;
>   bmp.Free;
> end;

> Bob
> ---
> Sent using Virtual Access 5.01 - download your freeware copy now
> http://www.atlantic-coast.com/downloads/vasetup.exe

Other Threads