News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Support for Custom Image Depths

Started by kevin, January 25, 2006, 12:37:59 PM

Previous topic - Next topic

kevin

 This picture shows 4 images.  Normally images default to the same depth as the current display mode.   This occurs, so there's no conversion during rendering.  However, some times it might be handy to create images of a specific custom depth, regardless of which the current display depth is.  Which is what is shown here.

Each image is in a different format, each have the some triangles drawn to them,  then they're drawn to the screen.  It's very handy for me to double check the render modes are working !

Please note,  While you can perform vector operations directly to these buffers, if you want to draw rotated/alpha etc  images, to them, then the images will need to be of the same depth.  

  One use would be for creating image conversion routines.  These routines could work on custom 32bit buffers.  Thus avoiding the colour loss issue when played on 15 or 16bit  displays.  

PlayBASIC V1.12


Cls 255
w=200
h=300

; create a 15bit (555) FX buffer
CreateFXimageEx 1,w,h,15

; create a 16bit (565 ) FX buffer
CreateFXimageEx 2,w,h,16

; create a 24bit (888 RGB) FX buffer
CreateFXimageEx 3,w,h,24

; create a 32bit (8888 - ARGB) FX buffer
CreateFXimageEx 4,w,h,32


c1=0
c2=255
c3=$00ff00
c3=$ff0000

RenderToImage 1
For lp=0 to 100
 c=rndrgb()
 x=rnd(w)
 y=rnd(h)
 x2=rnd(w)
 y2=rnd(h)
 x3=rnd(w)
 y3=rnd(h)
 r=rnd(w/3)

 For Img=1 to 4
  RenderToImage Img
  gouraudtri x,y,c1,x2,y2,c2,x3,y3,c3  
 Next

Next

rendertoscreen

For Img=1 to 4
 x=(w+10)*(img-1)
 y=100
 Drawimage img,x,y,0
 text x,y,getimagedepth(img)
Next


Sync
waitkey