/* * 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; using ElmSharp; namespace Tizen.Multimedia { internal enum DisplayType { /// /// Overlay surface display /// Overlay, /// /// Evas image object surface display /// Surface, /// /// This disposes off buffers /// None, } internal interface IDisplayable { ErrorType ApplyEvasDisplay(DisplayType type, EvasObject evasObject); } /// /// Provides a means to wrap various display types. /// /// /// /// public class Display { private Display(DisplayType type, EvasObject target) { if (target == null) { throw new ArgumentNullException(nameof(target)); } if (target == IntPtr.Zero) { throw new ArgumentException("The evas object is not realized."); } Type = type; EvasObject = target; } /// /// Initializes a new instance of the class with a class. /// /// http://tizen.org/feature/multimedia.raw_video /// The required feature is not supported. public Display(MediaView mediaView) : this(DisplayType.Surface, mediaView) { ValidationUtil.ValidateFeatureSupported(Features.RawVideo); } /// /// Initializes a new instance of the class with a class. /// public Display(Window window) : this(DisplayType.Overlay, window) { } private EvasObject EvasObject { get; } private DisplayType Type { get; } private object _owner; internal object Owner => _owner; internal void SetOwner(object newOwner) { if (_owner != null && newOwner != null) { throw new ArgumentException("The display has already been assigned to another."); } _owner = newOwner; } internal ErrorType ApplyTo(IDisplayable target) { return target.ApplyEvasDisplay(Type, EvasObject); } } }