View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038147 | Lazarus | LCL | public | 2020-11-28 20:21 | 2020-11-30 21:53 |
Reporter | Maurizio | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 2.0.10 | ||||
Summary | 0038147: TBitmap.SetPalette does nothing | ||||
Description | Assignment of a palette to TBitmap.Palette (i.e. the call to TBitmap.SetPalette) doesn't work. The program executes immediately the ancestor TGraphic.SetPalette that's a simple placeholder (i.e. does nothing). | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
LazTarget | - | ||||
Widgetset | Win32/Win64 | ||||
Attached Files |
|
|
What is the color depth for the image? LCL asks for the palette info in raw image data for 4-bit and 8-bit only. |
|
Color depth tried: pf1bit, pf4bit, pf8bit N.B. The same code works perfectly in Delphi |
|
Inheritance tree: TGraphic -> TRasterImage -> TCustomBitmap -> TFPImageBitmap -> TBitmap The only one that "implements" SetPalette is TGraphic but, as I wrote, only as an abstract procedure. SetPalette must be implemented somewhere in between, possibly in TCustomBitmap where already GetPalette is overrided. |
|
> N.B. The same code works perfectly in Delphi Which code? Can you please upload a simple example to reproduce the problem. |
|
Well: whatever use of the assignment of a palette to a bitmap is faulty. Anyway, a stupid example: var ImageBitmap: TBitmap; procedure SetPalette; const MaxPaletteColors = 256; var LocalPalette: PLogPalette; Color: integer; begin GetMem(LocalPalette, Sizeof(TLogPalette) + Sizeof(TPaletteEntry)*(MaxPaletteColors - 1)); LocalPalette.palVersion:=$300; LocalPalette.palNumEntries:=MaxPaletteColors; for Color:=0 to Pred(MaxPaletteColors) do begin LocalPalette.palPalEntry[Color].peRed:=Color; LocalPalette.palPalEntry[Color].peGreen:=Color; LocalPalette.palPalEntry[Color].peBlue:=Color; LocalPalette.palPalEntry[Color].peFlags:=0; end; ImageBitmap.Palette:=CreatePalette(LocalPalette^); FreeMem(LocalPalette); end; { SetPalette } begin ImageBitmap:=TBitmap.Create; SetPalette; ImageBitmap.Free; end. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-11-28 20:21 | Maurizio | New Issue | |
2020-11-28 22:14 | Don Siders | Note Added: 0127248 | |
2020-11-28 22:21 | Maurizio | Note Added: 0127249 | |
2020-11-28 22:23 | Maurizio | Note Edited: 0127249 | View Revisions |
2020-11-29 11:31 | Maurizio | Note Added: 0127254 | |
2020-11-30 17:29 | Juha Manninen | Note Added: 0127269 | |
2020-11-30 18:00 | Bart Broersma | Status | new => feedback |
2020-11-30 18:00 | Bart Broersma | LazTarget | => - |
2020-11-30 21:53 | Maurizio | Note Added: 0127282 | |
2020-11-30 21:53 | Maurizio | Status | feedback => new |