2
0

func_graphics_max2d_createimage.rst 1012 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. .. _func_graphics_max2d_createimage:
  2. ===========
  3. CreateImage
  4. ===========
  5. CreateImage -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. CreateImage:TImage( width,height,frames=1,flags=-1 )
  10. Create an empty image
  11. #CreateImage creates an 'empty' image, which should be initialized using either #GrabImage or #LockImage
  12. before being drawn.
  13. Please refer to #LoadImage for valid @flags values. The @flags value is always combined with DYNAMICIMAGE.
  14. Parameters
  15. ==========
  16. Return Values
  17. =============
  18. A new image object
  19. Examples
  20. ========
  21. .. code-block:: blitzmax
  22. ' createimage.bmx
  23. ' creates a 256x1 image with a black to blue color gradient
  24. Const ALPHABITS=$ff000000
  25. Graphics 640,480,32
  26. image=CreateImage(256,1)
  27. map=LockImage(image)
  28. For i=0 To 255
  29. WritePixel(map,i,0,ALPHABITS|i)
  30. Next
  31. UnlockImage(image)
  32. DrawImageRect image,0,0,640,480
  33. DrawText "Blue Color Gradient",0,0
  34. Flip
  35. WaitKey
  36. See Also
  37. ========