Jason Sams | 41371c7 | 2015-03-26 20:46:57 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | // Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime. |
| 18 | |
| 19 | /* |
| 20 | * rs_element.rsh: Element functions |
| 21 | * |
| 22 | * The term "element" is used a bit ambiguously in RenderScript, as both |
| 23 | * the type of an item of an allocation and the instantiation of that type: |
| 24 | * |
| 25 | * rs_element is a handle to a type specification, and |
| 26 | * |
| 27 | * In functions like rsGetElementAt(), "element" means the instantiation |
| 28 | * of the type, i.e. an item of an allocation. |
| 29 | * |
| 30 | * The functions below let you query the characteristics of the type specificiation. |
| 31 | * |
| 32 | * To create complex elements, use the Element.Builder Java class. |
| 33 | * For common elements, in Java you can simply use one of the many predefined elements |
| 34 | * like F32_2. You can't create elements from a script. |
| 35 | * |
| 36 | * An element can be a simple data type as found in C/C++, a handle type, |
| 37 | * a structure, or a fixed size vector (of size 2, 3, or 4) of sub-elements. |
| 38 | * |
| 39 | * Elements can also have a kind, which is semantic information used mostly to |
| 40 | * interpret pixel data. |
| 41 | */ |
| 42 | #ifndef RENDERSCRIPT_RS_ELEMENT_RSH |
| 43 | #define RENDERSCRIPT_RS_ELEMENT_RSH |
| 44 | |
| 45 | /* |
| 46 | * rsElementGetBytesSize: Return the size of an element |
| 47 | * |
| 48 | * Returns the size in bytes that an instantiation of this element will occupy. |
| 49 | */ |
| 50 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 51 | extern uint32_t __attribute__((overloadable)) |
| 52 | rsElementGetBytesSize(rs_element e); |
| 53 | #endif |
| 54 | |
| 55 | /* |
| 56 | * rsElementGetDataKind: Return the kind of an element |
| 57 | * |
| 58 | * Returns the element's data kind. This is used to interpret pixel data. |
| 59 | * |
| 60 | * See rs_data_kind. |
| 61 | */ |
| 62 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 63 | extern rs_data_kind __attribute__((overloadable)) |
| 64 | rsElementGetDataKind(rs_element e); |
| 65 | #endif |
| 66 | |
| 67 | /* |
| 68 | * rsElementGetDataType: Return the data type of an element |
| 69 | * |
| 70 | * Returns the element's base data type. This can be a type similar to C/C++ (e.g. RS_TYPE_UNSIGNED_8), |
| 71 | * a handle (e.g. RS_TYPE_ALLOCATION and RS_TYPE_ELEMENT), or a more complex numerical type |
| 72 | * (e.g.RS_TYPE_UNSIGNED_5_6_5 and RS_TYPE_MATRIX_4X4). |
| 73 | * |
| 74 | * If the element describes a vector, this function returns the data type of one of its items. |
| 75 | * |
| 76 | * If the element describes a structure, RS_TYPE_NONE is returned. |
| 77 | * |
| 78 | * See rs_data_type. |
| 79 | */ |
| 80 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 81 | extern rs_data_type __attribute__((overloadable)) |
| 82 | rsElementGetDataType(rs_element e); |
| 83 | #endif |
| 84 | |
| 85 | /* |
| 86 | * rsElementGetSubElement: Return a sub element of a complex element |
| 87 | * |
| 88 | * For the element represents a structure, this function returns the sub-element at |
| 89 | * the specified index. |
| 90 | * |
| 91 | * If the element is not a structure or the index is greater or equal to the number |
| 92 | * of sub-elements, an invalid handle is returned. |
| 93 | * |
| 94 | * Parameters: |
| 95 | * e Element to query |
| 96 | * index Index of the sub-element to return |
| 97 | * |
| 98 | * Returns: Sub-element at the given index |
| 99 | */ |
| 100 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 101 | extern rs_element __attribute__((overloadable)) |
| 102 | rsElementGetSubElement(rs_element e, uint32_t index); |
| 103 | #endif |
| 104 | |
| 105 | /* |
| 106 | * rsElementGetSubElementArraySize: Return the array size of a sub element of a complex element |
| 107 | * |
| 108 | * For complex elements, some sub-elements could be statically |
| 109 | * sized arrays. This function returns the array size of the |
| 110 | * sub-element at the index. |
| 111 | * |
| 112 | * Parameters: |
| 113 | * e Element to query |
| 114 | * index Index of the sub-element |
| 115 | * |
| 116 | * Returns: Array size of the sub-element at the given index |
| 117 | */ |
| 118 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 119 | extern uint32_t __attribute__((overloadable)) |
| 120 | rsElementGetSubElementArraySize(rs_element e, uint32_t index); |
| 121 | #endif |
| 122 | |
| 123 | /* |
| 124 | * rsElementGetSubElementCount: Return the number of sub-elements |
| 125 | * |
| 126 | * Elements could be simple, such as an int or a float, or a |
| 127 | * structure with multiple sub-elements, such as a collection of |
| 128 | * floats, float2, float4. This function returns zero for simple |
| 129 | * elements or the number of sub-elements otherwise. |
| 130 | * |
| 131 | * Parameters: |
| 132 | * e Element to get data from |
| 133 | * |
| 134 | * Returns: Number of sub-elements in this element |
| 135 | */ |
| 136 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 137 | extern uint32_t __attribute__((overloadable)) |
| 138 | rsElementGetSubElementCount(rs_element e); |
| 139 | #endif |
| 140 | |
| 141 | /* |
| 142 | * rsElementGetSubElementName: Return the name of a sub-element |
| 143 | * |
| 144 | * For complex elements, this function returns the name of the sub-element |
| 145 | * at the specified index. |
| 146 | * |
| 147 | * Parameters: |
| 148 | * e Element to get data from |
| 149 | * index Index of the sub-element |
| 150 | * name Array to store the name into |
| 151 | * nameLength Length of the provided name array |
| 152 | * |
| 153 | * Returns: Number of characters actually written, excluding the null terminator |
| 154 | */ |
| 155 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 156 | extern uint32_t __attribute__((overloadable)) |
| 157 | rsElementGetSubElementName(rs_element e, uint32_t index, char* name, uint32_t nameLength); |
| 158 | #endif |
| 159 | |
| 160 | /* |
| 161 | * rsElementGetSubElementNameLength: Return the length of the name of a sub-element |
| 162 | * |
| 163 | * For complex elements, this function will return the length of |
| 164 | * sub-element name at index |
| 165 | * |
| 166 | * Parameters: |
| 167 | * e Element to get data from |
| 168 | * index Index of the sub-element to return |
| 169 | * |
| 170 | * Returns: Length of the sub-element name including the null terminator (size of buffer needed to write the name) |
| 171 | */ |
| 172 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 173 | extern uint32_t __attribute__((overloadable)) |
| 174 | rsElementGetSubElementNameLength(rs_element e, uint32_t index); |
| 175 | #endif |
| 176 | |
| 177 | /* |
| 178 | * This function specifies the location of a sub-element within |
| 179 | * the element |
| 180 | * |
| 181 | * Parameters: |
| 182 | * e Element to get data from |
| 183 | * index Index of the sub-element |
| 184 | * |
| 185 | * Returns: Offset in bytes of sub-element in this element at given index |
| 186 | */ |
| 187 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 188 | extern uint32_t __attribute__((overloadable)) |
| 189 | rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index); |
| 190 | #endif |
| 191 | |
| 192 | /* |
| 193 | * Returns the element's vector size |
| 194 | * |
| 195 | * Parameters: |
| 196 | * e Element to get data from |
| 197 | * |
| 198 | * Returns: Length of the element vector (for float2, float3, etc.) |
| 199 | */ |
| 200 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 201 | extern uint32_t __attribute__((overloadable)) |
| 202 | rsElementGetVectorSize(rs_element e); |
| 203 | #endif |
| 204 | |
| 205 | #endif // RENDERSCRIPT_RS_ELEMENT_RSH |