I have a PNMImage that I’m using to control the visibility of a map. Specifically, I’m setting pixel-alpha values to hide or reveal map-tiles. (If I recall correctly; it’s been a little while since I implemented this, and I am tired tonight.)
I was confident that I had this working–but attempting to use the system tonight, I found that it consistently crashed with an assertion error along the following lines:
AssertionError: _alpha != nullptr && x >= 0 && x < _x_size && y >= 0 && y < _y_size at line 560 of built1.10/include/pnmImage.I
The exact line-number varies with the method called, but the assertion-check itself doesn’t seem to do so.
This only seems to happen when I attempt to access or set an alpha-value, such as by “getAlphaVal” or “setAlpha”. Attempts to access grey-scale values succeed with no assertion errors. The coordinates that I’m passing in seem to be valid. (For example, I’ve tried “getGrayVal” with the same coordinates as used for “getAlphaVal”, and had the call succeed.)
The following is the code that I use to initialise the image; it does look like it’s being run, and isn’t crashing:
self.coverImage = PNMImage(2048, 2048, 3)
self.coverImage.alphaFill(1)
self.coverImage.fill(1)
(I have tried changing the third parameter in the constructor to “4”, to no avail.)
Has something perhaps changed recently in PNMImage that might account for it not working? Or is there something that I might be doing wrong?
It is of course possible that I’ve changed something somewhere and forgotten about it–but if so, then, well, I’ve forgotten about it. ^^;