Home | History | Annotate | Download | only in dev
      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 
      6 /* From dev/ppb_graphics_2d_dev.idl modified Tue Jun 19 14:11:08 2012. */
      7 
      8 #ifndef PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_
      9 #define PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_
     10 
     11 #include "ppapi/c/pp_bool.h"
     12 #include "ppapi/c/pp_macros.h"
     13 #include "ppapi/c/pp_resource.h"
     14 #include "ppapi/c/pp_stdint.h"
     15 
     16 #define PPB_GRAPHICS2D_DEV_INTERFACE_0_1 "PPB_Graphics2D(Dev);0.1"
     17 #define PPB_GRAPHICS2D_DEV_INTERFACE PPB_GRAPHICS2D_DEV_INTERFACE_0_1
     18 
     19 /**
     20  * @file
     21  * This file contains the <code>PPB_Graphics2D_Dev</code> interface. */
     22 
     23 
     24 /**
     25  * @addtogroup Interfaces
     26  * @{
     27  */
     28 /* PPB_Graphics2D_Dev interface */
     29 struct PPB_Graphics2D_Dev_0_1 {
     30   /**
     31    * SetScale() sets the scale factor that will be applied when painting the
     32    * graphics context onto the output device. Typically, if rendering at device
     33    * resolution is desired, the context would be created with the width and
     34    * height scaled up by the view's GetDeviceScale and SetScale called with a
     35    * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed
     36    * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of
     37    * 2.0, one would call Create with a size of (w=400, h=200) and then call
     38    * SetScale with 0.5. One would then treat each pixel in the context as a
     39    * single device pixel.
     40    *
     41    * @param[in] resource A <code>Graphics2D</code> context resource.
     42    * @param[in] scale The scale to apply when painting.
     43    *
     44    * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if
     45    * the resource is invalid or the scale factor is 0 or less.
     46    */
     47   PP_Bool (*SetScale)(PP_Resource resource, float scale);
     48   /***
     49    * GetScale() gets the scale factor that will be applied when painting the
     50    * graphics context onto the output device.
     51    *
     52    * @param[in] resource A <code>Graphics2D</code> context resource.
     53    *
     54    * @return Returns the scale factor for the graphics context. If the resource
     55    * is not a valid <code>Graphics2D</code> context, this will return 0.0.
     56    */
     57   float (*GetScale)(PP_Resource resource);
     58 };
     59 
     60 typedef struct PPB_Graphics2D_Dev_0_1 PPB_Graphics2D_Dev;
     61 /**
     62  * @}
     63  */
     64 
     65 #endif  /* PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_ */
     66 
     67