Move render_view_context_menu.* and related files out of tab_contents.
[chromium-blink-merge.git] / ppapi / api / dev / ppb_graphics_2d_dev.idl
blob28a844416a6eb863c955aa4ce046274e393406d4
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 */
6 /* This file contains the <code>PPB_Graphics2D_Dev</code> interface. */
8 [generate_thunk]
10 label Chrome {
11 M22 = 0.1,
12 M32 = 0.2
15 /**
16 * These options affect how the existing graphics context is displayed when a
17 * plugin is resized.
19 [assert_size(4)]
20 enum PP_Graphics2D_Dev_ResizeMode {
21 /**
22 * In this mode, the context does not change size or offset. If the backing
23 * store is the same size as the plugin element, this will result in the
24 * pixels on the right side of the plugin element being unavailable, revealing
25 * the contents underneath it.
27 PP_GRAPHICS2D_DEV_RESIZEMODE_DEFAULT,
28 /**
29 * In this mode, the context and its offset are scaled relative to how much
30 * the plugin element has been resized.
32 PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH
35 /* PPB_Graphics2D_Dev interface */
36 interface PPB_Graphics2D_Dev {
37 /**
38 * SetScale() sets the scale factor that will be applied when painting the
39 * graphics context onto the output device. Typically, if rendering at device
40 * resolution is desired, the context would be created with the width and
41 * height scaled up by the view's GetDeviceScale and SetScale called with a
42 * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed
43 * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of
44 * 2.0, one would call Create with a size of (w=400, h=200) and then call
45 * SetScale with 0.5. One would then treat each pixel in the context as a
46 * single device pixel.
48 * @param[in] resource A <code>Graphics2D</code> context resource.
49 * @param[in] scale The scale to apply when painting.
51 * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if
52 * the resource is invalid or the scale factor is 0 or less.
54 PP_Bool SetScale(
55 [in] PP_Resource resource,
56 [in] float_t scale);
58 /***
59 * GetScale() gets the scale factor that will be applied when painting the
60 * graphics context onto the output device.
62 * @param[in] resource A <code>Graphics2D</code> context resource.
64 * @return Returns the scale factor for the graphics context. If the resource
65 * is not a valid <code>Graphics2D</code> context, this will return 0.0.
67 float_t GetScale(
68 [in] PP_Resource resource);
70 /***
71 * Sets the offset into the plugin element at which the graphics context is
72 * painted. This allows a portion of the plugin element to be painted to.
73 * The new offset will only be applied after Flush() has been called.
75 * @param[in] resource A <code>Graphics2D</code> context resource.
76 * @param[in] offset The offset at which the context should be painted.
78 [version=0.2]
79 void SetOffset(
80 [in] PP_Resource resource,
81 [in] PP_Point offset);
83 /***
84 * Sets the resize mode for the graphics context. When a plugin element is
85 * resized in the DOM, it takes time for the plugin to update the graphics
86 * context in the renderer. These options affect how the existing context is
87 * displayed until the backing store is updated by the plugin.
89 * @param[in] resource A <code>Graphics2D</code> context resource.
90 * @param[in] resize_mode The resize mode to change this context to.
92 void SetResizeMode(
93 [in] PP_Resource resource,
94 [in] PP_Graphics2D_Dev_ResizeMode resize_mode);