2 * Copyright(c) 2021 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.
18 using System.ComponentModel;
24 [EditorBrowsable(EditorBrowsableState.Never)]
25 public class NativeImageSource : NativeImageInterface
27 private IntPtr handle;
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public NativeImageSource(uint width, uint height, ColorDepth depth) : this(Interop.NativeImageSource.NewHandle(width, height, (int)depth), true)
32 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
35 internal NativeImageSource(IntPtr cPtr, bool cMemoryOwn) : base(Interop.NativeImageSource.New(cPtr), cMemoryOwn)
41 /// Generate Url from native image source.
43 [EditorBrowsable(EditorBrowsableState.Never)]
44 public ImageUrl GenerateUrl()
46 ImageUrl ret = new ImageUrl(Interop.NativeImageSource.GenerateUrl(this.SwigCPtr.Handle), true);
47 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
51 [EditorBrowsable(EditorBrowsableState.Never)]
52 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
54 Interop.NativeImageSource.Delete(handle);
55 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
58 [EditorBrowsable(EditorBrowsableState.Never)]
59 public enum ColorDepth
68 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(NativeImageSource obj)
70 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
73 [EditorBrowsable(EditorBrowsableState.Never)]
74 public IntPtr AcquireBuffer(ref int width, ref int height, ref int stride)
76 IntPtr ret = Interop.NativeImageSource.AcquireBuffer(this.SwigCPtr.Handle, ref width, ref height, ref stride);
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public bool ReleaseBuffer()
84 bool ret = Interop.NativeImageSource.ReleaseBuffer(this.SwigCPtr.Handle);
85 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();