Removing glow around pictures

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Removing glow around pictures

Post by LeonBlade »

Why don't you instead just use transparency and use SDL Image and use IMG_Load?
There's no place like ~/
User avatar
xiphirx
Chaos Rift Junior
Chaos Rift Junior
Posts: 324
Joined: Mon Mar 22, 2010 3:15 pm
Current Project: ******** (Unkown for the time being)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Removing glow around pictures

Post by xiphirx »

LeonBlade wrote:Why don't you instead just use transparency and use SDL Image and use IMG_Load?
FUCKIN' LIBRARIES, HOW DO THEY WORK?


I guess it has something to do with speed. Although I would think that reading in an image, removing the keyed color, and then displaying takes more time than just loading an image and displaying it without removing keyed colors (alpha pixels) unless there's some sort of surface merging going on (probably is).
StarCraft II Zerg Strategy, open to all levels of players!

Looking for paid work :< Contact me if you are interested in creating a website, need a web design, or anything else you think I'm capable of :)
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Removing glow around pictures

Post by LeonBlade »

xiphirx wrote:
LeonBlade wrote:Why don't you instead just use transparency and use SDL Image and use IMG_Load?
FUCKIN' LIBRARIES, HOW DO THEY WORK?


I guess it has something to do with speed. Although I would think that reading in an image, removing the keyed color, and then displaying takes more time than just loading an image and displaying it without removing keyed colors (alpha pixels) unless there's some sort of surface merging going on (probably is).
I don't even...

I just use IMG_Load myself... too much hassle with the whole color key bull shit.
There's no place like ~/
pritam
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 991
Joined: Thu Nov 13, 2008 3:16 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Amiga, PSOne, NDS
Programming Language of Choice: C++
Location: Sweden

Re: Removing glow around pictures

Post by pritam »

Why not just load it as a texture with alpha support? That is afaik not slow as hell. And 3D isn't that much harder.
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: Removing glow around pictures

Post by K-Bal »

omg, you guys have problems I did not even know about ;)

PNG + SFML = No artifacts + Hardware Acceleration
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Removing glow around pictures

Post by Ginto8 »

K-Bal wrote:omg, you guys have problems I did not even know about ;)

PNG + SFML = No artifacts + Hardware Acceleration
lol. I just use SDL for image loading & padding, then render with OpenGL, but I guess I'm okay with a fanboy =P
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Removing glow around pictures

Post by Falco Girgis »

Loading a texture with alpha support is absolutely not "slow as hell." I'm not sure how exactly SDL handles it (without hardware acceleration). I will have to look into whether it's emulating the transparency or using the hardware, but it's a waaaaaaaaaay cleaner solution than color masking. That shit is soooo outdated.

In the hardware accelerated world, you never see that. Textures are just saved with transparency, and it's way less hassle.
qpHalcy0n
Respected Programmer
Respected Programmer
Posts: 387
Joined: Fri Dec 19, 2008 3:33 pm
Location: Dallas
Contact:

Re: Removing glow around pictures

Post by qpHalcy0n »

So far as the hardware is concerned, it's merely an additional operation that involves a few lerps or simple accumulation depending on the blend mode. The only thing you SHOULD be sacrificing here is the 1 to 32 bits of space (depending on image format) to store the alpha. You DO take a small hit from even enabling alpha blending for hardware accelerated API's but it's nothing to shake a stick at.

If its ridiculously slow, then SDL would be emulating it in software in which you must do this for every pixel that passes any scissoring or depth/backface culling, for every primitive for every pass and it would involve a read from the destination buffer. In this case...absolutely yes, it would be just retardedly slow without any optimization.
User avatar
Bakkon
Chaos Rift Junior
Chaos Rift Junior
Posts: 384
Joined: Wed May 20, 2009 2:38 pm
Programming Language of Choice: C++
Location: Indiana

Re: Removing glow around pictures

Post by Bakkon »

LeonBlade wrote:Why don't you instead just use transparency and use SDL Image and use IMG_Load?
This... this is what I suggested... :x
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Removing glow around pictures

Post by Falco Girgis »

qpHalcy0n wrote:If its ridiculously slow, then SDL would be emulating it in software in which you must do this for every pixel that passes any scissoring or depth/backface culling, for every primitive for every pass and it would involve a read from the destination buffer. In this case...absolutely yes, it would be just retardedly slow without any optimization.
Yeah, that's along the lines of what I was thinking.

If I recall correctly (from my teenage days of dicking with SDL), one of the results returned from the SDL hardware checks is alpha blending support. I'm fairly certain it is hardware accelerated--but I'm pretty sure that if this is not available, SDL definitely emulates.

...In this day and age though... if somebody's hardware doesn't support alpha blending, they can deal with shitty CPU emulation, imo. ;)
Post Reply