#19198: [wxMSW & wxX11] Why the index limit of a wxPalette in wxPalette::GetRGB is
only 256 thuogh it accepts any arbitrary length in the construction!
------------------------+------------------------------------------
Reporter: tomay3000 | Owner:
Type: defect | Status: closed
Priority: lowest | Milestone:
Component: wxMSW | Version: dev-latest
Resolution: invalid | Keywords: wxPalette, palette, RGB, 256
Blocked By: | Blocking:
Patch: 1 |
------------------------+------------------------------------------
Changes (by tomay3000):
* priority: normal => lowest
* cc: tomay3000@… (added)
* patch: 0 => 1
Comment:
Replying to [comment:3 vadz]:
> Sorry, I don't understand what is this about, i.e. what exactly is the
bug. The code in wxMSW version of `wxPalette` looks weird (i.e. I don't
know what is this 255 doing there).
That is exactly the problem, 255 has nothing to do there. And I have
uploaded a fix patch for it.
----
> but I have no idea how to reproduce the problem if there is one.
{{{
const unsigned char *pR;
const unsigned char *pG;
const unsigned char *pB;
// Init and Fill pR, pG and pB.
...
// Create the palette.
wxPalette palette(1000, pR, pG, pB);
// Get an RGB colour of an index greater than 255.
// [this is the bug].
// wxPalette::GetRGB() will return false.
}}}
----
> this class which is absolutely useless nowadays as nobody uses palette-
based video modes anyhow since many years.
At least, my first thought before I later decide to use
`std::vector<wxColour>` instead was to use it, somebody else may in the
future.
----
> If you want to store colours, using `std::vector` is perfectly fine and
definitely better than a platform-dependent (!) class for doing it.
That's exactly what I did when I discovered the bug.
TIA.
--
Ticket URL: <
https://trac.wxwidgets.org/ticket/19198#comment:4>