blob: 38825c33336dbf676db202ef8bf4d7ff8ee618d3 [file] [log] [blame]
[email protected]256513872012-01-05 15:41:521/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]6ea69542010-12-20 18:15:592 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
[email protected]9b37f4802011-07-19 00:09:285
[email protected]256513872012-01-05 15:41:526/* From pp_rect.idl modified Wed Oct 5 14:06:02 2011. */
[email protected]9b37f4802011-07-19 00:09:287
[email protected]1758e882010-11-01 16:16:508#ifndef PPAPI_C_PP_RECT_H_
9#define PPAPI_C_PP_RECT_H_
10
[email protected]6f2e3912010-11-05 14:45:4411#include "ppapi/c/pp_macros.h"
[email protected]1758e882010-11-01 16:16:5012#include "ppapi/c/pp_point.h"
13#include "ppapi/c/pp_size.h"
14#include "ppapi/c/pp_stdint.h"
15
[email protected]040d5e82011-01-28 15:38:3816/**
[email protected]9b37f4802011-07-19 00:09:2817 * @file
18 * This file defines the APIs for creating a 2 dimensional rectangle.
19 */
20
21
22/**
[email protected]040d5e82011-01-28 15:38:3823 * @addtogroup Structs
24 * @{
25 */
[email protected]590872fa2011-02-03 22:47:0926/**
[email protected]c5495952011-06-30 22:57:1727 * The <code>PP_Rect</code> struct contains the size and location of a 2D
28 * rectangle.
[email protected]590872fa2011-02-03 22:47:0929 */
[email protected]1758e882010-11-01 16:16:5030struct PP_Rect {
[email protected]590872fa2011-02-03 22:47:0931 /**
32 * This value represents the x and y coordinates of the upper-left corner of
33 * the rectangle.
34 */
[email protected]1758e882010-11-01 16:16:5035 struct PP_Point point;
[email protected]590872fa2011-02-03 22:47:0936 /** This value represents the width and height of the rectangle. */
[email protected]1758e882010-11-01 16:16:5037 struct PP_Size size;
38};
[email protected]1ad2a1db2010-12-13 20:04:3139PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Rect, 16);
[email protected]040d5e82011-01-28 15:38:3840/**
41 * @}
42 */
[email protected]1758e882010-11-01 16:16:5043
[email protected]9b37f4802011-07-19 00:09:2844
[email protected]040d5e82011-01-28 15:38:3845/**
46 * @addtogroup Functions
47 * @{
48 */
[email protected]590872fa2011-02-03 22:47:0949
50/**
[email protected]c5495952011-06-30 22:57:1751 * PP_MakeRectFromXYWH() creates a <code>PP_Rect</code> given x and y
52 * coordinates and width and height dimensions as int32_t values.
53 *
[email protected]590872fa2011-02-03 22:47:0954 * @param[in] x An int32_t value representing a horizontal coordinate of a
55 * point, starting with 0 as the left-most coordinate.
56 * @param[in] y An int32_t value representing a vertical coordinate of a point,
57 * starting with 0 as the top-most coordinate.
58 * @param[in] w An int32_t value representing a width.
59 * @param[in] h An int32_t value representing a height.
[email protected]c5495952011-06-30 22:57:1760 *
61 * @return A <code>PP_Rect</code> structure.
[email protected]590872fa2011-02-03 22:47:0962 */
[email protected]6f2e3912010-11-05 14:45:4463PP_INLINE struct PP_Rect PP_MakeRectFromXYWH(int32_t x, int32_t y,
64 int32_t w, int32_t h) {
[email protected]1758e882010-11-01 16:16:5065 struct PP_Rect ret;
66 ret.point.x = x;
67 ret.point.y = y;
68 ret.size.width = w;
69 ret.size.height = h;
70 return ret;
71}
[email protected]1758e882010-11-01 16:16:5072/**
73 * @}
[email protected]1758e882010-11-01 16:16:5074 */
[email protected]9b37f4802011-07-19 00:09:2875
[email protected]6ea69542010-12-20 18:15:5976#endif /* PPAPI_C_PP_RECT_H_ */
77