Alternative library and kernel for add-in development on fx-9860G and fx-CG50 under Linux.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

display-fx.h 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //---
  2. // gint:display-fx - fx9860g drawing functions
  3. //
  4. // This module is in charge of all monochrome rendering. The gray engine
  5. // has its own functions, but often relies on this module (because the
  6. // gray effect is created through two monochrome buffers).
  7. //---
  8. #ifndef GINT_DISPLAY_FX
  9. #define GINT_DISPLAY_FX
  10. #ifdef FX9860G
  11. #include <gint/defs/types.h>
  12. /* Expose the VRAM variable if GINT_NEED_VRAM is defined. It must always point
  13. to a 4-aligned buffer of size 1024. Any function can use it freely to:
  14. - Use another video ram area (triple buffering or more, gray engine);
  15. - Implement additional drawing functions;
  16. - Store data when not drawing. */
  17. #ifdef GINT_NEED_VRAM
  18. extern uint32_t *vram;
  19. #endif
  20. /* color_t - colors available for drawing
  21. The following colors are defined by the library:
  22. OPAQUE COLORS (override existing pixels)
  23. white, black - the usual thing
  24. light, dark - intermediate colors used with the gray engine
  25. OPERATORS (combine with existing pixels)
  26. none - leaves unchanged
  27. invert - inverts white <-> black, light <-> dark
  28. lighten - shifts black -> dark -> light -> white -> white
  29. darken - shifts white -> light -> dark -> black -> black
  30. Not all colors can be used with all functions. To avoid ambiguities, all
  31. functions explicitly indicate compatible colors. */
  32. typedef enum
  33. {
  34. /* Opaque colors */
  35. C_WHITE = 0,
  36. C_LIGHT = 1,
  37. C_DARK = 2,
  38. C_BLACK = 3,
  39. /* Monochrome operators */
  40. C_NONE = 4,
  41. C_INVERT = 5,
  42. /* Gray operators */
  43. C_LIGHTEN = 6,
  44. C_DARKEN = 7,
  45. } color_t;
  46. //---
  47. // Image rendering (bopti)
  48. //---
  49. /* image_t - image files encoded for bopti
  50. This format is the result of encoding images for bopti with the fxSDK's
  51. [fxconv] tool. The bopti routines can render it extremely fast, which makes
  52. it preferable over plain bitmaps if the images are never edited. */
  53. typedef struct
  54. {
  55. /* Image can only be rendered with the gray engine */
  56. uint gray :1;
  57. /* Left for future use */
  58. uint :3;
  59. /* Image profile (uniquely identifies a rendering function) */
  60. uint profile :4;
  61. /* Full width, in pixels */
  62. uint width :12;
  63. /* Full height, in pixels */
  64. uint height :12;
  65. /* Raw layer data */
  66. uint8_t data[];
  67. } GPACKED(4) image_t;
  68. #endif /* FX9860G */
  69. #endif /* GINT_DISPLAY_FX */