Initial Version of LayerManagementService added.
[profile/ivi/layer-management.git] / LayerManagerService / include / GraphicalSurface.h
1 /***************************************************************************
2 *
3 * Copyright 2010 BMW Car IT GmbH
4 *
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *               http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 ****************************************************************************/
19
20 #ifndef _GRAPHICALSURFACE_H_
21 #define _GRAPHICALSURFACE_H_
22
23 #include "LogicalGraphicsObject.h"
24 #include "Rectangle.h"
25 #include "Vector2.h"
26 #include "Orientation.h"
27
28 /**
29  * Abstract Type representing a graphical surface.
30  */
31 class GraphicalSurface : public GraphicalObject{
32 public:
33         GraphicalSurface(ObjectType type) : GraphicalObject(type,1,true),orientation(Zero),SourceViewport(0,0,0,0),DestinationViewport(0,0,0,0)  {
34         };
35
36                 /**
37                  * Set Orientation value
38                  * @param orientation the new value. Multiples of 90 degrees. (0->0°, 1->90°, 2->180°,3->279°)
39                  */
40                 void setOrientation(OrientationType newOrientation){orientation = newOrientation;};
41                 const OrientationType getOrientation(){return orientation;};
42
43                 /**
44                  * Set Source Viewport (only use portion of source graphics)
45                  * @param x Horizontal x position within source (clip from the left)
46                  * @param y Vertical y position within source (clip from the top)
47                  * @param width Width within source (can be used to clip from the right)
48                  * @param height Height within source (can be used to clip fromt he bottom)
49                  */
50                 void setSourceRegion(const Rectangle& newSource){SourceViewport = newSource;};
51                 const Rectangle& getSourceRegion(){ return SourceViewport;};
52
53                 /**
54                  * Set Destination Viewport (Scale output)
55                  * @param x Horizontal x position of destination
56                  * @param y Vertical y position of destination
57                  * @param width Width of destination
58                  * @param height Height of destination
59                  */
60                 void setDestinationRegion(const Rectangle& newDestination){DestinationViewport = newDestination;};
61
62                 void setPosition(const int& x, const int& y){DestinationViewport.x = x; DestinationViewport.y = y;};
63                 Vector2 getPosition(){ return Vector2(DestinationViewport.x,DestinationViewport.y);}
64                 void setDimension(const int& width, const int& height){DestinationViewport.width = width; DestinationViewport.height = height;};
65                 const Rectangle& getDestinationRegion(){ return DestinationViewport;};
66                 Vector2 getDimension(){ return Vector2(DestinationViewport.width, DestinationViewport.height);};
67 private:
68         OrientationType orientation; // Rotation of the graphical content
69         Rectangle SourceViewport;
70         Rectangle DestinationViewport;
71
72 };
73
74 #endif /* _GRAPHICALSURFACE_H_ */