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 |
|
|
/** Canvas Management (Canvas) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_canvas.h" |
28 |
|
|
#include "gx_system.h" |
29 |
|
|
|
30 |
|
|
/* Bring in externs for caller checking code. */ |
31 |
|
|
GX_CALLER_CHECKING_EXTERNS |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gxe_canvas_pixelmap_blend PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function checks errors in the canvas pixelmap blend function. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* x_position Top-left x-coord to place */ |
50 |
|
|
/* pixelmap */ |
51 |
|
|
/* y_position Top-left y-coord to place */ |
52 |
|
|
/* pixelmap */ |
53 |
|
|
/* pixelmap Pointer to actual pixelmap */ |
54 |
|
|
/* to draw */ |
55 |
|
|
/* alpha blending value 0-255 */ |
56 |
|
|
/* */ |
57 |
|
|
/* OUTPUT */ |
58 |
|
|
/* */ |
59 |
|
|
/* status Completion status */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLS */ |
62 |
|
|
/* */ |
63 |
|
|
/* _gx_canvas_pixelmap_draw The actual function */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* Application Code */ |
68 |
|
|
/* */ |
69 |
|
|
/* RELEASE HISTORY */ |
70 |
|
|
/* */ |
71 |
|
|
/* DATE NAME DESCRIPTION */ |
72 |
|
|
/* */ |
73 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
74 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
75 |
|
|
/* resulting in version 6.1 */ |
76 |
|
|
/* */ |
77 |
|
|
/**************************************************************************/ |
78 |
|
588 |
UINT _gxe_canvas_pixelmap_blend(GX_VALUE x_position, GX_VALUE y_position, |
79 |
|
|
GX_PIXELMAP *pixelmap, GX_UBYTE alpha) |
80 |
|
|
{ |
81 |
|
|
UINT status; |
82 |
|
|
|
83 |
|
|
/* Check for appropriate caller. */ |
84 |
✓✓✓✓ ✓✓ |
588 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
85 |
|
|
|
86 |
|
|
/* Check error for valid pointer. */ |
87 |
✓✓ |
586 |
if (pixelmap == GX_NULL) |
88 |
|
|
{ |
89 |
|
2 |
return(GX_PTR_ERROR); |
90 |
|
|
} |
91 |
|
|
|
92 |
✓✓ |
584 |
if (_gx_system_current_draw_context == GX_NULL) |
93 |
|
|
{ |
94 |
|
1 |
return GX_INVALID_CONTEXT; |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
/* Call the actual function. */ |
98 |
|
583 |
status = _gx_canvas_pixelmap_blend(x_position, y_position, pixelmap, alpha); |
99 |
|
|
|
100 |
|
|
/* Return completion status. */ |
101 |
|
583 |
return(status); |
102 |
|
|
} |
103 |
|
|
|