Main Menu

Deano's 2009 Compo Blog

Started by Deano, November 16, 2009, 04:49:18 PM

Previous topic - Next topic

Deano

Kevin both images 'colour depth' is set at 24 bit....???
"Black holes are a result of God dividing the universe by zero."-Steven Wright

kevin

#31
  Well, when you load an AFX image, then internally this image surface is 32bit regardless of the system display depth.  So it's uses  8bit A, 8 bit R, 8bit G, 8bit B (8888=32bit).   However, what you need to be aware of, is that if you draw  32bit surface to another surface depth (that isn't 32bit).  Such as the screen in this case, with is 16bit as per the open screen command.  Then the 32bit pixels are remapped to the whatever the destination surface format is.

  In 16bit there's two supported formats 15bit  (1555) ARGB (1bit alpha, 5 bits R, 5 bits,G,5 bits Blue) and the other is 16bit (565), which is Alpha=0, R=5 bits, Green = 6 bits, Blue = 5 bits.  

 Upon closer inspection,  you seem to want to draw blend two AFX images together and get an AFX result.  Only way to do this is manually, create the merge on a 32bit surface.    However, when you draw a AFX image over another surface the all channels blended together.   SO even if both surfaces are 32bit, the contents of the A channel are not reliable.  So you'd have to mask the original A channel back onto the new image.

 something like this

PlayBASIC Code: [Select]
global screenw=800
global screenh=600

OpenScreen screenw,screenh,16,2


loadafximage "tt.png",10
loadafximage "face.png",11
DRAWplayer(10)
rendertoscreen
Do
cls rgb(128,233,255)
for i= 1 to 4
drawimage i,i+(80*i),200,1
print getimagedepth(i)
next
drawimage 10,300,300,1
drawimage 11,300,300,1
Sync
loop


Function DRAWplayer(IMG)
RotAngle#=0

w=80
h=80

for II=1 to 4

createfximageex ii,w,h,32
rendertoimage ii
drawimage 10,0,0,0 ; copy image to dest

; create rotated temp surface
createfximageex 1000,w,h,32
rendertoimage 1000

CopyRect ii,0,0,w,h,1000,0,0
; strip the RGB channels and leave the A channel
rgbmaskimage 1000,$ff000000

rendertoimage ii

; blend it with the dest
DrawRotatedImage 11,w/2,h/2,RotAngle#,1,1,w/-2,h/-2,1

; merge the original alpha channel with the combined image
dim row(w)
for ylp=0 to h-1
rendertoimage 1000
lockbuffer
for xlp=0 to w-1
row(xlp)=point(xlp,ylp)
next
unlockbuffer

rendertoimage ii
inkmode 1+512
lockbuffer
for xlp=0 to w-1
dotc xlp,ylp,row(xlp)
next
unlockbuffer
next
prepareafximage ii

inkmode 1
RotAngle#=WrapAngle(RotAngle#,90)
next
rendertoscreen

Endfunction


   


 

Deano

Thanks kevin, that works great!  I've spent way to much time trying to figure that out(ask my wife ::))
"Black holes are a result of God dividing the universe by zero."-Steven Wright

kevin


I can imagine :). .  There really needs to be channel merge command of such situations.

Deano

 :-[ I'm out of the competition , my computer finally DIED. I'm trying to build a new one, with old parts, with very little progress. I'm writting this on my kids PS3. Good luck to all and I'll be back


Deano 8)Error Missing Closing Square Bracket
"Black holes are a result of God dividing the universe by zero."-Steven Wright

micky4fun

Hi Deano,

well no one here likes to here that your out of compo  :'(, bad news mate , hope you get a p.c made up as soon as you can and get the time to get game to an end version state , with all that work ile be a bit cheesed off now ,

well good luck with building an other p.c with your old parts , and see you back here very soon..

mick :)

Deano

Got my puter back up sort-of, got to run in safe mode and I somehow ruined my 3d video card.
I'm going to keep plugging away. I'm having a little trouble with mini-game ideas, I thought I grasped the concept until I saw the other entries. Oh well I'll keep working.

Deano
"Black holes are a result of God dividing the universe by zero."-Steven Wright

BlinkOk

woot! that's awesome. really looking forward to this one

kevin

QuoteI thought I grasped the concept until I saw the other entries.

   I wouldn't let your self get too influenced by the others here.  While there's a some nice screen shots/blogs tidbits, but i'm too sure how well they all fit the competition guidelines.    But we'll see I guess, that is assuming they get their entries finished.. 


BlinkOk

if an entry did not fit the guidelines i would hope that you would advise them of it.

kevin

  I'm referring to the scope.   Contestants are meant to run theme clarification though  Here 


BlinkOk

vague. if you suspect that someone is outside the guidelines in any way it would be in your interest to advise them.

Deano

well now I completely, totally out of the compo. My computer froze and now it won't respond AT ALL. What do you want with a 10 year old computer. Well thanks for your support and i'll be back sometime after christmas when I get a new computer.


Thanks Again
Deano
"Black holes are a result of God dividing the universe by zero."-Steven Wright

LemonWizard