xmng.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef _XMNG_H_
  2. #define _XMNG_H
  3. #define RGB_SIZE 3
  4. #define CANVAS_RGB8_SIZE 3
  5. #define CANVAS_RGBA8_SIZE 4
  6. #define CANVAS_ARGB8_SIZE 4
  7. #define CANVAS_RGB8_A8_SIZE 4
  8. #define CANVAS_BGR8_SIZE 3
  9. #define CANVAS_BGRA8_SIZE 4
  10. #define CANVAS_BGRA8PM_SIZE 4
  11. #define CANVAS_ABGR8_SIZE 4
  12. #define MNG_MAGIC "\x8aMNG\x0d\x0a\x1a\x0a"
  13. #define JNG_MAGIC "\x8bJNG\x0d\x0a\x1a\x0a"
  14. #define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a"
  15. #define PSEUDOCOLOR 1
  16. #define TRUECOLOR 2
  17. #define MNG_TYPE 1
  18. #define JNG_TYPE 2
  19. #define PNG_TYPE 3
  20. #define SPACE_X 10
  21. #define SPACE_Y 10
  22. #define BUT_ENTRY_BORDER 0
  23. #define FRAME_SHADOW_WIDTH 2
  24. #define ANY_WIDTH 4
  25. #define OK MNG_NOERROR
  26. #define MAX_COLORBUF 64
  27. typedef struct
  28. {
  29. unsigned int frozen:1;
  30. unsigned int restarted:1;
  31. unsigned int stopped:1;
  32. unsigned int single_step_wanted:1;
  33. unsigned int single_step_served:1;
  34. unsigned int has_bg_color:1;
  35. unsigned int has_bg_pixel:1;
  36. unsigned int x11_init:1;
  37. unsigned int timer_active:1;
  38. mng_handle user_handle;
  39. Widget canvas;
  40. int type;
  41. XtIntervalId timeout_ID;
  42. mng_uint32 counter;
  43. mng_uint32 delay;
  44. mng_uint32 img_width, img_height;
  45. mng_uint32 read_len;
  46. mng_uint32 read_pos;
  47. unsigned char *read_buf;
  48. unsigned char *mng_buf;
  49. unsigned char *dither_line;
  50. Window external_win;
  51. Window frame_win;
  52. Window control_win;
  53. GC gc;
  54. Display *dpy;
  55. Window win;
  56. unsigned short mng_rgb_size;
  57. unsigned short mng_bytes_per_line;
  58. XImage *ximage;
  59. int src_x, src_y;
  60. int dst_x, dst_y;
  61. unsigned int frame_w, frame_h;
  62. void *shm;
  63. int gray;
  64. int display_depth, display_type;
  65. int have_shmem;
  66. Pixel bg_pixel;
  67. unsigned short xbg_red, xbg_green, xbg_blue;
  68. unsigned char bg_red, bg_green, bg_blue;
  69. Visual *visual;
  70. unsigned int depth;
  71. /* do not free */
  72. struct timeval timer_start;
  73. struct timeval timer_end;
  74. char *read_idf;
  75. FILE *reader;
  76. int *argc_ptr;
  77. char **argv;
  78. char bg_color[MAX_COLORBUF];
  79. } ImageInfo;
  80. #define XPUTIMAGE(dpy,dr,gc,xi,a,b,c,d,w,h) \
  81. if (have_shmem) \
  82. XShmPutImage(dpy,dr,gc,xi,a,b,c,d,w,h,True); \
  83. else \
  84. XPutImage(dpy,dr,gc,xi,a,b,c,d,w,h)
  85. extern void Viewer_postlude(void);
  86. extern XImage *x11_create_ximage(ImageInfo *data);
  87. extern void x11_destroy_ximage(ImageInfo *data);
  88. extern void x11_init_color(ImageInfo *data);
  89. extern void viewer_renderline(ImageInfo *data, unsigned char *scanline,
  90. unsigned int row, unsigned int x, unsigned int width);
  91. #endif