Class PixelBuffer
Definition
- 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
- Implements
-
System.IDisposable
Constructors
View SourcePixelBuffer(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 SourceApplyGaussianBlur(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. |
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). |
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. |
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. |
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. |
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. |
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. |
GetBrightness()
Gets the brightness value of the pixel buffer.
Declaration
public uint GetBrightness()
Returns
Type | Description |
---|---|
uint |
GetBuffer()
Gets the pixel buffer
Declaration
public System.IntPtr GetBuffer()
Returns
Type | Description |
---|---|
System.IntPtr |
GetHeight()
Gets the height of the buffer in pixels.
Declaration
public uint GetHeight()
Returns
Type | Description |
---|---|
uint | The height of the buffer in pixels. |
GetPixelFormat()
Gets the pixel format.
Declaration
public PixelFormat GetPixelFormat()
Returns
Type | Description |
---|---|
PixelFormat | The pixel format. |
GetWidth()
Gets the width of the buffer in pixels.
Declaration
public uint GetWidth()
Returns
Type | Description |
---|---|
uint | The width of the buffer in pixels. |
ReleaseSwigCPtr(HandleRef)
Declaration
protected override void ReleaseSwigCPtr(Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type | Name | Description |
---|---|---|
Tizen.System.Runtime.InteropServices.HandleRef | swigCPtr |
Overrides
View SourceResize(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. |
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 |