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 Wed Apr 20 13:37:06 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 /*** | 270 /*** |
270 * GetScale() gets the scale factor that will be applied when painting the | 271 * GetScale() gets the scale factor that will be applied when painting the |
271 * graphics context onto the output device. | 272 * graphics context onto the output device. |
272 * | 273 * |
273 * @param[in] resource A <code>Graphics2D</code> context resource. | 274 * @param[in] resource A <code>Graphics2D</code> context resource. |
274 * | 275 * |
275 * @return Returns the scale factor for the graphics context. If the resource | 276 * @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. | 277 * is not a valid <code>Graphics2D</code> context, this will return 0.0. |
277 */ | 278 */ |
278 float (*GetScale)(PP_Resource resource); | 279 float (*GetScale)(PP_Resource resource); |
| 280 /** |
| 281 * SetLayerTransform() sets a transformation factor that will be applied for |
| 282 * the current graphics context displayed on the output device. If both |
| 283 * SetScale and SetLayerTransform will be used, they are going to get combined |
| 284 * for the final result. |
| 285 * |
| 286 * This function has no effect until you call Flush(). |
| 287 * |
| 288 * @param[in] scale The scale to be applied. |
| 289 * @param[in] origin The origin of the scale. |
| 290 * @param[in] translate The translation to be applied. |
| 291 * |
| 292 * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> |
| 293 * if the resource is invalid or the scale factor is 0 or less. |
| 294 */ |
| 295 PP_Bool (*SetLayerTransform)(PP_Resource resource, |
| 296 float scale, |
| 297 const struct PP_Point* origin, |
| 298 const struct PP_Point* translate); |
279 }; | 299 }; |
280 | 300 |
281 typedef struct PPB_Graphics2D_1_1 PPB_Graphics2D; | 301 typedef struct PPB_Graphics2D_1_2 PPB_Graphics2D; |
282 | 302 |
283 struct PPB_Graphics2D_1_0 { | 303 struct PPB_Graphics2D_1_0 { |
284 PP_Resource (*Create)(PP_Instance instance, | 304 PP_Resource (*Create)(PP_Instance instance, |
285 const struct PP_Size* size, | 305 const struct PP_Size* size, |
286 PP_Bool is_always_opaque); | 306 PP_Bool is_always_opaque); |
287 PP_Bool (*IsGraphics2D)(PP_Resource resource); | 307 PP_Bool (*IsGraphics2D)(PP_Resource resource); |
288 PP_Bool (*Describe)(PP_Resource graphics_2d, | 308 PP_Bool (*Describe)(PP_Resource graphics_2d, |
289 struct PP_Size* size, | 309 struct PP_Size* size, |
290 PP_Bool* is_always_opaque); | 310 PP_Bool* is_always_opaque); |
291 void (*PaintImageData)(PP_Resource graphics_2d, | 311 void (*PaintImageData)(PP_Resource graphics_2d, |
292 PP_Resource image_data, | 312 PP_Resource image_data, |
293 const struct PP_Point* top_left, | 313 const struct PP_Point* top_left, |
294 const struct PP_Rect* src_rect); | 314 const struct PP_Rect* src_rect); |
295 void (*Scroll)(PP_Resource graphics_2d, | 315 void (*Scroll)(PP_Resource graphics_2d, |
296 const struct PP_Rect* clip_rect, | 316 const struct PP_Rect* clip_rect, |
297 const struct PP_Point* amount); | 317 const struct PP_Point* amount); |
298 void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); | 318 void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); |
299 int32_t (*Flush)(PP_Resource graphics_2d, | 319 int32_t (*Flush)(PP_Resource graphics_2d, |
300 struct PP_CompletionCallback callback); | 320 struct PP_CompletionCallback callback); |
301 }; | 321 }; |
| 322 |
| 323 struct PPB_Graphics2D_1_1 { |
| 324 PP_Resource (*Create)(PP_Instance instance, |
| 325 const struct PP_Size* size, |
| 326 PP_Bool is_always_opaque); |
| 327 PP_Bool (*IsGraphics2D)(PP_Resource resource); |
| 328 PP_Bool (*Describe)(PP_Resource graphics_2d, |
| 329 struct PP_Size* size, |
| 330 PP_Bool* is_always_opaque); |
| 331 void (*PaintImageData)(PP_Resource graphics_2d, |
| 332 PP_Resource image_data, |
| 333 const struct PP_Point* top_left, |
| 334 const struct PP_Rect* src_rect); |
| 335 void (*Scroll)(PP_Resource graphics_2d, |
| 336 const struct PP_Rect* clip_rect, |
| 337 const struct PP_Point* amount); |
| 338 void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); |
| 339 int32_t (*Flush)(PP_Resource graphics_2d, |
| 340 struct PP_CompletionCallback callback); |
| 341 PP_Bool (*SetScale)(PP_Resource resource, float scale); |
| 342 float (*GetScale)(PP_Resource resource); |
| 343 }; |
302 /** | 344 /** |
303 * @} | 345 * @} |
304 */ | 346 */ |
305 | 347 |
306 #endif /* PPAPI_C_PPB_GRAPHICS_2D_H_ */ | 348 #endif /* PPAPI_C_PPB_GRAPHICS_2D_H_ */ |
307 | 349 |
OLD | NEW |