home *** CD-ROM | disk | FTP | other *** search
/ DarkBasic Professional / DarkBasicPro.iso / data1.cab / Lang_Files_(English) / Help / examples / bitmap / bitmap2-example.dba < prev    next >
Encoding:
Text File  |  2004-09-22  |  2.0 KB  |  69 lines

  1. rem Bitmap Functionality
  2.  
  3. rem Load Simple Bitmap to Screen
  4. load bitmap "foliage.jpg" : sleep 2000
  5. cls : sleep 100
  6.  
  7. rem Load Bitmap into Offscreen Bitmap
  8. BitmapNumber=0
  9. OffscreenBitmapNumber=1
  10. load bitmap "foliage.jpg",OffscreenBitmapNumber
  11. if bitmap exist(OffscreenBitmapNumber)=1
  12.  copy bitmap OffscreenBitmapNumber,BitmapNumber : sleep 2000
  13. endif
  14. set current bitmap 0
  15. cls : sleep 100
  16.  
  17. rem Stretch Copy A Bitmap
  18. SecondBitmap=2
  19. load bitmap "foliage.jpg",SecondBitmap
  20. if bitmap exist(SecondBitmap)=1
  21.  copy bitmap SecondBitmap,0,0,640,480,BitmapNumber,0,0,100,480 : sleep 2000
  22.  copy bitmap SecondBitmap,0,0,320,240,BitmapNumber,320,240,640,480 : sleep 2000
  23.  copy bitmap SecondBitmap,0,240,320,480,BitmapNumber,100,100,540,380 : sleep 2000
  24. endif
  25. set current bitmap 0
  26.  
  27. rem Flip and Mirror a Bitmap
  28. if bitmap exist(BitmapNumber)=1
  29.  flip bitmap BitmapNumber : sleep 2000
  30.  mirror bitmap BitmapNumber : sleep 2000
  31. endif
  32.  
  33. rem Fade and Blur a Bitmap
  34. FadeValue=50 : BlurLevel=2
  35. if bitmap exist(BitmapNumber)=1
  36.  blur bitmap BitmapNumber,BlurLevel : sleep 2000
  37.  fade bitmap BitmapNumber,FadeValue : sleep 2000
  38. endif
  39.  
  40. rem Draw to offscreen bitmap
  41. DrawBitmapNumber=3
  42. create bitmap DrawBitmapNumber,300,300
  43. if bitmap exist(DrawBitmapNumber)=1
  44.  set current bitmap DrawBitmapNumber
  45.  circle 150,150,40
  46.  set current bitmap BitmapNumber
  47.  if current bitmap()=BitmapNumber
  48.   copy bitmap DrawBitmapNumber,BitmapNumber
  49.  endif
  50. endif
  51.  
  52. rem Show Bitmap Data
  53. print "BITMAP DATA"
  54. print
  55. print "exist:";bitmap exist(BitmapNumber)
  56. print "width:";bitmap width(BitmapNumber)
  57. print "height:";bitmap height(BitmapNumber)
  58. print "depth:";bitmap depth(BitmapNumber)
  59. print "mirrored:";bitmap mirrored(BitmapNumber)
  60. print "flipped:";bitmap flipped(BitmapNumber)
  61.  
  62. rem Delete Bitmaps
  63. if bitmap exist(OffscreenBitmapNumber)=1 then delete bitmap OffscreenBitmapNumber
  64. if bitmap exist(SecondBitmap)=1 then delete bitmap SecondBitmap
  65. if bitmap exist(DrawBitmapNumber)=1 then delete bitmap DrawBitmapNumber
  66.  
  67. rem Wait for user keypress
  68. wait key
  69.