Erratum in the panda3D Manual

Hi folks !

I was reading the manual about PNMImage ( Creating New Textures from Scratch — Panda3D Manual ) and I found some minor mistakes :

The third paragraph says:

You can get individual RGB values using the getRed(x,y), getGreen(x,y), getBlue(x,y) or getRedVal(x,y), getGreenVal(x,y), getBlueVal(x,y) where x and y tell what pixel to look at (lower-left is 0,0 upper right is getXSize()-1, getYSize()-1 The difference between these functions is that the get*Val functions return a number between 0 and 1 while the get* functions return their value as an integer. For example, if your image uses 8-bit color calling getGreenVal on a green pixel will return 255 and calling getGreen will return 1. You can also get all the RGB information at the same time using getXel(x,y) and getXelVal(x,y) which return a 3-component vector with red in the x, green in the y, and blue in the z.

there is a little mix up in the method, for a black Xel : myImage.get* will return 1.0 where myImage.get*Val will return 255.

Also in the fourth exemple of the page :

Both of these set the origin to gray

myImage.setXelVal(0, 0, gray * 255)
myImage.setXel(0, 0, gray)

But for it to work you have to do it the other way :

Both of these set the origin to gray

myImage.setXelVal(0, 0, gray)
myImage.setXel(0, 0, gray *255)

It’s not a big deal, but I guess you would like to kow :slight_smile:
Cheers !