Class PixelBuffer

Definition

Namespace:
Tizen.NUI
Assembly:
Tizen.NUI.dll
API Level:
5

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).

C#
Copy
public class PixelBuffer : BaseHandle, IDynamicResourceHandler, IElement, INameScope, IElementController, System.IDisposable
Inheritance
Implements

Constructors

View Source

PixelBuffer(UInt32, UInt32, PixelFormat)

Create a PixelBuffer with its own data buffer.

Declaration
C#
Copy
public PixelBuffer(uint width, uint height, PixelFormat pixelFormat)
Parameters
Type Name Description
UInt32 width

The pixel buffer width.

UInt32 height

The pixel buffer height.

PixelFormat pixelFormat

The pixel format.

API Level: 5

Methods

View Source

ApplyGaussianBlur(Single)

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
C#
Copy
public void ApplyGaussianBlur(float blurRadius)
Parameters
Type Name Description
Single blurRadius

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

API Level: 5
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
C#
Copy
public void ApplyMask(PixelBuffer mask)
Parameters
Type Name Description
PixelBuffer mask

The mask to apply.

API Level: 5
View Source

ApplyMask(PixelBuffer, Single)

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
C#
Copy
public void ApplyMask(PixelBuffer mask, float contentScale)
Parameters
Type Name Description
PixelBuffer mask

The mask to apply.

Single contentScale

The scaling factor to apply to the content.

API Level: 5
View Source

ApplyMask(PixelBuffer, Single, Boolean)

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
C#
Copy
public void ApplyMask(PixelBuffer mask, float contentScale, bool cropToMask)
Parameters
Type Name Description
PixelBuffer mask

The mask to apply.

Single contentScale

The scaling factor to apply to the content.

Boolean cropToMask

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

API Level: 5
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
C#
Copy
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.

API Level: 5
View Source

CreatePixelData()

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

Declaration
C#
Copy
public PixelData CreatePixelData()
Returns
Type Description
PixelData

The pixel data.

API Level: 5
View Source

Crop(UInt16, UInt16, UInt16, UInt16)

Crops this buffer to the given crop rectangle.

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

The top left corner's X.

UInt16 y

The top left corner's Y.

UInt16 width

The crop width.

UInt16 height

The crop height.

API Level: 5
View Source

GetBrightness()

Gets the brightness value of the pixel buffer.

Declaration
C#
Copy
public uint GetBrightness()
Returns
Type Description
UInt32
View Source

GetBuffer()

Gets the pixel buffer

Declaration
C#
Copy
public System.IntPtr GetBuffer()
Returns
Type Description
System.IntPtr
API Level: 8
View Source

GetHeight()

Gets the height of the buffer in pixels.

Declaration
C#
Copy
public uint GetHeight()
Returns
Type Description
UInt32

The height of the buffer in pixels.

API Level: 5
View Source

GetPixelFormat()

Gets the pixel format.

Declaration
C#
Copy
public PixelFormat GetPixelFormat()
Returns
Type Description
PixelFormat

The pixel format.

API Level: 5
View Source

GetWidth()

Gets the width of the buffer in pixels.

Declaration
C#
Copy
public uint GetWidth()
Returns
Type Description
UInt32

The width of the buffer in pixels.

API Level: 5
View Source

ReleaseSwigCPtr(Runtime.InteropServices.HandleRef)

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

Resize(UInt16, UInt16)

Resizes the buffer to the given dimensions.

Declaration
C#
Copy
public void Resize(ushort width, ushort height)
Parameters
Type Name Description
UInt16 width

The new width.

UInt16 height

The new height.

API Level: 5
View Source

Rotate(Degree)

Rotate the buffer by the given angle.

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

The angle in degrees.

Returns
Type Description
Boolean
API Level: 8

Implements

Extension Methods