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
`by pizzaman
flush video memory
sync on
sync rate 0
picwidth=25
picheight=29
depth=32
cls rgb(100,100,100)
`image is 830 by 300 - however not using all of it at the minute
load image "ships.bmp",100,1
make memblock from image 100,100
for a=1 to 26
`create header for memblock
make memblock a,2912
write memblock dword a,0,picwidth
write memblock dword a,4,picheight
write memblock dword a,8,depth
`830*4=3320, 26*4=104, 25*4=100
for a1=0 to 28
`copy the relevant chunks of data
copy memblock 100,a,(12 + (a1*3320) + ((a-1)*104)),(12 + (a1*100)),100
`check to see if this black (i know theres a more efficient way of doing this
`but this is for test purposes only)
for a2=0 to 24
if memblock byte(a,(12+((a2*4))+(a1*100)))=0 and memblock byte(a,(13+((a2*4))+(a1*100)))=0 and memblock byte(a,(14+((a2*4))+(a1*100)))=0
write memblock byte a,(15+(a2*4)+(a1*100)),255
endif
next a2
next a1
`make the image
make image from memblock a,a
next a
do
if spacekey()=1 then exit
cls rgb(100,100,100)
`display the images (one currently gets placed offscreen)
for a=1 to 24
paste image a,(a-1)*26,0
next a
`display what some BGRA colours are in memblock 1
for a =0 to 11
text 10,10+(a*20),str$(memblock byte(1,12+a))
next a
`show FPS
text 20,500,str$(screen fps())
sync
loop
for a=1 to 26
delete memblock a
delete image a
next a
delete memblock 100
delete image 100
flush video memory
end
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