Class PixelBuffer

    Definition

    Namespace:
    Tizen.NUI
    Assembly:
    Tizen.NUI.dll

    The PixelBuffer object holds a pixel buffer. The PixelBuffer keeps ownership of its initial buffer. However, the user is free to modify the pixel data, either directly or via image operations.

    In order to upload the pixel data to the texture memory, there are two possibilities, either convert it back to a PixelData object, which releases the PixelBuffer object, leaving the user with an empty handle (ideal for one-time indirect image manipulation) or create a new PixelData object from this object, leaving the buffer intact (ideal for continuous manipulation).

    public class PixelBuffer : BaseHandle, IDynamicResourceHandler, INameScope, System.IDisposable
    Inheritance
    object
    BindableObject
    Element
    BaseHandle
    PixelBuffer
    Implements
    IDynamicResourceHandler
    INameScope
    System.IDisposable

    Constructors

    View Source

    PixelBuffer(uint, uint, PixelFormat)

    Create a PixelBuffer with its own data buffer.

    Declaration
    public PixelBuffer(uint width, uint height, PixelFormat pixelFormat)
    Parameters
    Type Name Description
    uint width

    The pixel buffer width.

    uint height

    The pixel buffer height.

    PixelFormat pixelFormat

    The pixel format.

    Methods

    View Source

    ApplyGaussianBlur(float)

    Apply a Gaussian blur to this pixel data with the given radius. A bigger radius will yield a blurrier image. Only works for pixel data in RGBA format.

    Declaration
    public void ApplyGaussianBlur(float blurRadius)
    Parameters
    Type Name Description
    float blurRadius

    The radius for Gaussian blur. A value of 0 or negative value indicates no blur.

    View Source

    ApplyMask(PixelBuffer, float, bool)

    Apply the mask to this pixel data and return a new pixel data that contains the masked image. If this PixelBuffer does not have an alpha channel, then the resultant PixelBuffer will be converted to a format that supports at least the width of the color channels and the alpha channel from the mask.

    If cropToMask is set to true, then the contentScale is applied first to this buffer, and the target buffer is cropped to the size of the mask. If it is set to false, then the mask is scaled to match the size of this buffer before the mask is applied.

    Declaration
    public void ApplyMask(PixelBuffer mask, float contentScale, bool cropToMask)
    Parameters
    Type Name Description
    PixelBuffer mask

    The mask to apply.

    float contentScale

    The scaling factor to apply to the content.

    bool cropToMask

    Whether to crop the output to the mask size (true) or scale the mask to the content size (false).

    View Source

    ApplyMask(PixelBuffer, float)

    Apply the mask to this pixel data and return a new pixel data containing the masked image. If this PixelBuffer does not have an alpha channel, then the resultant PixelBuffer will be converted to a format that supports at least the width of the color channels and the alpha channel from the mask.

    If cropToMask is set to true, then the contentScale is applied first to this buffer, and the target buffer is cropped to the size of the mask. If it is set to false, then the mask is scaled to match the size of this buffer before the mask is applied.

    Declaration
    public void ApplyMask(PixelBuffer mask, float contentScale)
    Parameters
    Type Name Description
    PixelBuffer mask

    The mask to apply.

    float contentScale

    The scaling factor to apply to the content.

    View Source

    ApplyMask(PixelBuffer)

    Apply the mask to this pixel data and return a new pixel data containing the masked image. If this PixelBuffer does not have an alpha channel, then the resultant PixelBuffer will be converted to a format that supports at least the width of the color channels and the alpha channel from the mask.

    If cropToMask is set to true, then the contentScale is applied first to this buffer, and the target buffer is cropped to the size of the mask. If it is set to false, then the mask is scaled to match the size of this buffer before the mask is applied.

    Declaration
    public void ApplyMask(PixelBuffer mask)
    Parameters
    Type Name Description
    PixelBuffer mask

    The mask to apply.

    View Source

    Convert(PixelBuffer)

    Convert to a pixel data and release the object of the pixelBuffer. This handle is left empty. Any other handles that keep a reference to this object will be left with no buffer. Trying to access it will return NULL.

    Declaration
    public static PixelData Convert(PixelBuffer pixelBuffer)
    Parameters
    Type Name Description
    PixelBuffer pixelBuffer

    A pixel buffer.

    Returns
    Type Description
    PixelData

    A new PixelData that takes ownership of the buffer of the pixelBuffer.

    View Source

    CreatePixelData()

    Copy the data from this object into a new PixelData object, which could be used for uploading to a texture.

    Declaration
    public PixelData CreatePixelData()
    Returns
    Type Description
    PixelData

    The pixel data.

    View Source

    Crop(ushort, ushort, ushort, ushort)

    Crops this buffer to the given crop rectangle.

    Declaration
    public void Crop(ushort x, ushort y, ushort width, ushort height)
    Parameters
    Type Name Description
    ushort x

    The top left corner's X.

    ushort y

    The top left corner's Y.

    ushort width

    The crop width.

    ushort height

    The crop height.

    View Source

    GetBrightness()

    Gets the brightness value of the pixel buffer.

    Declaration
    public uint GetBrightness()
    Returns
    Type Description
    uint
    View Source

    GetBuffer()

    Gets the pixel buffer

    Declaration
    public System.IntPtr GetBuffer()
    Returns
    Type Description
    System.IntPtr
    View Source

    GetHeight()

    Gets the height of the buffer in pixels.

    Declaration
    public uint GetHeight()
    Returns
    Type Description
    uint

    The height of the buffer in pixels.

    View Source

    GetPixelFormat()

    Gets the pixel format.

    Declaration
    public PixelFormat GetPixelFormat()
    Returns
    Type Description
    PixelFormat

    The pixel format.

    View Source

    GetWidth()

    Gets the width of the buffer in pixels.

    Declaration
    public uint GetWidth()
    Returns
    Type Description
    uint

    The width of the buffer in pixels.

    View Source

    ReleaseSwigCPtr(HandleRef)

    Declaration
    protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
    Parameters
    Type Name Description
    System.Runtime.InteropServices.HandleRef swigCPtr
    Overrides
    BaseHandle.ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef)
    View Source

    Resize(ushort, ushort)

    Resizes the buffer to the given dimensions.

    Declaration
    public void Resize(ushort width, ushort height)
    Parameters
    Type Name Description
    ushort width

    The new width.

    ushort height

    The new height.

    View Source

    Rotate(Degree)

    Rotate the buffer by the given angle.

    Declaration
    public bool Rotate(Degree angle)
    Parameters
    Type Name Description
    Degree angle

    The angle in degrees.

    Returns
    Type Description
    bool

    Implements

    IDynamicResourceHandler
    INameScope
    System.IDisposable

    Extension Methods

    BindableObjectExtensions.SetBinding(BindableObject, BindableProperty, string, BindingMode, IValueConverter, string)
    NameScopeExtensions.FindByName<T>(Element, string)
    EXamlExtensions.LoadFromEXaml<T>(T, string)
    EXamlExtensions.LoadFromEXamlByRelativePath<T>(T, string)
    EXamlExtensions.LoadFromEXamlPath<TXaml>(TXaml, string)
    EXamlExtensions.LoadFromEXamlPath<T>(T, Type)
    Extensions.LoadFromXaml<TXaml>(TXaml, string)
    Extensions.LoadFromXaml<TXaml>(TXaml, Type)
    Extensions.LoadFromXamlFile<TXaml>(TXaml, string)
    • View Source
    Back to top Copyright © 2016-2025 Samsung
    Generated by DocFX