1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** GUIX Component                                                        */
16 /**                                                                       */
17 /**   Text Input Management (Single Line Text Input)                      */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 /* Include necessary system files.  */
22 #define GX_SOURCE_CODE
23 
24 #include "gx_api.h"
25 #include "gx_utility.h"
26 
27 /* Bring in externs for caller checking code.  */
28 GX_CALLER_CHECKING_EXTERNS
29 /**************************************************************************/
30 /*                                                                        */
31 /*  FUNCTION                                               RELEASE        */
32 /*                                                                        */
33 /*    _gx_utility_canvas_to_bmp                           PORTABLE C      */
34 /*                                                           6.1          */
35 /*  AUTHOR                                                                */
36 /*                                                                        */
37 /*    Kenneth Maxwell, Microsoft Corporation                              */
38 /*                                                                        */
39 /*  DESCRIPTION                                                           */
40 /*                                                                        */
41 /*    Covert canvas memory data to bmp file.                              */
42 /*                                                                        */
43 /*  INPUT                                                                 */
44 /*                                                                        */
45 /*    canvas                                Canvas control block          */
46 /*    rectangle                             Rectangle specification       */
47 /*    write_data                            Write data callback function  */
48 /*                                                                        */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*    status                                Completion status             */
52 /*                                                                        */
53 /*  CALLS                                                                 */
54 /*                                                                        */
55 /*    _gx_utility_canvas_to_bmp             Actual function which do this */
56 /*                                            convert.                    */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    Application                                                         */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
67 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
68 /*                                            resulting in version 6.1    */
69 /*                                                                        */
70 /**************************************************************************/
_gxe_utility_canvas_to_bmp(GX_CANVAS * canvas,GX_RECTANGLE * rect,UINT (* write_data)(GX_UBYTE * byte_data,UINT data_count))71 UINT _gxe_utility_canvas_to_bmp(GX_CANVAS *canvas, GX_RECTANGLE *rect, UINT (*write_data)(GX_UBYTE *byte_data, UINT data_count))
72 {
73 
74     /* Check for appropriate caller.  */
75     GX_INIT_AND_THREADS_CALLER_CHECKING
76 
77     if ((canvas == GX_NULL) ||
78         (canvas -> gx_canvas_display == GX_NULL) ||
79         (canvas -> gx_canvas_memory == NULL) ||
80         (rect == GX_NULL) ||
81         (write_data == GX_NULL))
82     {
83         return GX_PTR_ERROR;
84     }
85 
86     return _gx_utility_canvas_to_bmp(canvas, rect, write_data);
87 }
88