X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FTexture.cs;h=df693004792d264ee9492fe3af8bca069710db17;hb=46b8a31f5c1c75a22b648ca394a4de8a50898513;hp=2503ca5cf8acc1dd1ffb2e4ed57525a434831f3d;hpb=b72d01599d5ea76b2c44322b430950cf0b459898;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/Texture.cs b/src/Tizen.NUI/src/public/Texture.cs index 2503ca5..df69300 100755 --- a/src/Tizen.NUI/src/public/Texture.cs +++ b/src/Tizen.NUI/src/public/Texture.cs @@ -1,119 +1,152 @@ -/** 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. -* -*/ +/* + * 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. + * + */ namespace Tizen.NUI { - + /// + /// Texture represents a texture object used as input or output by shaders. + /// + /// 3 public class Texture : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; - internal Texture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Texture_SWIGUpcast(cPtr), cMemoryOwn) + /// + /// Creates a new Texture object. + /// + /// The type of the texture. + /// The format of the pixel data. + /// The width of the texture. + /// The height of the texture. + /// 3 + public Texture(TextureType type, PixelFormat format, uint width, uint height) : this(Interop.Texture.Texture_New__SWIG_0((int)type, (int)format, width, height), true) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Texture 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_Texture(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - base.Dispose(type); } - - public Texture(TextureType type, PixelFormat format, uint width, uint height) : this(NDalicPINVOKE.Texture_New__SWIG_0((int)type, (int)format, width, height), true) + internal Texture(NativeImageInterface nativeImageInterface) : this(Interop.Texture.Texture_New__SWIG_1(NativeImageInterface.getCPtr(nativeImageInterface)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal Texture(NativeImageInterface nativeImageInterface) : this(NDalicPINVOKE.Texture_New__SWIG_1(NativeImageInterface.getCPtr(nativeImageInterface)), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + internal Texture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Texture.Texture_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } + /// + /// Uploads data to the texture from a PixelData object. + /// + /// The pixelData object. + /// True if the PixelData object has compatible pixel format and fits within the texture, false otherwise. + /// 3 public bool Upload(PixelData pixelData) { - bool ret = NDalicPINVOKE.Texture_Upload__SWIG_0(swigCPtr, PixelData.getCPtr(pixelData)); + bool ret = Interop.Texture.Texture_Upload__SWIG_0(swigCPtr, PixelData.getCPtr(pixelData)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + /// + /// Uploads data to the texture from a PixelData object. + /// + /// The pixelData object. + /// The layer of a cube map or array texture. + /// The level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// The horizontal offset of the rectangular area in the texture that will be updated. + /// The vertical offset of the rectangular area in the texture that will be updated. + /// The width of the rectangular area in the texture that will be updated. + /// height of the rectangular area in the texture that will be updated. + /// True if the PixelData object has compatible pixel format and fits within the texture, false otherwise. + /// 3 public bool Upload(PixelData pixelData, uint layer, uint mipmap, uint xOffset, uint yOffset, uint width, uint height) { - bool ret = NDalicPINVOKE.Texture_Upload__SWIG_1(swigCPtr, PixelData.getCPtr(pixelData), layer, mipmap, xOffset, yOffset, width, height); + bool ret = Interop.Texture.Texture_Upload__SWIG_1(swigCPtr, PixelData.getCPtr(pixelData), layer, mipmap, xOffset, yOffset, width, height); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + /// + /// Generates mipmaps for the texture.
+ /// This will auto generate all the mipmaps for the texture based on the data in the base level. + ///
+ /// 3 public void GenerateMipmaps() { - NDalicPINVOKE.Texture_GenerateMipmaps(swigCPtr); + Interop.Texture.Texture_GenerateMipmaps(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Returns the width of the texture.
+ ///
+ /// The width, in pixels, of the texture. + /// 3 public uint GetWidth() { - uint ret = NDalicPINVOKE.Texture_GetWidth(swigCPtr); + uint ret = Interop.Texture.Texture_GetWidth(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + /// + /// Returns the height of the texture..
+ ///
+ /// The height, in pixels, of the texture. + /// 3 public uint GetHeight() { - uint ret = NDalicPINVOKE.Texture_GetHeight(swigCPtr); + uint ret = Interop.Texture.Texture_GetHeight(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - internal Texture(SWIGTYPE_p_Dali__Internal__Texture pointer) : this(NDalicPINVOKE.new_Texture__SWIG_2(SWIGTYPE_p_Dali__Internal__Texture.getCPtr(pointer)), true) + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Texture obj) { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + 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.Texture.delete_Texture(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + } +} \ No newline at end of file