![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
The video surface interface.
The video surface stores properties and pixel data of a graphic image. The video surface offers cloning of surfaces of different pixel format and size, copying rectangular regions from other video surfaces and applying matte colors.
Create a clone of the surface with a specified pixel format.
Murl.IVideoSurface Clone(Murl.IEnums.PixelFormat pixelFormat)
pixelFormat | The pixel format of the new surface. |
Create a clone of the surface with a specified size. Scaling to different size is supported for IEnums::PIXEL_FORMAT_R8_G8_B8_A8 and IEnums::PIXEL_FORMAT_R8_G8_B8 only.
Murl.IVideoSurface Clone(Integer pixelSizeX, Integer pixelSizeY, Murl.IVideoScaler scaler, Number gamma)
pixelSizeX | The number of horizontal pixels of the new surface. |
pixelSizeY | The number of vertical pixels of the new surface. |
scaler | Pointer to a scaler object or null to scale using the BoxVideoScaler. |
gamma | The gamma value used during cloning. |
Create a clone of the surface with a specified pixel format and size. Scaling to different size is supported for IEnums::PIXEL_FORMAT_R8_G8_B8_A8 and IEnums::PIXEL_FORMAT_R8_G8_B8 only.
Murl.IVideoSurface Clone(Murl.IEnums.PixelFormat pixelFormat, Integer pixelSizeX, Integer pixelSizeY, Murl.IVideoScaler scaler, Number gamma)
pixelFormat | The pixel format of the new surface. |
pixelSizeX | The number of horizontal pixels of the new surface. |
pixelSizeY | The number of vertical pixels of the new surface. |
scaler | Pointer to a scaler object or null to scale using the BoxVideoScaler. |
gamma | The gamma value used during cloning. |
Create a clone of the surface with a specified orientation.
Murl.IVideoSurface CloneRotated(Murl.IEnums.Orientation orientation)
orientation | The orientation of the new surface. |
Create a clone of the surface with a specified orientation and pixel format.
Murl.IVideoSurface CloneRotated(Murl.IEnums.Orientation orientation, Murl.IEnums.PixelFormat pixelFormat)
orientation | The orientation of the new surface. |
pixelFormat | The pixel format of the new surface. |
Create a surface and copy a specified rectangular region.
Murl.IVideoSurface CloneFrame(Integer positionX, Integer positionY, Integer pixelSizeX, Integer pixelSizeY)
positionX | The source x-position of the region. |
positionY | The source y-position of the region. |
pixelSizeX | The number of horizontal pixels of the region. |
pixelSizeY | The number of vertical pixels of the region. |
Get the number of horizontal pixels.
Integer GetPixelSizeX()
Get the number of vertical pixels.
Integer GetPixelSizeY()
Get the number of bytes per line.
Integer GetBytesPerLine()
Get the number of bytes per pixel.
Integer GetBytesPerPixel()
Get the pixel format of the surface.
Murl.IEnums.PixelFormat GetPixelFormat()
Get the data object which is holding the pixels.
Murl.ConstData GetPixels()
Get the mutable data object which is holding the pixels.
Murl.MutableData GetMutablePixels()
Get the color of a pixel.
Murl.Color GetPixel(Integer positionX, Integer positionY)
positionX | The pixel x-position. |
positionY | The pixel y-position. |
Set the color of a pixel.
Boolean SetPixel(Integer positionX, Integer positionY, Murl.Color color)
positionX | The pixel x-position. |
positionY | The pixel y-position. |
color | The color of the pixel to set. |
Horizontally flip the surface.
Boolean FlipX()
Vertically flip the surface.
Boolean FlipY()
Copy a source surface to a specified position. All cases of overlapping are supported.
Boolean Blit(Murl.IVideoSurface source, Integer destPositionX, Integer destPositionY)
source | The source surface. |
destPositionX | The destination x-position. |
destPositionY | The destination y-position. |
Copy a rectangular region from a source surface to a specified position. All cases of overlapping are supported.
Boolean Blit(Murl.IVideoSurface source, Integer sourcePositionX, Integer sourcePositionY, Integer destPositionX, Integer destPositionY, Integer pixelSizeX, Integer pixelSizeY)
source | The source surface. |
sourcePositionX | The source x-position. |
sourcePositionY | The source y-position. |
destPositionX | The destination x-position. |
destPositionY | The destination y-position. |
pixelSizeX | The number of horizontal pixels to copy. |
pixelSizeY | The number of vertical pixels to copy. |
Copy a source surface of different size. Scaling to different size is supported for IEnums::PIXEL_FORMAT_R8_G8_B8_A8 and IEnums::PIXEL_FORMAT_R8_G8_B8 only.
Boolean BlitScaled(Murl.IVideoSurface source, Murl.IVideoScaler scaler, Number gamma)
source | The source surface. |
scaler | Pointer to a scaler object or null to scale using the BoxVideoScaler. |
gamma | The gamma value used during scaling. |
Clear a rectangular region of the surface.
Boolean Clear(Integer positionX, Integer positionY, Integer pixelSizeX, Integer pixelSizeY, Murl.Color clearColor)
positionX | The source x-position of the region. |
positionY | The source y-position of the region. |
pixelSizeX | The number of horizontal pixels of the region. |
pixelSizeY | The number of vertical pixels of the region. |
clearColor | The clear color to apply. |
Clear the surface.
Boolean Clear(Murl.Color clearColor)
clearColor | The clear color to apply. |
Perform a Gauss blur operation on the surface.
Boolean GaussBlur(Number strength)
strength | The blur filter strength. |
Perform a Gauss blur operation on the surface.
Boolean GaussBlur(Integer positionX, Integer positionY, Integer pixelSizeX, Integer pixelSizeY, Number strength)
positionX | The x-position of the region. |
positionY | The y-position of the region. |
pixelSizeX | The number of horizontal pixels of the region. |
pixelSizeY | The number of vertical pixels of the region. |
strength | The blur filter strength. |
Apply a matte fringe using a specified alpha threshold value. This operation affects all pixels whose alpha value is below or equal the given threshold. For these pixels, an average color value is calculated from all pixels within X/Y distance of "matteFringe" with alpha also nonzero. Applying matte fringe is supported for IEnums::PIXEL_FORMAT_R8_G8_B8_A8, IEnums::PIXEL_FORMAT_L8_A8 and IEnums::PIXEL_FORMAT_R5_G5_B5_A1 only.
Boolean ApplyMatteFringe(Integer matteFringe, Number matteThreshold)
matteFringe | The matte fringe size to apply. |
matteThreshold | The alpha threshold in range [0.0 .. 1.0]. |
Apply a matte color to a rectangular region using a specified alpha threshold value. This operation affects all pixels whose alpha value is below or equal the given threshold. For these pixels, an average color value is calculated from all pixels within X/Y distance of "matteFringe" with alpha also nonzero. Applying matte fringe is supported for IEnums::PIXEL_FORMAT_R8_G8_B8_A8, IEnums::PIXEL_FORMAT_L8_A8 and IEnums::PIXEL_FORMAT_R5_G5_B5_A1 only.
Boolean ApplyMatteFringe(Integer positionX, Integer positionY, Integer pixelSizeX, Integer pixelSizeY, Integer matteFringe, Number matteThreshold)
positionX | The source x-position of the region. |
positionY | The source y-position of the region. |
pixelSizeX | The number of horizontal pixels of the region. |
pixelSizeY | The number of vertical pixels of the region. |
matteFringe | The matte fringe size to apply. |
matteThreshold | The alpha threshold in range [0.0 .. 1.0]. |
Apply a matte color to a rectangular region using a specified alpha threshold value. The matte color's RGB values are set to all pixels which alpha values are less or equal to the specified alpha threshold value. Applying matte color is supported for IEnums::PIXEL_FORMAT_R8_G8_B8_A8, IEnums::PIXEL_FORMAT_L8_A8 and IEnums::PIXEL_FORMAT_R5_G5_B5_A1 only.
Boolean ApplyMatteColor(Integer positionX, Integer positionY, Integer pixelSizeX, Integer pixelSizeY, Murl.Color matteColor, Number matteThreshold)
positionX | The source x-position of the region. |
positionY | The source y-position of the region. |
pixelSizeX | The number of horizontal pixels of the region. |
pixelSizeY | The number of vertical pixels of the region. |
matteColor | The matte color to apply. |
matteThreshold | The alpha threshold in range [0.0 .. 1.0]. |
Apply a matte color using a specified alpha threshold value. The matte color's RGB values are set to all pixels which alpha values are less or equal to the specified alpha threshold value. Applying matte color is supported for IEnums::PIXEL_FORMAT_R8_G8_B8_A8, IEnums::PIXEL_FORMAT_L8_A8 and IEnums::PIXEL_FORMAT_R5_G5_B5_A1 only.
Boolean ApplyMatteColor(Murl.Color matteColor, Number matteThreshold)
matteColor | The matte color to apply. |
matteThreshold | The alpha threshold in range [0.0 .. 1.0]. |
Render some text into the surface using a given font.
Boolean RenderText(Murl.IFont font, String text, Murl.Color textColor, Murl.Color backgroundColor, Boolean clearSurface, Boolean enableWordWrap, Number containerPosX, Number containerPosY, Number containerSizeX, Number containerSizeY, Murl.IEnums.TextAlignmentX alignX, Murl.IEnums.TextAlignmentY alignY)
font | The font used for rendering. |
text | The text to render. |
textColor | The text color to render. |
backgroundColor | The text background color to render. |
clearSurface | If true, the output surface is cleared before rendering. |
enableWordWrap | If true, word wrapping is enabled. |
containerPosX | The horizontal text position in the video stream. |
containerPosY | The vertical text position in the video stream. |
containerSizeX | The horizontal size of the text rectangle, or 0 if the video stream's X size should be used |
containerSizeY | The vertical size of the text rectangle, or 0 if the video stream's Y size should be used |
alignX | The horizontal text alignment. |
alignY | The vertical text alignment. |
Check if a column is empty using a specified alpha threshold value. Checking is supported for IEnums::PIXEL_FORMAT_R8_G8_B8_A8 and IEnums::PIXEL_FORMAT_R5_G5_B5_A1 only.
Boolean IsColumnEmpty(Integer column, Number threshold)
column | The zero-based column. |
threshold | The alpha threshold in range [0.0 .. 1.0]. |
Check if a row is empty using a specified alpha threshold value. Checking is supported for IEnums::PIXEL_FORMAT_R8_G8_B8_A8 and IEnums::PIXEL_FORMAT_R5_G5_B5_A1 only.
Boolean IsRowEmpty(Integer row, Number threshold)
row | The zero-based row. |
threshold | The alpha threshold in range [0.0 .. 1.0]. |
Clip the width relative to a position and the right border of the surface.
Integer ClipSizeXRight(Integer positionX, Integer sizeX)
positionX | The x-position. |
sizeX | The number of horzontal pixels. |
Clip the height relative to a position and the bottom border of the surface.
Integer ClipSizeYBottom(Integer positionY, Integer sizeY)
positionY | The y-position. |
sizeY | The number of vertical pixels. |
Evict restoreable resoures. Evictable surfaces can free resources e.g. on memory low warnings. These resources can be restored later by calling Restore().
Boolean Evict()
Restore evictable resoures freed by Evict().
Boolean Restore()