[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / EvasImage.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 using System;
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.IO;
21 using System.Text;
22
23 namespace ElmSharp
24 {
25     /// <summary>
26     /// This group provides the functions for image objects.
27     /// </summary>
28     /// <since_tizen> preview </since_tizen>
29     [Obsolete("This has been deprecated in API12")]
30     public class EvasImage : EvasObject
31     {
32         EvasObject _source = null;
33         IntPtr _handle = IntPtr.Zero;
34
35         /// <summary>
36         /// Creates and initializes a new instance of the EvasImage class.
37         /// </summary>
38         /// <param name="parent">The parent is a given container, which will be attached by EvasImage as a child. It's <see cref="EvasObject"/> type.</param>
39         /// <since_tizen> preview </since_tizen>
40         [Obsolete("This has been deprecated in API12")]
41         public EvasImage(EvasObject parent) : base(parent)
42         {
43         }
44
45         internal EvasImage(EvasObject parent, IntPtr handle) : base()
46         {
47             _handle = handle;
48             Realize(parent);
49         }
50
51         /// <summary>
52         /// Sets or gets the source file from where an image object must fetch the real image data.
53         /// </summary>
54         /// <since_tizen> preview </since_tizen>
55         [Obsolete("This has been deprecated in API12")]
56         public string File
57         {
58             get
59             {
60                 string file, key;
61                 Interop.Evas.evas_object_image_file_get(RealHandle, out file, out key);
62                 return file;
63             }
64             set
65             {
66                 Interop.Evas.evas_object_image_file_set(RealHandle, value, null);
67             }
68         }
69
70         /// <summary>
71         /// Sets or gets the source object to be visible.
72         /// </summary>
73         /// <since_tizen> preview </since_tizen>
74         [Obsolete("This has been deprecated in API12")]
75         public bool IsSourceVisible
76         {
77             get
78             {
79                 return Interop.Evas.evas_object_image_source_visible_get(RealHandle);
80             }
81             set
82             {
83                 Interop.Evas.evas_object_image_source_visible_set(RealHandle, value);
84             }
85         }
86
87         /// <summary>
88         /// Sets or gets whether an object is clipped by the source object's clipper.
89         /// </summary>
90         /// <since_tizen> preview </since_tizen>
91         [Obsolete("This has been deprecated in API12")]
92         public bool IsSourceClipped
93         {
94             get
95             {
96                 return Interop.Evas.evas_object_image_source_clip_get(RealHandle);
97             }
98             set
99             {
100                 Interop.Evas.evas_object_image_source_clip_set(RealHandle, value);
101             }
102         }
103
104         /// <summary>
105         /// Sets or gets if the center part of the given image object (not the border) should be drawn.
106         /// </summary>
107         /// <remarks>
108         /// When rendering, the image may be scaled to fit the size of the image object.
109         /// This function sets if the center part of the scaled image is to be drawn or left completely blank, or forced to be solid.
110         /// Very useful for frames and decorations.
111         /// </remarks>
112         /// <since_tizen> preview </since_tizen>
113         [Obsolete("This has been deprecated in API12")]
114         public ImageBorderFillMode BorderCenterFillMode
115         {
116             get
117             {
118                 return (ImageBorderFillMode)Interop.Evas.evas_object_image_border_center_fill_get(RealHandle);
119             }
120             set
121             {
122                 Interop.Evas.evas_object_image_border_center_fill_set(RealHandle, (int)value);
123             }
124         }
125
126         /// <summary>
127         /// Sets or gets whether the image object's fill property should track the object's size.
128         /// </summary>
129         /// <since_tizen> preview </since_tizen>
130         [Obsolete("This has been deprecated in API12")]
131         public bool IsFilled
132         {
133             get
134             {
135                 return Interop.Evas.evas_object_image_filled_get(RealHandle);
136             }
137             set
138             {
139                 Interop.Evas.evas_object_image_filled_set(RealHandle, value);
140             }
141         }
142
143         /// <summary>
144         /// Sets or gets the scaling factor (multiplier) for the borders of the image object.
145         /// </summary>
146         /// <since_tizen> preview </since_tizen>
147         [Obsolete("This has been deprecated in API12")]
148         public double BorderScale
149         {
150             get
151             {
152                 return Interop.Evas.evas_object_image_border_scale_get(RealHandle);
153             }
154             set
155             {
156                 Interop.Evas.evas_object_image_border_scale_set(RealHandle, value);
157             }
158         }
159
160         /// <summary>
161         /// Sets or gets the size of the given image object.
162         /// </summary>
163         /// <since_tizen> preview </since_tizen>
164         [Obsolete("This has been deprecated in API12")]
165         public Size Size
166         {
167             get
168             {
169                 int w, h;
170                 Interop.Evas.evas_object_image_size_get(RealHandle, out w, out h);
171                 return new Size(w, h);
172             }
173             set
174             {
175                 Interop.Evas.evas_object_image_size_set(RealHandle, value.Width, value.Height);
176             }
177         }
178
179         /// <summary>
180         /// Gets the row stride of the given image object.
181         /// </summary>
182         /// <since_tizen> preview </since_tizen>
183         [Obsolete("This has been deprecated in API12")]
184         public int Stride
185         {
186             get
187             {
188                 return Interop.Evas.evas_object_image_stride_get(RealHandle);
189             }
190         }
191
192         /// <summary>
193         /// Sets or gets whether the alpha channel data is being used on the given image object.
194         /// </summary>
195         /// <since_tizen> preview </since_tizen>
196         [Obsolete("This has been deprecated in API12")]
197         public bool IsOpaque
198         {
199             get
200             {
201                 return !Interop.Evas.evas_object_image_alpha_get(RealHandle);
202             }
203             set
204             {
205                 Interop.Evas.evas_object_image_alpha_set(RealHandle, !value);
206             }
207         }
208
209         /// <summary>
210         /// Sets or gets whether to use a high-quality image scaling algorithm on the given image object.
211         /// </summary>
212         /// <since_tizen> preview </since_tizen>
213         [Obsolete("This has been deprecated in API12")]
214         public bool IsSmoothScaled
215         {
216             get
217             {
218                 return Interop.Evas.evas_object_image_smooth_scale_get(RealHandle);
219             }
220             set
221             {
222                 Interop.Evas.evas_object_image_smooth_scale_set(RealHandle, value);
223             }
224         }
225
226         /// <summary>
227         /// Sets how to fill an image object's drawing rectangle given the (real) image bound to it.
228         /// </summary>
229         /// <param name="geometry">The rectangle of the given image object that the image will be drawn to.</param>
230         /// <since_tizen> preview </since_tizen>
231         [Obsolete("This has been deprecated in API12")]
232         public void SetFill(Rect geometry)
233         {
234             Interop.Evas.evas_object_image_fill_set(RealHandle, geometry.X, geometry.Y, geometry.Width, geometry.Height);
235         }
236
237         /// <summary>
238         /// Sets the source file from where an image object must fetch the real image data (it may be an Eet file, besides pure image ones).
239         /// </summary>
240         /// <param name="file">The image file path.</param>
241         /// <param name="key">The image key in file (if its an Eet one), otherwise set null.</param>
242         /// <since_tizen> preview </since_tizen>
243         [Obsolete("This has been deprecated in API12")]
244         public void SetFile(string file, string key)
245         {
246             Interop.Evas.evas_object_image_file_set(RealHandle, file, key);
247         }
248
249         /// <summary>
250         /// Sets the data for an image from the memory to be loaded.
251         /// </summary>
252         /// <param name="stream">memory stream</param>
253         /// <since_tizen> preview </since_tizen>
254         [Obsolete("This has been deprecated in API12")]
255         public void SetStream(Stream stream)
256         {
257             if (stream == null)
258                 throw new ArgumentNullException("stream");
259
260             MemoryStream memstream = new MemoryStream();
261             stream.CopyTo(memstream);
262             unsafe
263             {
264                 byte[] dataArr = memstream.ToArray();
265                 fixed (byte* data = &dataArr[0])
266                 {
267                     Interop.Evas.evas_object_image_memfile_set(RealHandle, data, dataArr.Length, IntPtr.Zero, IntPtr.Zero);
268                 }
269             }
270             memstream.Dispose();
271         }
272
273         /// <summary>
274         /// Sets the source object on an image object to be used as a proxy.
275         /// </summary>
276         /// <param name="source">The proxy (image) object.</param>
277         /// <returns>true if the source object is set successfully, otherwise false on error.</returns>
278         /// <since_tizen> preview </since_tizen>
279         [Obsolete("This has been deprecated in API12")]
280         public bool SetSource(EvasObject source)
281         {
282             bool result = false;
283             _source = source;
284             result = Interop.Evas.evas_object_image_source_set(RealHandle, IntPtr.Zero);
285             if (source != null)
286                 result = result && Interop.Evas.evas_object_image_source_set(RealHandle, source.Handle);
287             return result;
288         }
289
290         /// <summary>
291         /// Set the native surface of a given image of the canvas.
292         /// </summary>
293         /// <param name="surface">The surface.</param>
294         /// <since_tizen> preview </since_tizen>
295         [Obsolete("This has been deprecated in API12")]
296         [EditorBrowsable(EditorBrowsableState.Never)]
297         public void SetNativeSurface(IntPtr surface)
298         {
299             Interop.Evas.evas_object_image_native_surface_set(RealHandle, surface);
300         }
301
302         /// <summary>
303         /// Sets the dimensions for an image object's border, a region which is not scaled together with its center ever.
304         /// </summary>
305         /// <param name="left">The border's left width.</param>
306         /// <param name="right">The border's right width.</param>
307         /// <param name="top">The border's top width.</param>
308         /// <param name="bottom">The border's bottom width.</param>
309         /// <since_tizen> preview </since_tizen>
310         [Obsolete("This has been deprecated in API12")]
311         public void SetBorder(int left, int right, int top, int bottom)
312         {
313             Interop.Evas.evas_object_image_border_set(RealHandle, left, right, top, bottom);
314         }
315
316         /// <summary>
317         /// Save the given image object's contents to an (image) file.
318         ///
319         /// The extension suffix on file will determine which saver module Evas is to use when saving, thus the final file's format. If the file supports multiple data stored in it (Eet ones), you can specify the key to be used as the index of the image in it.
320         ///
321         /// You can specify some flags when saving the image.Currently acceptable flags are quality and compress.Eg.: "quality=100 compress=9" 
322         /// </summary>
323         /// <param name="file">The filename to be used to save the image (extension obligatory).</param>
324         /// <param name="key">The image key in the file (if an Eet one), or null, otherwise.</param>
325         /// <param name="flags">String containing the flags to be used (null for none).</param>
326         [Obsolete("This has been deprecated in API12")]
327         public void Save(string file, string key, string flags)
328         {
329             Interop.Evas.evas_object_image_save(RealHandle, file, key, flags);
330         }
331
332         /// <summary>
333         /// Sets the content at a part of a given container widget.
334         /// </summary>
335         /// <param name="parent">The parent is a given container, which will be attached by the image as a child. It's <see cref="EvasObject"/> type.</param>
336         /// <returns>The new object, otherwise null if it cannot be created.</returns>
337         /// <since_tizen> preview </since_tizen>
338         [Obsolete("This has been deprecated in API12")]
339         protected override IntPtr CreateHandle(EvasObject parent)
340         {
341             return _handle != IntPtr.Zero ? _handle : Interop.Evas.evas_object_image_add(Interop.Evas.evas_object_evas_get(parent.Handle));
342         }
343     }
344 }