/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
namespace ElmSharp
{
///
/// The EvasMap is an opaque handle to map points.
///
/// preview
public class EvasMap
{
IntPtr _evasMap;
bool _ownership;
///
/// Creates and initializes a new instance of the EvasMap class.
///
/// The number of points in the map
/// preview
public EvasMap(int count)
{
_evasMap = Interop.Evas.evas_map_new(count);
_ownership = true;
}
internal EvasMap(IntPtr handle)
{
_evasMap = handle;
_ownership = false;
}
///
/// Destructor for the EvasMap class.
///
~EvasMap()
{
if (_ownership)
{
Interop.Evas.evas_map_free(_evasMap);
}
}
internal IntPtr Handle
{
get
{
return _evasMap;
}
}
///
/// Gets or sets the flag of the object to move synchronization for map rendering.
///
/// preview
public bool IsMoveSync
{
get
{
return Interop.Evas.evas_map_util_object_move_sync_get(_evasMap);
}
set
{
Interop.Evas.evas_map_util_object_move_sync_set(_evasMap, value);
}
}
///
/// Populates the source and destination map points to exactly match the object.
///
/// The object to use unmapped geometry to populate the map coordinates.
/// preview
public void PopulatePoints(EvasObject obj)
{
Interop.Evas.evas_map_util_points_populate_from_object_full(_evasMap, obj, 0);
}
///
/// Populates the source and destination map points to exactly match the object.
///
/// The object to use unmapped geometry to populate the map coordinates.
///
/// The point Z-coordinate hint (pre-perspective transform). This value is used for all the four points.
///
/// preview
public void PopulatePoints(EvasObject obj, int z)
{
Interop.Evas.evas_map_util_points_populate_from_object_full(_evasMap, obj, z);
}
///
/// Populates the source and destination map points to match the given geometry.
///
/// The geometry value contains X-coordinate, Y-coordinate, the width and height to use, to calculate the second and third points.
/// The Z-coordinate hint (pre-perspective transform) This value is used for all the four points.
/// preview
public void PopulatePoints(Rect geometry, int z)
{
Interop.Evas.evas_map_util_points_populate_from_geometry(_evasMap, geometry.X, geometry.Y, geometry.Width, geometry.Height, z);
}
///
/// Rotates the map.
///
/// The abount of degrees from 0.0 to 360.0 to rotate.
/// The rotation's center horizontal position.
/// The rotation's center vertical position.
/// preview
public void Rotate(double degrees, int cx, int cy)
{
Interop.Evas.evas_map_util_rotate(_evasMap, degrees, cx, cy);
}
///
/// Rotates the map around 3 axes in 3D.
///
/// The amount of degrees from 0.0 to 360.0 to rotate around the X-axis.
/// The amount of degrees from 0.0 to 360.0 to rotate around the Y-axis.
/// The amount of degrees from 0.0 to 360.0 to rotate around the Z-axis.
/// The rotation's center horizontal position.
/// The rotation's center vertical position.
/// The rotation's center depth position.
/// preview
public void Rotate3D(double dx, double dy, double dz, int cx, int cy, int cz)
{
Interop.Evas.evas_map_util_3d_rotate(_evasMap, dx, dy, dz, cx, cy, cz);
}
///
/// Changes the map point's coordinate.
///
/// The index of point to change, this must be smaller than the map size.
/// The 3D point coordinate.
/// preview
public void SetPointCoordinate(int idx, Point3D point)
{
Interop.Evas.evas_map_point_coord_set(_evasMap, idx, point.X, point.Y, point.Z);
}
///
/// Gets the map point's coordinate.
///
/// The index of point to change, this must be smaller than the map size.
/// The coordinates of a given point in the map.
/// preview
public Point3D GetPointCoordinate(int idx)
{
Point3D point;
Interop.Evas.evas_map_point_coord_get(_evasMap, idx, out point.X, out point.Y, out point.Z);
return point;
}
///
/// Changes the map to apply the given zooming.
///
/// The horizontal zoom to use.
/// The vertical zoom to use.
/// The zooming center horizontal position.
/// The zooming center vertical position.
/// preview
public void Zoom(double x, double y, int cx, int cy)
{
Interop.Evas.evas_map_util_zoom(_evasMap, x, y, cx, cy);
}
}
}