1 /************************************************************************** 2 * 3 * Copyright 2010, 2011 BMW Car IT GmbH 4 * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh 5 * 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 ****************************************************************************/ 20 #ifndef _TRANSFORM_H_ 21 #define _TRANSFORM_H_ 22 23 typedef struct _transform { 24 float mx, bx; 25 float my, by; 26 } Transform; 27 28 typedef struct _tpoint { 29 float x, y; 30 } TPoint; 31 32 typedef struct _trectangle { 33 float x, y, width, height; 34 } TRectangle; 35 36 #define Xx(x,y,t) ((int)((t)->mx * (x) + (t)->bx + 0.5)) 37 #define Xy(x,y,t) ((int)((t)->my * (y) + (t)->by + 0.5)) 38 #define Xwidth(w,h,t) ((int)((t)->mx * (w) + 0.5)) 39 #define Xheight(w,h,t) ((int)((t)->my * (h) + 0.5)) 40 #define Tx(x,y,t) ((((float) (x)) - (t)->bx) / (t)->mx) 41 #define Ty(x,y,t) ((((float) (y)) - (t)->by) / (t)->my) 42 #define Twidth(w,h,t) (((float) (w)) / (t)->mx) 43 #define Theight(w,h,t) (((float) (h)) / (t)->my) 44 45 #endif 46