Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » reading off the bitmap

Credits go to Evert, LennyLen, Onewing, and Richard Phipps for helping out!
This thread is locked; no one can reply to it. rss feed Print
reading off the bitmap
William Labbett
Member #4,486
March 2004
avatar

hi,
i've got this here code :-

tile_type2 = _getpixel(map, x, y - 2)

while y < 2, the coordinates are off the bitmap. the docs say _getpixel() returns
-1 in such cases but in my program i get a crash as this line is executed.
I'm a bit puzzled.
tile_type2 is an int. I assume an int can hold a signed value. Is this right.

please help

LennyLen
Member #5,313
December 2004
avatar

Quote:

I assume an int can hold a signed value. Is this right.

Yes. Unless you've declared it to be unsigned.

Richard Phipps
Member #1,632
November 2001
avatar

I don't think _getpixel does any bounds checking. Try getpixel instead.

Evert
Member #794
November 2000
avatar

Quote:

the docs say _getpixel() returns -1 in such cases

They most definately do not:

man _getpixel said:

These
won't work in mode-X, and don't do any clipping, so you must make sure
the point lies inside the bitmap.

You're confused with getpixel().

LennyLen
Member #5,313
December 2004
avatar

Grrrrrr, at the bug that causes underscores to not show up (is this a forum bug, or browser bug?). I thought he WAS using getpixel():

{"name":"590176","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/b\/1b22c6d1449bdeb7fa4c73e3c5a371cc.jpg","w":353,"h":50,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/b\/1b22c6d1449bdeb7fa4c73e3c5a371cc"}590176

Evert
Member #794
November 2000
avatar

Quote:

is this a forum bug, or browser bug?

I have no idea what you're talking about. I can see underscores just fine... maybe check your font settings.

Richard Phipps
Member #1,632
November 2001
avatar

The underscore shows up fine here too.

William Labbett
Member #4,486
March 2004
avatar

Thanks

I supposed because getpixel() checkedl, _getpixel would too.
I'll let you know how I get on (so if someone would kindly bump for me?).

Thanks :)

LennyLen
Member #5,313
December 2004
avatar

Quote:

I have no idea what you're talking about. I can see underscores just fine... maybe check your font settings.

I know I'm not the only person affected by this, as I've seen other mention it before. It's not a font problem, as sometimes the underscore is visible, and at other times not. This only occurs on underscores on hyperlinks, and it could be an Opera bug, as it looks fine with FF, but I've only ever seen it occur on this forum.


testing_testing

[edit]I can see the above underscore no problem, but the original is still not visible.

Onewing
Member #6,152
August 2005
avatar

Yeah, I couldn't see the underscores either. Using Opera.

------------
Solo-Games.org | My Tech Blog: The Digital Helm

William Labbett
Member #4,486
March 2004
avatar

thanks for the help, it's working now.

Go to: