OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /* From ppb_graphics_2d.idl modified Fri Apr 26 08:49:08 2013. */ | 6 /* From ppb_graphics_2d.idl modified Fri Apr 15 15:37:20 2016. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPB_GRAPHICS_2D_H_ | 8 #ifndef PPAPI_C_PPB_GRAPHICS_2D_H_ |
9 #define PPAPI_C_PPB_GRAPHICS_2D_H_ | 9 #define PPAPI_C_PPB_GRAPHICS_2D_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
13 #include "ppapi/c/pp_instance.h" | 13 #include "ppapi/c/pp_instance.h" |
14 #include "ppapi/c/pp_macros.h" | 14 #include "ppapi/c/pp_macros.h" |
15 #include "ppapi/c/pp_point.h" | 15 #include "ppapi/c/pp_point.h" |
16 #include "ppapi/c/pp_rect.h" | 16 #include "ppapi/c/pp_rect.h" |
17 #include "ppapi/c/pp_resource.h" | 17 #include "ppapi/c/pp_resource.h" |
18 #include "ppapi/c/pp_size.h" | 18 #include "ppapi/c/pp_size.h" |
19 #include "ppapi/c/pp_stdint.h" | 19 #include "ppapi/c/pp_stdint.h" |
20 | 20 |
21 #define PPB_GRAPHICS_2D_INTERFACE_1_0 "PPB_Graphics2D;1.0" | 21 #define PPB_GRAPHICS_2D_INTERFACE_1_0 "PPB_Graphics2D;1.0" |
22 #define PPB_GRAPHICS_2D_INTERFACE_1_1 "PPB_Graphics2D;1.1" | 22 #define PPB_GRAPHICS_2D_INTERFACE_1_1 "PPB_Graphics2D;1.1" |
23 #define PPB_GRAPHICS_2D_INTERFACE PPB_GRAPHICS_2D_INTERFACE_1_1 | 23 #define PPB_GRAPHICS_2D_INTERFACE_1_2 "PPB_Graphics2D;1.2" |
| 24 #define PPB_GRAPHICS_2D_INTERFACE PPB_GRAPHICS_2D_INTERFACE_1_2 |
24 | 25 |
25 /** | 26 /** |
26 * @file | 27 * @file |
27 * Defines the <code>PPB_Graphics2D</code> struct representing a 2D graphics | 28 * Defines the <code>PPB_Graphics2D</code> struct representing a 2D graphics |
28 * context within the browser. | 29 * context within the browser. |
29 */ | 30 */ |
30 | 31 |
31 | 32 |
32 /** | 33 /** |
33 * @addtogroup Interfaces | 34 * @addtogroup Interfaces |
34 * @{ | 35 * @{ |
35 */ | 36 */ |
36 /** | 37 /** |
37 * <code>PPB_Graphics2D</code> defines the interface for a 2D graphics context. | 38 * <code>PPB_Graphics2D</code> defines the interface for a 2D graphics context. |
38 */ | 39 */ |
39 struct PPB_Graphics2D_1_1 { | 40 struct PPB_Graphics2D_1_2 { |
40 /** | 41 /** |
41 * Create() creates a 2D graphics context. The returned graphics context will | 42 * Create() creates a 2D graphics context. The returned graphics context will |
42 * not be bound to the module instance on creation (call BindGraphics() on | 43 * not be bound to the module instance on creation (call BindGraphics() on |
43 * the module instance to bind the returned graphics context to the module | 44 * the module instance to bind the returned graphics context to the module |
44 * instance). | 45 * instance). |
45 * | 46 * |
46 * @param[in] instance The module instance. | 47 * @param[in] instance The module instance. |
47 * @param[in] size The size of the graphic context. | 48 * @param[in] size The size of the graphic context. |
48 * @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag to | 49 * @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag to |
49 * <code>PP_TRUE</code> if you know that you will be painting only opaque | 50 * <code>PP_TRUE</code> if you know that you will be painting only opaque |
(...skipping 26 matching lines...) Expand all Loading... |
76 /** | 77 /** |
77 * Describe() retrieves the configuration for the given graphics context, | 78 * Describe() retrieves the configuration for the given graphics context, |
78 * filling the given values (which must not be <code>NULL</code>). | 79 * filling the given values (which must not be <code>NULL</code>). |
79 * | 80 * |
80 * @param[in] resource The 2D Graphics resource. | 81 * @param[in] resource The 2D Graphics resource. |
81 * @param[in,out] size The size of the 2D graphics context in the browser. | 82 * @param[in,out] size The size of the 2D graphics context in the browser. |
82 * @param[in,out] is_always_opaque Identifies whether only opaque data | 83 * @param[in,out] is_always_opaque Identifies whether only opaque data |
83 * will be painted. | 84 * will be painted. |
84 * | 85 * |
85 * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if | 86 * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if |
86 * the resource is invalid. The output parameters will be set to 0 on a | 87 * theomments + 1 draft» Download |
| 88 * M» resource is invalid. The output parameters will be set to 0 on a |
87 * <code>PP_FALSE</code>. | 89 * <code>PP_FALSE</code>. |
88 */ | 90 */ |
89 PP_Bool (*Describe)(PP_Resource graphics_2d, | 91 PP_Bool (*Describe)(PP_Resource graphics_2d, |
90 struct PP_Size* size, | 92 struct PP_Size* size, |
91 PP_Bool* is_always_opaque); | 93 PP_Bool* is_always_opaque); |
92 /** | 94 /** |
93 * PaintImageData() enqueues a paint of the given image into the context. | 95 * PaintImageData() enqueues a paint of the given image into the context. |
94 * This function has no effect until you call Flush() As a result, what | 96 * This function has no effect until you call Flush() As a result, what |
95 * counts is the contents of the bitmap when you call Flush(), not when | 97 * counts is the contents of the bitmap when you call Flush(), not when |
96 * you call this function. | 98 * you call this function. |
(...skipping 29 matching lines...) Expand all Loading... |
126 * <code>top_left</code> location where the <code>ImageData</code> will be | 128 * <code>top_left</code> location where the <code>ImageData</code> will be |
127 * painted. | 129 * painted. |
128 * @param[in] src_rect The rectangular area where the <code>ImageData</code> | 130 * @param[in] src_rect The rectangular area where the <code>ImageData</code> |
129 * will be painted. | 131 * will be painted. |
130 */ | 132 */ |
131 void (*PaintImageData)(PP_Resource graphics_2d, | 133 void (*PaintImageData)(PP_Resource graphics_2d, |
132 PP_Resource image_data, | 134 PP_Resource image_data, |
133 const struct PP_Point* top_left, | 135 const struct PP_Point* top_left, |
134 const struct PP_Rect* src_rect); | 136 const struct PP_Rect* src_rect); |
135 /** | 137 /** |
| 138 * |
| 139 * |
136 * Scroll() enqueues a scroll of the context's backing store. This | 140 * Scroll() enqueues a scroll of the context's backing store. This |
137 * function has no effect until you call Flush(). The data within the | 141 * function has no effect until you call Flush(). The data within the |
138 * provided clipping rectangle will be shifted by (dx, dy) pixels. | 142 * provided clipping rectangle will be shifted by (dx, dy) pixels. |
139 * | 143 * |
140 * This function will result in some exposed region which will have undefined | 144 * This function will result in some exposed region which will have undefined |
141 * contents. The module should call PaintImageData() on these exposed regions | 145 * contents. The module should call PaintImageData() on these exposed regions |
142 * to give the correct contents. | 146 * to give the correct contents. |
143 * | 147 * |
144 * The scroll can be larger than the area of the clipping rectangle, which | 148 * The scroll can be larger than the area of the clipping rectangle, which |
145 * means the current image will be scrolled out of the rectangle. This | 149 * means the current image will be scrolled out of the rectangle. This |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 /*** | 273 /*** |
270 * GetScale() gets the scale factor that will be applied when painting the | 274 * GetScale() gets the scale factor that will be applied when painting the |
271 * graphics context onto the output device. | 275 * graphics context onto the output device. |
272 * | 276 * |
273 * @param[in] resource A <code>Graphics2D</code> context resource. | 277 * @param[in] resource A <code>Graphics2D</code> context resource. |
274 * | 278 * |
275 * @return Returns the scale factor for the graphics context. If the resource | 279 * @return Returns the scale factor for the graphics context. If the resource |
276 * is not a valid <code>Graphics2D</code> context, this will return 0.0. | 280 * is not a valid <code>Graphics2D</code> context, this will return 0.0. |
277 */ | 281 */ |
278 float (*GetScale)(PP_Resource resource); | 282 float (*GetScale)(PP_Resource resource); |
| 283 /** |
| 284 * SetLayerTransform() sets a transformation factor that will be applied for |
| 285 * the current graphics context displayed on the output device. If both |
| 286 * SetScale and SetLayerTransform will be used, they are going to get combined |
| 287 * for the final result. |
| 288 * This function has no effect until you call Flush(). |
| 289 * @param[in] scale The scale to be applied. |
| 290 * @param[in] origin The origin of the scale. |
| 291 * @param[in] translate The translation to be applied. |
| 292 * |
| 293 * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> |
| 294 * if the resource is invalid or the scale factor is 0 or less. |
| 295 */ |
| 296 PP_Bool (*SetLayerTransform)(PP_Resource resource, |
| 297 float scale, |
| 298 const struct PP_Point* origin, |
| 299 const struct PP_Point* translate); |
279 }; | 300 }; |
280 | 301 |
281 typedef struct PPB_Graphics2D_1_1 PPB_Graphics2D; | 302 typedef struct PPB_Graphics2D_1_2 PPB_Graphics2D; |
282 | 303 |
283 struct PPB_Graphics2D_1_0 { | 304 struct PPB_Graphics2D_1_0 { |
284 PP_Resource (*Create)(PP_Instance instance, | 305 PP_Resource (*Create)(PP_Instance instance, |
285 const struct PP_Size* size, | 306 const struct PP_Size* size, |
286 PP_Bool is_always_opaque); | 307 PP_Bool is_always_opaque); |
287 PP_Bool (*IsGraphics2D)(PP_Resource resource); | 308 PP_Bool (*IsGraphics2D)(PP_Resource resource); |
288 PP_Bool (*Describe)(PP_Resource graphics_2d, | 309 PP_Bool (*Describe)(PP_Resource graphics_2d, |
289 struct PP_Size* size, | 310 struct PP_Size* size, |
290 PP_Bool* is_always_opaque); | 311 PP_Bool* is_always_opaque); |
291 void (*PaintImageData)(PP_Resource graphics_2d, | 312 void (*PaintImageData)(PP_Resource graphics_2d, |
292 PP_Resource image_data, | 313 PP_Resource image_data, |
293 const struct PP_Point* top_left, | 314 const struct PP_Point* top_left, |
294 const struct PP_Rect* src_rect); | 315 const struct PP_Rect* src_rect); |
295 void (*Scroll)(PP_Resource graphics_2d, | 316 void (*Scroll)(PP_Resource graphics_2d, |
296 const struct PP_Rect* clip_rect, | 317 const struct PP_Rect* clip_rect, |
297 const struct PP_Point* amount); | 318 const struct PP_Point* amount); |
298 void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); | 319 void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); |
299 int32_t (*Flush)(PP_Resource graphics_2d, | 320 int32_t (*Flush)(PP_Resource graphics_2d, |
300 struct PP_CompletionCallback callback); | 321 struct PP_CompletionCallback callback); |
301 }; | 322 }; |
| 323 |
| 324 struct PPB_Graphics2D_1_1 { |
| 325 PP_Resource (*Create)(PP_Instance instance, |
| 326 const struct PP_Size* size, |
| 327 PP_Bool is_always_opaque); |
| 328 PP_Bool (*IsGraphics2D)(PP_Resource resource); |
| 329 PP_Bool (*Describe)(PP_Resource graphics_2d, |
| 330 struct PP_Size* size, |
| 331 PP_Bool* is_always_opaque); |
| 332 void (*PaintImageData)(PP_Resource graphics_2d, |
| 333 PP_Resource image_data, |
| 334 const struct PP_Point* top_left, |
| 335 const struct PP_Rect* src_rect); |
| 336 void (*Scroll)(PP_Resource graphics_2d, |
| 337 const struct PP_Rect* clip_rect, |
| 338 const struct PP_Point* amount); |
| 339 void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); |
| 340 int32_t (*Flush)(PP_Resource graphics_2d, |
| 341 struct PP_CompletionCallback callback); |
| 342 PP_Bool (*SetScale)(PP_Resource resource, float scale); |
| 343 float (*GetScale)(PP_Resource resource); |
| 344 }; |
302 /** | 345 /** |
303 * @} | 346 * @} |
304 */ | 347 */ |
305 | 348 |
306 #endif /* PPAPI_C_PPB_GRAPHICS_2D_H_ */ | 349 #endif /* PPAPI_C_PPB_GRAPHICS_2D_H_ */ |
307 | 350 |
OLD | NEW |