2 * Copyright(c) 2019 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;
22 /// This will be released at Tizen.NET API Level 6, so currently this would be used as inhouse API.
23 [EditorBrowsable(EditorBrowsableState.Never)]
24 public class FrameBuffer : BaseHandle
27 internal FrameBuffer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
31 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
33 Interop.FrameBuffer.DeleteFrameBuffer(swigCPtr);
36 /// <since_tizen> 3 </since_tizen>
37 public sealed class Attachment
39 /// <since_tizen> 3 </since_tizen>
45 DEPTH_STENCIL = DEPTH | STENCIL
49 public FrameBuffer(uint width, uint height, uint attachments) : this(Interop.FrameBuffer.New(width, height, attachments), true)
51 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
55 public void AttachColorTexture(Texture texture)
57 Interop.FrameBuffer.AttachColorTexture(SwigCPtr, Texture.getCPtr(texture));
58 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61 public void AttachColorTexture(Texture texture, uint mipmapLevel, uint layer)
63 Interop.FrameBuffer.AttachColorTexture(SwigCPtr, Texture.getCPtr(texture), mipmapLevel, layer);
64 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 public Texture GetColorTexture()
69 global::System.IntPtr cPtr = Interop.FrameBuffer.GetColorTexture(SwigCPtr);
70 Texture ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Texture;
73 Interop.BaseHandle.DeleteBaseHandle(new global::System.Runtime.InteropServices.HandleRef(this, cPtr));
77 ret = new Texture(cPtr, true);
79 NDalicPINVOKE.ThrowExceptionIfExists();
84 /// Generate URI from current buffer.
86 /// <param name="pixelFormat">The pixel format for this frame buffer</param>
87 /// <param name="width">The width for this frame buffer</param>
88 /// <param name="height">The height for this frame buffer</param>
89 public ImageUrl GenerateUrl(PixelFormat pixelFormat, int width, int height)
91 return new ImageUrl(Interop.FrameBuffer.GenerateUrl(this.SwigCPtr.Handle, (int)pixelFormat, width, height), true);