1 /* This is a small demo of the high-performance GUIX graphics framework. */
2 
3 #include <stdio.h>
4 #include "gx_api.h"
5 
6 #include "synergy_4444argb_32bpp_resources.h"
7 #include "synergy_4444argb_32bpp_specifications.h"
8 
9 MAIN_WINDOW_CONTROL_BLOCK *pMainWin;
10 GX_WINDOW *pic_window;
11 
12 
13 /* Define the ThreadX demo thread control block and stack.  */
14 
15 TX_THREAD          demo_thread;
16 UCHAR              demo_thread_stack[4096];
17 
18 GX_WINDOW_ROOT    *root;
19 GX_BOOL            alpha = GX_FALSE;
20 GX_BOOL            compressed = GX_FALSE;
21 GX_UBYTE           format;
22 INT                xshift;
23 INT                yshift;
24 INT                horizontal_slider = 0;
25 INT                vertical_slider = 0;
26 
27 /* Define prototypes.   */
28 VOID  demo_thread_entry(ULONG thread_input);
29 extern UINT win32_dave2d_graphics_driver_setup_24xrgb(GX_DISPLAY *display);
30 
31 
main(int argc,char ** argv)32 int main(int argc, char ** argv)
33 {
34     tx_kernel_enter();
35     return(0);
36 }
37 
38 
tx_application_define(void * first_unused_memory)39 VOID tx_application_define(void *first_unused_memory)
40 {
41 
42     /* Create the main demo thread.  */
43     tx_thread_create(&demo_thread, "GUIX Demo Thread", demo_thread_entry,
44                      0,  demo_thread_stack, sizeof(demo_thread_stack),
45                      1, 1, TX_NO_TIME_SLICE, TX_AUTO_START);
46 }
47 
48 
demo_thread_entry(ULONG thread_input)49 VOID  demo_thread_entry(ULONG thread_input)
50 {
51     /* Initialize GUIX.  */
52     gx_system_initialize();
53 
54 
55     gx_studio_display_configure(DISPLAY_1, win32_dave2d_graphics_driver_setup_24xrgb,
56                                 LANGUAGE_ENGLISH, DISPLAY_1_THEME_1, &root);
57 
58     /* create the main screen */
59     gx_studio_named_widget_create("main_window", (GX_WIDGET *) root, (GX_WIDGET **) &pMainWin);
60     pic_window = &pMainWin ->main_window_pic_window;
61 
62     /* Show the root window to make it and patients screen visible.  */
63     gx_widget_show(root);
64 
65     /* let GUIX run */
66     gx_system_start();
67 }
68 
main_event_handler(GX_WINDOW * window,GX_EVENT * myevent)69 UINT main_event_handler(GX_WINDOW *window, GX_EVENT *myevent)
70 {
71     UINT status = 0;
72     switch(myevent -> gx_event_type)
73     {
74 
75 	case GX_SIGNAL(ID_4444BGRA_UNCOM, GX_EVENT_RADIO_SELECT):
76 		format = GX_PIXELMAP_ID_RED_APPLE ;
77         gx_system_dirty_mark(pic_window);
78         break;
79 
80 	case GX_SIGNAL(ID_4444BGRA_COM, GX_EVENT_RADIO_SELECT):
81 		format = GX_PIXELMAP_ID_ICON_FOOT_ALPHA ;
82         gx_system_dirty_mark(pic_window);
83         break;
84 
85     case GX_SIGNAL(ID_4444ARGB_UNCOM, GX_EVENT_RADIO_SELECT):
86 		format = GX_PIXELMAP_ID_RAINBOW200_ALPHA_NONCOMPRESS ;
87         gx_system_dirty_mark(pic_window);
88         break;
89 
90     case GX_SIGNAL(ID_4444ARGB_COM, GX_EVENT_RADIO_SELECT):
91 		format = GX_PIXELMAP_ID_RAINBOW200_ALPHA_COMPRESS ;
92         gx_system_dirty_mark(pic_window);
93         break;
94 
95     default:
96         return gx_window_event_process(window, myevent);
97     }
98     return status;
99 }
100 
pic_win_draw(GX_WINDOW * window)101 VOID pic_win_draw(GX_WINDOW *window)
102 {
103 	switch (format)
104 	{
105 
106 	case GX_PIXELMAP_ID_RED_APPLE:
107 		gx_window_wallpaper_set(window, GX_PIXELMAP_ID_RED_APPLE, GX_FALSE);
108 		break;
109 
110 	case GX_PIXELMAP_ID_ICON_FOOT_ALPHA:
111 		gx_window_wallpaper_set(window, GX_PIXELMAP_ID_ICON_FOOT_ALPHA, GX_FALSE);
112 		break;
113 
114 	case GX_PIXELMAP_ID_RAINBOW200_ALPHA_COMPRESS:
115 		gx_window_wallpaper_set(window, GX_PIXELMAP_ID_RAINBOW200_ALPHA_COMPRESS, GX_FALSE);
116 		break;
117 
118 	case GX_PIXELMAP_ID_RAINBOW200_ALPHA_NONCOMPRESS:
119 		gx_window_wallpaper_set(window, GX_PIXELMAP_ID_RAINBOW200_ALPHA_NONCOMPRESS, GX_FALSE);
120 		break;
121 
122 	default:
123 		gx_window_wallpaper_set(window, GX_PIXELMAP_ID_RED_APPLE, GX_FALSE);
124 	}
125     gx_window_draw((GX_WINDOW*) window);
126 }
127 
128