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.

2D All the way! / Alpha channel problem? or my PC?

Author
Message
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 12th Jun 2004 00:50 Edited at: 12th Jun 2004 02:46
hey all

The problem:
When the image is pasted to the screen the bits which should be invisble are opaque.


What i'm trying to do:
I load an image in the .bmp format, then make a memblock from that image. I then create 26 smaller memblocks and basically transfer chunks of data from the image's memblock to the smaller memblocks, in other words a fast picture grabber. However, i change the alpha values in the memblock to make any black parts ( rgb(0,0,0) ) to have an alpha setting of 255- invisible; then make the memblock to an image and paste it to the screen.
Now i know i can do this process using the color key command and putting the extra flag on the paste image command, but i want to be able to have multiple colours to be invisible or transparent eventually.

if you want to see whether this works on your pc you'll need an image called s"hips.bmp" with size of 830 by 300 with some black in it - rgb(0,0,0), and sorry if the code is messy or inefficient it's only test code



What i've tried so far:
using load bitmap, and make memblock from bitmap
using sprites to display the images
texturing a plain with the image

Also i've tried loading in a .png with a part of it being invisible but the invisble parts came out opaque in DBpro, and yet in other programs it's invisible.

Additional info-
my screen resolution in DBpro and normal resolution is 800,600,32
i have the latest drivers for my graphics card
i know the sequence of colour values in memblocks is BGRA

processor : Pentium 4 1.5GHz
video card: ati Radeon 7000/Radeon VE - 32Mb DDR memory
hard drive: 20Gb - 4Gb free
RAM : 256Mb

Any help will be well appreciated

pizzaman
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Jun 2004 15:31
An alpha setting of 255 is *not* invisible - just the opposite in fact. Set it to zero instead.

Is there any reason why you are using memblocks to do this? Why not load the bmp to a secondary bitmap, grab the image using the GET IMAGE command, then delete the bitmap?

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 12th Jun 2004 16:27
speed?

Quote: "in other words a fast picture grabber."


may be faster than the default commands.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster, ups.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Jun 2004 16:37
Not really. Images are stored in video memory, just as bitmaps are. Images also have the mipmapping generated for them, making them slower to load.

I would assume that grabbing the image with the assistance of the graphics accelleration would be faster than bringing the details back to the processor and then feeding them back to the card later. I could be wrong though - I haven't tested it.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 12th Jun 2004 17:20 Edited at: 12th Jun 2004 20:45
hey

i tried setting the alpha to zero but it still wasn't invisible

has anyone else got any other ideas

EDIT

Could someone please try this code to see if it works no media needed. If it works there should be a white box with a box the same colour as the background at the centre of it. Note you will need to be in a display mode with a depth of 32 bits.



Please post your results back. Thank you

Also for some reason my .png files don't show there transparency (if you no what i mean) even when i just load and paste them without altering any memblocks could this be the source of the problem.



END OF EDIT

pizzaman

Login to post a reply

Server time is: 2026-06-09 13:55:54
Your offset time is: 2026-06-09 13:55:54