Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Free TBitmap palette

Status
Not open for further replies.

bobbie100

Programmer
Aug 29, 2003
64
GB
I have some code for converting a color bitmap to 8-bit grayscale bitmap (GrayBmp: TBitmap) which includes the following:
Code:
var
  GrayPalette: TMaxLogPalette;
begin
  GrayBmp.PixelFormat := pf8Bit;
  SetGray256Palette(GrayPalette);  // Set palette colors
  GrayBmp.Palette := CreatePalette(PLogPalette(@GrayPalette)^);
My question is about freeing the palette after I finish with GrayBmp.

Do I need to separately do a DeleteObj(GrayBmp.Palette) before GrayBmp.Free or does GrayBmp.Free take care of it?

Bob
 
You can try a

Code:
FreeAndNil(GrayPalette);




------------------------------------
There's no place like 127.0.0.1
------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top