/* * 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 System.Threading.Tasks; namespace Tizen.Multimedia.Util { /// /// Provides the ability to transform an image. /// public class ImageTransformer : IDisposable { /// /// Initializes a new instance of the class. /// public ImageTransformer() { } /// /// Transforms an image with . /// /// to transform. The of this must be . /// to apply. /// A task that represents the asynchronous transforming operation. /// /// is null.
/// -or-
/// is null. ///
/// The has already been disposed of. /// Failed to apply . public Task TransformAsync(MediaPacket source, ImageTransform item) { if (_disposed) { throw new ObjectDisposedException(nameof(ImageTransformer)); } if (source == null) { throw new ArgumentNullException(nameof(source)); } if (item == null) { throw new ArgumentNullException(nameof(item)); } return item.ApplyAsync(source); } #region IDisposable Support private bool _disposed = false; /// /// Releases the unmanaged resources used by the ImageTransformer. /// /// true to release both managed and unmanaged resources; false to release only unmanaged resources. protected virtual void Dispose(bool disposing) { if (!_disposed) { _disposed = true; } } /// /// Releases all resources used by the ImageTransformer. /// public void Dispose() { Dispose(true); } #endregion } }