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#Copypublic class PixelBuffer : BaseHandle, IDynamicResourceHandler, IElement, INameScope, IElementController, System.IDisposable
- Inheritance
- Implements
Constructors
Declaration
C#Copypublic 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
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#Copypublic 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
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#Copypublic void ApplyMask(PixelBuffer mask)
Parameters
Type | Name | Description |
---|---|---|
PixelBuffer | mask | The mask to apply. |
API Level: 5
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#Copypublic 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
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#Copypublic 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
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#Copypublic 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
CreatePixelData()
Copy the data from this object into a new PixelData object, which could be used for uploading to a texture.
Declaration
C#Copypublic PixelData CreatePixelData()
Returns
Type | Description |
---|---|
PixelData | The pixel data. |
API Level: 5
Declaration
C#Copypublic 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
Declaration
C#Copypublic uint GetBrightness()
Returns
Type | Description |
---|---|
UInt32 |
Declaration
C#Copypublic System.IntPtr GetBuffer()
Returns
Type | Description |
---|---|
System.IntPtr |
API Level: 8
Declaration
C#Copypublic uint GetHeight()
Returns
Type | Description |
---|---|
UInt32 | The height of the buffer in pixels. |
API Level: 5
Declaration
C#Copypublic PixelFormat GetPixelFormat()
Returns
Type | Description |
---|---|
PixelFormat | The pixel format. |
API Level: 5
Declaration
C#Copypublic uint GetWidth()
Returns
Type | Description |
---|---|
UInt32 | The width of the buffer in pixels. |
API Level: 5
Declaration
C#Copyprotected override void ReleaseSwigCPtr(Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type | Name | Description |
---|---|---|
Tizen.System.Runtime.InteropServices.HandleRef | swigCPtr |
Overrides
Declaration
C#Copypublic void Resize(ushort width, ushort height)
Parameters
Type | Name | Description |
---|---|---|
UInt16 | width | The new width. |
UInt16 | height | The new height. |
API Level: 5
Declaration
C#Copypublic bool Rotate(Degree angle)
Parameters
Type | Name | Description |
---|---|---|
Degree | angle | The angle in degrees. |
Returns
Type | Description |
---|---|
Boolean |