codeworkx | 62f02ba | 2012-05-20 12:00:36 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright@ Samsung Electronics Co. LTD |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /*! |
| 18 | * \file SecRect.h |
| 19 | * \brief header file for SecRect |
| 20 | * \author Sangwoo, Park(sw5771.park@samsung.com) |
| 21 | * \date 2011/06/02 |
| 22 | * |
| 23 | * <b>Revision History: </b> |
| 24 | * - 2010/06/03 : Sangwoo, Park(sw5771.park@samsung.com) \n |
| 25 | * Initial version |
| 26 | * |
| 27 | */ |
| 28 | |
| 29 | /** |
| 30 | * @page SecRect |
| 31 | * |
| 32 | * @section Introduction |
| 33 | * SetRect is common struct for rectangle |
| 34 | * |
| 35 | * @section Copyright |
| 36 | * Copyright (c) 2008-2011 Samsung Electronics Co., Ltd.All rights reserved. \n |
| 37 | * Proprietary and Confidential |
| 38 | * |
| 39 | * @image html samsung.png |
| 40 | */ |
| 41 | |
| 42 | #ifndef __SEC_RECT_H__ |
| 43 | #define __SEC_RECT_H__ |
| 44 | |
| 45 | //! Rectangle information |
| 46 | struct SecRect |
| 47 | { |
| 48 | int x; //!< x pos |
| 49 | int y; //!< y pos |
| 50 | int w; //!< width |
| 51 | int h; //!< height |
| 52 | int fullW; //!< full width of image |
| 53 | int fullH; //!< full height of image |
| 54 | int colorFormat; //!< V4L2_PIX_FMT_XXX |
| 55 | |
| 56 | //! Constructor |
| 57 | SecRect(int _x_ = 0, |
| 58 | int _y_ = 0, |
| 59 | int _w_ = 0, |
| 60 | int _h_ = 0, |
| 61 | int _fullW_ = 0, |
| 62 | int _fullH_ = 0, |
| 63 | int _colorFormat_ = 0) |
| 64 | { |
| 65 | x = _x_; |
| 66 | y = _y_; |
| 67 | w = _w_; |
| 68 | h = _h_; |
| 69 | fullW = _fullW_; |
| 70 | fullH = _fullH_; |
| 71 | colorFormat = _colorFormat_; |
| 72 | } |
| 73 | |
| 74 | //! Constructor |
| 75 | SecRect(const SecRect *other) |
| 76 | { |
| 77 | x = other->x; |
| 78 | y = other->y; |
| 79 | w = other->w; |
| 80 | h = other->h; |
| 81 | fullW = other->fullW; |
| 82 | fullH = other->fullH; |
| 83 | colorFormat = other->colorFormat; |
| 84 | } |
| 85 | |
| 86 | //! Operator(=) override |
| 87 | SecRect& operator =(const SecRect &other) |
| 88 | { |
| 89 | x = other.x; |
| 90 | y = other.y; |
| 91 | w = other.w; |
| 92 | h = other.h; |
| 93 | fullW = other.fullW; |
| 94 | fullH = other.fullH; |
| 95 | colorFormat = other.colorFormat; |
| 96 | return *this; |
| 97 | } |
| 98 | |
| 99 | //! Operator(==) override |
| 100 | bool operator ==(const SecRect &other) const |
| 101 | { |
| 102 | return ( x == other.x |
| 103 | && y == other.y |
| 104 | && w == other.w |
| 105 | && h == other.h |
| 106 | && fullW == other.fullW |
| 107 | && fullH == other.fullH |
| 108 | && colorFormat == other.colorFormat); |
| 109 | } |
| 110 | |
| 111 | //! Operator(!=) override |
| 112 | bool operator !=(const SecRect &other) const |
| 113 | { |
| 114 | // use operator(==) |
| 115 | return !(*this == other); |
| 116 | } |
| 117 | }; |
| 118 | |
| 119 | //! Clip information |
| 120 | struct SecRect2 |
| 121 | { |
| 122 | int x1; //!< Left (The x-coordinate value of upper-left corner) |
| 123 | int y1; //!< Top (The y-coordinate value of upper-left corner) |
| 124 | int x2; //!< Right (The x-coordinate value of lower-right corner) |
| 125 | int y2; //!< Bottom (The y-coordinate value of lower-right corner) |
| 126 | |
| 127 | //! Constructor |
| 128 | SecRect2(int _x1_ = 0, int _y1_ = 0, int _x2_ = 0, int _y2_ = 0) |
| 129 | { |
| 130 | x1 = _x1_; |
| 131 | y1 = _y1_; |
| 132 | x2 = _x2_; |
| 133 | y2 = _y2_; |
| 134 | } |
| 135 | |
| 136 | //! Constructor |
| 137 | SecRect2(const SecRect2 *other) |
| 138 | { |
| 139 | x1 = other->x1; |
| 140 | y1 = other->y1; |
| 141 | x2 = other->x2; |
| 142 | y2 = other->y2; |
| 143 | } |
| 144 | |
| 145 | //! Operator(=) override |
| 146 | SecRect2& operator =(const SecRect2 &other) |
| 147 | { |
| 148 | x1 = other.x1; |
| 149 | y1 = other.y1; |
| 150 | x2 = other.x2; |
| 151 | y2 = other.y2; |
| 152 | return *this; |
| 153 | } |
| 154 | |
| 155 | //! Operator(==) override |
| 156 | bool operator ==(const SecRect2 &other) const |
| 157 | { |
| 158 | return ( x1 == other.x1 |
| 159 | && y1 == other.y1 |
| 160 | && x2 == other.x2 |
| 161 | && y2 == other.y2); |
| 162 | } |
| 163 | |
| 164 | //! Operator(!=) override |
| 165 | bool operator !=(const SecRect2 &other) const |
| 166 | { |
| 167 | // use operator(==) |
| 168 | return !(*this == other); |
| 169 | } |
| 170 | }; |
| 171 | |
| 172 | #endif //__SEC_RECT_H__ |