pixelformat.monkey2 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Namespace std.graphics
  2. #rem monkeydoc Pixel formats supported by pixmaps.
  3. | PixelFormat | Description
  4. |:--------------|:-----------
  5. | `Unknown` | Unknown pixel format.
  6. | `I8` | 8 bit intensity.
  7. | `A8` | 8 bit alpha.
  8. | `IA8` | 8 bit intensity, alpha.
  9. | `RGB8` | 8 bit red, green, blue.
  10. | `RGBA8` | 8 bit red, green, blue, alpha.
  11. Note: The `IA16`, `RGB24` and `RGBA32` formats have been deprecated in favor of `IA8`, `RGB8` and `RGBA8`.
  12. #end
  13. Enum PixelFormat
  14. Unknown
  15. I8
  16. A8
  17. IA8
  18. RGB8
  19. RGBA8
  20. RGBA16F
  21. RGBA32F
  22. Depth16
  23. Depth24
  24. Depth32
  25. 'deprecated
  26. IA16=IA8
  27. RGB24=RGB8
  28. RGBA32=RGBA8
  29. End
  30. #rem monkeydoc Gets the number of bytes per pixel for a particular pixel format.
  31. #end
  32. Function PixelFormatDepth:Int( format:PixelFormat )
  33. Select format
  34. Case PixelFormat.I8 Return 1
  35. Case PixelFormat.A8 Return 1
  36. Case PixelFormat.IA8 Return 2
  37. Case PixelFormat.RGB8 Return 3
  38. Case PixelFormat.RGBA8 Return 4
  39. Case PixelFormat.RGBA16F Return 8
  40. Case PixelFormat.RGBA32F Return 16
  41. Case PixelFormat.Depth16 Return 2
  42. Case PixelFormat.Depth24 Return 4
  43. Case PixelFormat.Depth32 Return 4
  44. 'deprecated
  45. Case PixelFormat.IA16 Return 2
  46. Case PixelFormat.RGB24 Return 3
  47. Case PixelFormat.RGBA32 Return 4
  48. End
  49. Return PixelFormat.Unknown
  50. End