Home | History | Annotate | Download | only in api
      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 header:
     18 summary: Conversion Functions
     19 description:
     20  The functions below convert from a numerical vector type to another, or from one color
     21  representation to another.
     22 end:
     23 
     24 function: convert_#3#1
     25 version: 9
     26 attrib: const
     27 w: 2, 3, 4
     28 t: u8, u16, u32, i8, i16, i32, f32
     29 t: u8, u16, u32, i8, i16, i32, f32
     30 ret: #3#1
     31 arg: #2#1 v, compatible(#3)
     32 summary: Convert numerical vectors
     33 description:
     34  Converts a vector from one numerical type to another.  The conversion are done entry per entry.
     35 
     36  E.g calling <code>a = convert_short3(b);</code> is equivalent to doing
     37  <code>a.x = (short)b.x; a.y = (short)b.y; a.z = (short)b.z;</code>.
     38 
     39  Converting floating point values to integer types truncates.
     40 
     41  Converting numbers too large to fit the destination type yields undefined results.
     42  For example, converting a float that contains 1.0e18 to a short is undefined.
     43  Use @clamp() to avoid this.
     44 end:
     45 
     46 function: convert_#3#1
     47 version: 21
     48 attrib: const
     49 w: 2, 3, 4
     50 t: u64, i64, f64
     51 t: u64, i64, f64
     52 ret: #3#1
     53 arg: #2#1 v, compatible(#3)
     54 end:
     55 
     56 function: convert_#3#1
     57 version: 21
     58 attrib: const
     59 w: 2, 3, 4
     60 t: u64, i64, f64
     61 t: u8, u16, u32, i8, i16, i32, f32
     62 ret: #3#1
     63 arg: #2#1 v, compatible(#3)
     64 end:
     65 
     66 function: convert_#3#1
     67 version: 21
     68 attrib: const
     69 w: 2, 3, 4
     70 t: u8, u16, u32, i8, i16, i32, f32
     71 t: u64, i64, f64
     72 ret: #3#1
     73 arg: #2#1 v, compatible(#3)
     74 end:
     75 
     76 function: convert_#3#1
     77 version: 24
     78 attrib: const
     79 w: 2, 3, 4
     80 t: f16
     81 t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
     82 ret: #3#1
     83 arg: #2#1 v, compatible(#3)
     84 end:
     85 
     86 function: convert_#3#1
     87 version: 24
     88 attrib: const
     89 w: 2, 3, 4
     90 t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
     91 t: f16
     92 ret: #3#1
     93 arg: #2#1 v, compatible(#3)
     94 end:
     95 
     96 function: rsPackColorTo8888
     97 attrib: const
     98 ret: uchar4
     99 arg: float r, "Red component."
    100 arg: float g, "Green component."
    101 arg: float b, "Blue component."
    102 summary: Create a uchar4 RGBA from floats
    103 description:
    104  Packs three or four floating point RGBA values into a uchar4.
    105 
    106  The input values are typically between 0.0f and 1.0f inclusive.  For input values outside
    107  of this range, the resulting outputs will be clamped to be between 0 and 255.  As this
    108  clamping may be done after the input is multiplied by 255.f and converted to an integer,
    109  input numbers greater than INT_MAX/255.f or less than INT_MIN/255.f result in
    110  undefined behavior.
    111 
    112  If the alpha component is not specified, it is assumed to be 1.0, i.e. the result will
    113  have an alpha set to 255.
    114 test: none
    115 end:
    116 
    117 function: rsPackColorTo8888
    118 attrib: const
    119 ret: uchar4
    120 arg: float r
    121 arg: float g
    122 arg: float b
    123 arg: float a, "Alpha component."
    124 test: none
    125 end:
    126 
    127 function: rsPackColorTo8888
    128 attrib: const
    129 ret: uchar4
    130 arg: float3 color, "Vector of 3 or 4 floats containing the R, G, B, and A values."
    131 test: none
    132 end:
    133 
    134 function: rsPackColorTo8888
    135 attrib: const
    136 ret: uchar4
    137 arg: float4 color
    138 test: none
    139 end:
    140 
    141 function: rsUnpackColor8888
    142 # NOTE: The = below indicates that the generator should not add "overloadable" by default.
    143 # We're doing this to stay backward compatible with the unusual declaration used when this
    144 # function was introduced.
    145 attrib: =const
    146 ret: float4
    147 arg: uchar4 c
    148 summary: Create a float4 RGBA from uchar4
    149 description:
    150  Unpacks a uchar4 color to float4.  The resulting floats will be between 0.0 and 1.0 inclusive.
    151 test: none
    152 end:
    153 
    154 function: rsYuvToRGBA_#2#1
    155 attrib: const
    156 w: 4
    157 t: u8, f32
    158 ret: #2#1
    159 arg: uchar y, "Luminance component."
    160 arg: uchar u, "U chrominance component."
    161 arg: uchar v, "V chrominance component."
    162 summary: Convert a YUV value to RGBA
    163 description:
    164  Converts a color from a YUV representation to RGBA.
    165 
    166  We currently don't provide a function to do the reverse conversion.
    167 test: none
    168 end:
    169