microvg  2.0.0
microvg
microvg_gradient.h
Go to the documentation of this file.
1 /*
2  * C
3  *
4  * Copyright 2022 MicroEJ Corp. All rights reserved.
5  * Use of this source code is governed by a BSD-style license that can be found with this software.
6  */
7 
15 #if !defined MICROVG_GRADIENT_H
16 #define MICROVG_GRADIENT_H
17 
18 #if defined __cplusplus
19 extern "C" {
20 #endif
21 
22 #include "microvg_configuration.h"
23 
24 #if defined (VG_FEATURE_GRADIENT) && defined (VG_FEATURE_GRADIENT_FULL) && defined (VG_FEATURE_GRADIENT_FIRST_COLOR)
25 
26 #if ((VG_FEATURE_GRADIENT != VG_FEATURE_GRADIENT_FULL) && (VG_FEATURE_GRADIENT != VG_FEATURE_GRADIENT_FIRST_COLOR))
27 #error "Specify a value for VG_FEATURE_GRADIENT"
28 #endif
29 
30 // -----------------------------------------------------------------------------
31 // Includes
32 // -----------------------------------------------------------------------------
33 
34 #include <sni.h>
35 
36 // -----------------------------------------------------------------------------
37 // Structs
38 // -----------------------------------------------------------------------------
39 
40 /*
41  * @brief Map a jint array that represents a linear gradient
42  */
44 {
45 
46 #if (VG_FEATURE_GRADIENT == VG_FEATURE_GRADIENT_FULL)
47  jint count; // number of colors and positions
48  jfloat x;
49  jfloat y;
50  jfloat angle;
51  jfloat length;
52  jint colors_offset;
53  jint positions_offset;
54 #else
55  jint color; // only one color
56 #endif
58 
59 #if (VG_FEATURE_GRADIENT == VG_FEATURE_GRADIENT_FULL)
60 
61 // -----------------------------------------------------------------------------
62 // Specific gradient formatting functions [mandatory]
63 // -----------------------------------------------------------------------------
64 
65 /*
66  * @brief Gets the size of the gradient color scale where the gradient colors
67  * positions are stored.
68  *
69  * @return the gradient scale size
70  */
71 float MICROVG_GRADIENT_get_gradient_scale_size(void);
72 
73 // -----------------------------------------------------------------------------
74 // Specific gradient formatting functions [optional]
75 // -----------------------------------------------------------------------------
76 
77 /*
78  * @brief Gets the gradient's array header size.
79  *
80  * The default implementation returns sizeof(MICROVG_GRADIENT_HEADER_t) / sizeof(uint32_t).
81  *
82  * @return the size in 32-bit format ("1" means 4 bytes)
83  */
84 uint32_t MICROVG_GRADIENT_get_gradient_header_size(void);
85 
86 #endif // #if (VG_FEATURE_GRADIENT == VG_FEATURE_GRADIENT_FULL)
87 
88 // -----------------------------------------------------------------------------
89 // EOF
90 // -----------------------------------------------------------------------------
91 
92 #endif // VG_FEATURE_GRADIENT
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif // !defined MICROVG_GRADIENT_H
MicroEJ MicroVG library low level API: enable some features according to the hardware capacities...