Believe it or not, there are at least five different problems with that seemingly simple program.
- If you construct a color with Blue = dbRGB(0,0,255) and then try to compare it with the color returned by dbPoint, there is a good chance that they will never be equal. That's because dbRGB adds an alpha component to the created colour, but dbPoint does not add the alpha, so even if the colour is matching, the value will not match. (I remember reading on the forum that it may or may not add alpha depending on the operating system and bitmap version, but I'm not sure.) To solve this, I suggest comparing the individual colour parts:
if (red == 0 && green == 0 && blue == 255)
2. pixelColor=dbPoint(x,0); should be pixelColor=dbPoint(x,y);
otherwise you only check the first row repeatedly, not the whole picture.
3. dbDot(blue, green, red); is a mistake. The parameters of dbDot are: x, y, color. So the first two integers that you give to the function are interpreted as coordinates, not as colour, and the position of the dot will be wrong. Correct this to:
dbDot(x, y, dbRGB(blue, green, red));
4. EDIT: Disregard this. I was referring to a bug with dbDot not working, but it seems that it works now... at least in this program. Anyway, post again if you have a problem with dbDot (or dbCircle) on your machine.
5. Nothing is drawn if you don't use dbSync() to update the screen. I suggest to sync after every processed line (not after every pixel because that will be VERY slow):
for (int y=0;y<height;y++)
{
for(int x=0;x<width;x++)
{
// processing...
}
dbSync();
}
When all that is done, the program should finally work.