1 /* This is a small demo of the high-performance GUIX graphics framework. */
2
3 #include <stdio.h>
4 #include "gx_api.h"
5 #include "gx_canvas.h"
6
7 #include "png_draw_32bpp_resources.h"
8 #include "png_draw_32bpp_specifications.h"
9
10 WINDOW_CONTROL_BLOCK *pMainWin;
11
12 /* Define the ThreadX demo thread control block and stack. */
13
14 TX_THREAD demo_thread;
15 UCHAR demo_thread_stack[4096];
16 TX_BYTE_POOL decode_pool;
17
18 #define SCRATCHPAD_PIXELS (DISPLAY_1_X_RESOLUTION * DISPLAY_1_Y_RESOLUTION * 4)
19 GX_COLOR scratchpad[SCRATCHPAD_PIXELS];
20
21
22 GX_WINDOW_ROOT *root;
23
24 /* Define prototypes. */
25 VOID guix_setup(void);
26 extern UINT win32_graphics_driver_setup_24xrgb(GX_DISPLAY *display);
27
main(int argc,char ** argv)28 int main(int argc, char ** argv)
29 {
30 tx_kernel_enter();
31 return(0);
32 }
33
decode_memory_allocate(ULONG size)34 VOID *decode_memory_allocate(ULONG size)
35 {
36 VOID *memptr;
37 if (tx_byte_allocate(&decode_pool, &memptr, size, TX_NO_WAIT) == TX_SUCCESS)
38 {
39 return memptr;
40 }
41 return NULL;
42 }
43
decode_memory_free(VOID * mem)44 void decode_memory_free(VOID *mem)
45 {
46 tx_byte_release(mem);
47 }
48
tx_application_define(void * first_unused_memory)49 VOID tx_application_define(void *first_unused_memory)
50 {
51
52 /* create byte pool for decode to use */
53 tx_byte_pool_create(&decode_pool, "scratchpad", scratchpad,
54 SCRATCHPAD_PIXELS * sizeof(GX_COLOR));
55
56 guix_setup();
57
58 /* install our memory allocator and de-allocator */
59 gx_system_memory_allocator_set(decode_memory_allocate, decode_memory_free);
60 }
61
62
guix_setup()63 VOID guix_setup()
64 {
65 /* Initialize GUIX. */
66 gx_system_initialize();
67
68 gx_studio_display_configure(DISPLAY_1, win32_graphics_driver_setup_24xrgb,
69 LANGUAGE_ENGLISH, DISPLAY_1_THEME_1, &root);
70
71 /* create the main screen */
72 gx_studio_named_widget_create("window", (GX_WIDGET *) root, (GX_WIDGET **) &pMainWin);
73
74 /* Show the root window to make it and patients screen visible. */
75 gx_widget_show(root);
76
77 /* let GUIX run */
78 gx_system_start();
79 }
80