Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Problem with 2d Sprite

Author
Message
j911g
8
Years of Service
User Offline
Joined: 27th Jan 2012
Location:
Posted: 9th Apr 2012 08:00
I'm making a little 2d game for class, and for some reason there is a green border around one of my sprites. I've triple checked the picture and all of it besides the actual object itself is the correct shade of green (0, 255, 0). Anyone have any idea why I might be getting this green border? Any help or advice would be appreciated, thank you!
Fallout
17
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 9th Apr 2012 22:43
Sounds like it's a transparency/anti-aliasing problem. If you have a green background on your sprite and then you have a partial alpha blending around your object within the image, you will get a green border. You need to either have no anti-aliasing in your image (if you're using a green colour key background), so solid sharp full pixel edges. Or if you're using an image with transparency, get rid of the green background and make the background of the image the same pixel a blurred version of the foreground image.

Hope that makes sense.

j911g
8
Years of Service
User Offline
Joined: 27th Jan 2012
Location:
Posted: 10th Apr 2012 19:35
Thank you for the reply! I'm a little new to this, how would I turn off anti-aliasing on a specific image? I'm not sure it applies, my picture I'm using for the sprite is perfectly square and has very defined edges, there is no transparency, I'm just using the color key background.
DeadTomGC
9
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 12th Apr 2012 03:23 Edited at: 12th Apr 2012 03:24
Check the image by using MS paint to spill white paint at some green point on the image. If any green pixels remain, it is an image compression issue. That image will need to be manually fixed. However, in the future this can be avoided by saving your images as 24bit bitmaps or pngs, but pngs sometimes don't work well with the Dark GDK.


Mister Fuzzy
9
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 12th Apr 2012 03:35
Quote: "how would I turn off anti-aliasing on a specific image?"

To turn off DirectX compression on an image, use the dbLoadImage function like this:

See that "1" at the end? That's a boolean value that tells the code to NOT compress, retaining the original image's pixel-perfect quality.

ALIEN(S)!!!!!!!!1!! (and sausages)
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 17th Apr 2012 02:06
Also, make sure your image is not .jpg

jpg images have artifacts. Use .png or something like it.

The fastest code is the code never written.
Fallout
17
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 17th Apr 2012 22:18
If you're still having problems, attach your image to a post and us lot will scrutinize it and figure out what's up!

Login to post a reply

Server time is: 2020-04-08 17:50:43
Your offset time is: 2020-04-08 17:50:43