2 * Copyright(c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
26 [EditorBrowsable(EditorBrowsableState.Never)]
27 public class NativeImageSource : NativeImageInterface
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public NativeImageSource(uint width, uint height, ColorDepth depth) : this(Interop.NativeImageSource.NewHandle(width, height, (int)depth), true)
33 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36 private IntPtr Handle;
37 internal NativeImageSource(IntPtr cPtr, bool cMemoryOwn) : base(Interop.NativeImageSource.Upcast(Interop.NativeImageSource.New(cPtr)), cMemoryOwn)
44 /// Get URI from native image source.
46 [EditorBrowsable(EditorBrowsableState.Never)]
52 uri = Interop.NativeImageSource.GenerateUrl(this.swigCPtr.Handle);
53 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
58 [EditorBrowsable(EditorBrowsableState.Never)]
59 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
61 Interop.NativeImageSource.Delete(Handle);
62 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
65 [EditorBrowsable(EditorBrowsableState.Never)]
66 public enum ColorDepth
75 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(NativeImageSource obj)
77 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
80 [EditorBrowsable(EditorBrowsableState.Never)]
81 public IntPtr AcquireBuffer(ref int width, ref int height, ref int stride)
83 IntPtr ret = Interop.NativeImageSource.AcquireBuffer(this.swigCPtr.Handle, ref width, ref height, ref stride);
84 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88 [EditorBrowsable(EditorBrowsableState.Never)]
89 public bool ReleaseBuffer()
91 bool ret = Interop.NativeImageSource.ReleaseBuffer(this.swigCPtr.Handle);
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();