How to draw2DImage without a specific pixel?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

How to draw2DImage without a specific pixel?

Post by MasterGod »

How to draw2DImage without a specific pixel?
E.g I have a 16x16 image and I want to draw it without the pixel at 8x8, how can I accomplish that?

Thanks.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Frosty Topaz
Posts: 107
Joined: Sat Nov 04, 2006 9:42 pm

Post by Frosty Topaz »

Only thing I can think of is to manually edit the image and remove the pixel.
Frosty Topaz
=========
It isn't easy being ice-encrusted aluminum silicate fluoride hydroxide...
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

by edit, you can always use the lock() and unlock() interface to edit the texture in real time.
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yeah there's no other way to do it really... Technically you could do it by drawing it onto something more complicated than a simple 2 poly quad and have a 1 pixel gap in the quad where you don't want anything drawn but that would be a bit too complicated for your needs and i suspect you might want to not draw any number of pixels instead of just the one at 8x8?

So i reckon you'd have to edit the texture with lock() and unlock(). Maybe you'd want to make a completely new copy of the texture so that you have the original, unedited texture to fall back on, depending on your needs.
Image Image Image
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

bitmask, anyone?
a screen cap is worth 0x100000 DWORDS
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Fair point... :lol:
Image Image Image
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

you can also define a transparent color and set the pixle at 7,7 (for pixle 8,8 ) to this color (with lock/unlock)...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

May I have a code snippet for such thing? I never worked with lock/unlock so I don't know how to use it.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

something like this:

Code: Select all

SColor* colMap = (SColor*)theImage->lock();
// assuming the texture is 16x16 and you want pixle at 7,7
colMap[16 * 7 + 7] = SColor(add transparent color here);
theImage->unlock();
this is a simple example, but you can play around with it... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply