X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FTextureSet.cs;h=a92b909daaff6a5657d7d892aed5656617379a0c;hb=46b8a31f5c1c75a22b648ca394a4de8a50898513;hp=d43d490cf5f25e61b2a0f52f02062b0a25b68f8e;hpb=0fa1f62cb107e2e21bfa4d9c5f7b3f2a6a5626a0;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/TextureSet.cs b/src/Tizen.NUI/src/public/TextureSet.cs index d43d490..a92b909 100755 --- a/src/Tizen.NUI/src/public/TextureSet.cs +++ b/src/Tizen.NUI/src/public/TextureSet.cs @@ -1,125 +1,158 @@ -/** Copyright (c) 2017 Samsung Electronics Co., Ltd. -* -* 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. -* -*/ -// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts -//------------------------------------------------------------------------------ -// -// -// This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.9 -// -// Do not make changes to this file unless you know what you are doing--modify -// the SWIG interface file instead. -//------------------------------------------------------------------------------ +/* + * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * + * 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.Runtime.InteropServices; namespace Tizen.NUI { - + /// + /// TextureSet is a handle to an object that specifies the set of images used as textures by a renderer.
+ /// The images have to be ordered in the same order they are declared in the shader. + ///
+ /// 3 public class TextureSet : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; - internal TextureSet(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextureSet_SWIGUpcast(cPtr), cMemoryOwn) - { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextureSet obj) - { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - protected override void Dispose(DisposeTypes type) - { - if (disposed) - { - return; - } - - if (type == DisposeTypes.Explicit) - { - //Called by User - //Release your own managed resources here. - //You should release all of your own disposable objects here. - - } - - //Release your own unmanaged resources here. - //You should not access any managed member here except static instance. - //because the execution order of Finalizes is non-deterministic. - - if (swigCPtr.Handle != global::System.IntPtr.Zero) - { - if (swigCMemOwn) - { - swigCMemOwn = false; - NDalicPINVOKE.delete_TextureSet(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - base.Dispose(type); - } - - - public TextureSet() : this(NDalicPINVOKE.TextureSet_New(), true) + /// + /// Create an instance of TextureSet. + /// + /// 3 + public TextureSet() : this(Interop.TextureSet.TextureSet_New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - internal static TextureSet DownCast(BaseHandle handle) + internal TextureSet(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.TextureSet.TextureSet_SWIGUpcast(cPtr), cMemoryOwn) { - TextureSet ret = new TextureSet(NDalicPINVOKE.TextureSet_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } + /// + /// Sets the texture at position "index". + /// + /// The position in the texture set of the texture. + /// The texture. + /// 3 public void SetTexture(uint index, Texture texture) { - NDalicPINVOKE.TextureSet_SetTexture(swigCPtr, index, Texture.getCPtr(texture)); + Interop.TextureSet.TextureSet_SetTexture(swigCPtr, index, Texture.getCPtr(texture)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Gets the image at position "index". + /// + /// The position in the texture set of the image. + /// A handle to the image at the the specified position. + /// 3 public Texture GetTexture(uint index) { - Texture ret = new Texture(NDalicPINVOKE.TextureSet_GetTexture(swigCPtr, index), true); + //to fix memory leak issue, match the handle count with native side. + System.IntPtr cPtr = Interop.TextureSet.TextureSet_GetTexture(swigCPtr, index); + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + Texture ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Texture; + if (cPtr != null && ret == null) + { + ret = new Texture(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + Interop.BaseHandle.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + /// + /// Sets the sampler to be used by the image at position "index". + /// + /// The position in the texture set of the image. + /// The sampler to use. + /// 3 public void SetSampler(uint index, Sampler sampler) { - NDalicPINVOKE.TextureSet_SetSampler(swigCPtr, index, Sampler.getCPtr(sampler)); + Interop.TextureSet.TextureSet_SetSampler(swigCPtr, index, Sampler.getCPtr(sampler)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Sets the sampler to be used by the image at position "index". + /// + /// The position in the texture set of the image. + /// A handle to the sampler at the specified position. + /// 3 public Sampler GetSampler(uint index) { - Sampler ret = new Sampler(NDalicPINVOKE.TextureSet_GetSampler(swigCPtr, index), true); + //to fix memory leak issue, match the handle count with native side. + System.IntPtr cPtr = Interop.TextureSet.TextureSet_GetSampler(swigCPtr, index); + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + Sampler ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Sampler; + Interop.BaseHandle.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + /// + /// Gets the number of textures present in the TextureSet. + /// + /// The number of textures in the TextureSet. + /// 3 public uint GetTextureCount() { - uint ret = NDalicPINVOKE.TextureSet_GetTextureCount(swigCPtr); + uint ret = Interop.TextureSet.TextureSet_GetTextureCount(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - } + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextureSet obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } -} + /// + /// Dispose. + /// + /// 3 + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + Interop.TextureSet.delete_TextureSet(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + } +} \ No newline at end of file