Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 1 | /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 | * Use of this source code is governed by a BSD-style license that can be |
| 3 | * found in the LICENSE file. |
| 4 | */ |
| 5 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 6 | /* From pp_touch_point.idl modified Thu Mar 28 10:13:07 2013. */ |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 7 | |
| 8 | #ifndef PPAPI_C_PP_TOUCH_POINT_H_ |
| 9 | #define PPAPI_C_PP_TOUCH_POINT_H_ |
| 10 | |
| 11 | #include "ppapi/c/pp_macros.h" |
| 12 | #include "ppapi/c/pp_point.h" |
| 13 | #include "ppapi/c/pp_stdint.h" |
| 14 | |
| 15 | /** |
| 16 | * @file |
| 17 | * This file defines the API to create a touch point or position where fingers |
| 18 | * makes contact with touch screen device. |
| 19 | */ |
| 20 | |
| 21 | |
| 22 | /** |
| 23 | * @addtogroup Structs |
| 24 | * @{ |
| 25 | */ |
| 26 | /** |
| 27 | * The <code>PP_TouchPoint</code> struct represents all information about a |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 28 | * single touch point, such as position, id, rotation angle, and pressure. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 29 | */ |
| 30 | struct PP_TouchPoint { |
| 31 | /** |
| 32 | * This value represents the identifier for this TouchPoint. The id |
| 33 | * corresponds to the order in which the points were pressed. For example, |
| 34 | * the first point to be pressed has an id of 0, the second has an id of 1, |
| 35 | * and so on. An id can be reused when a touch point is released. For |
| 36 | * example, if two fingers are down, with id 0 and 1, and finger 0 releases, |
| 37 | * the next finger to be pressed can be assigned to id 0. |
| 38 | */ |
| 39 | uint32_t id; |
| 40 | /** |
| 41 | * This value represents the x and y pixel position of this TouchPoint |
| 42 | * relative to the upper-left of the module instance receiving the event. |
| 43 | */ |
| 44 | struct PP_FloatPoint position; |
| 45 | /** |
| 46 | * This value represents the elliptical radii, in screen pixels, in the x |
| 47 | * and y direction of this TouchPoint. |
| 48 | */ |
| 49 | struct PP_FloatPoint radius; |
| 50 | /** |
| 51 | * This value represents the angle of rotation in degrees of the elliptical |
| 52 | * model of this TouchPoint clockwise from "up." |
| 53 | */ |
| 54 | float rotation_angle; |
| 55 | /** |
| 56 | * This value represents the pressure applied to this TouchPoint. This value |
| 57 | * is typically between 0 and 1, with 0 indicating no pressure and 1 |
| 58 | * indicating some maximum pressure. Scaling differs depending on the |
| 59 | * hardware and the value is not guaranteed to stay within that range. |
| 60 | */ |
| 61 | float pressure; |
| 62 | }; |
| 63 | PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_TouchPoint, 28); |
| 64 | /** |
| 65 | * @} |
| 66 | */ |
| 67 | |
| 68 | /** |
| 69 | * @addtogroup Functions |
| 70 | * @{ |
| 71 | */ |
| 72 | |
| 73 | /** |
| 74 | * PP_MakeTouchPoint() creates a <code>PP_TouchPoint</code>. |
| 75 | * |
| 76 | * @return A <code>PP_TouchPoint</code> structure. |
| 77 | */ |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 78 | PP_INLINE struct PP_TouchPoint PP_MakeTouchPoint(void) { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 79 | struct PP_TouchPoint result = { 0, {0, 0}, {0, 0}, 0, 0 }; |
| 80 | return result; |
| 81 | } |
| 82 | /** |
| 83 | * @} |
| 84 | */ |
| 85 | |
| 86 | #endif /* PPAPI_C_PP_TOUCH_POINT_H_ */ |
| 87 | |