Skip to content

RGB Render

Pour all your love into this render, because this is what your effect returns to Audectra. This render abstraction implements very powerful methods to walk through it.

The RGB render implements the following interface.

public interface IRender
{
    /// <summary>
    /// Height of the render in pixels.
    /// </summary>
    int Height { get; }

    /// <summary>
    /// Width of the render in pixels.
    /// </summary>
    int Width { get; }

    /// <summary>
    /// Create a Skia canvas for this render.
    /// Remember to dispose the canvas.
    /// </summary>
    /// <returns>Skia canvas</returns>
    SKCanvas CreateCanvas();

    /// <summary>
    /// Clear all pixels. Resets their colors to black.
    /// </summary>
    void Clear();

    /// <summary>
    /// Apply a function to all pixels. First parameter
    /// corresponds to the x coordinate and second parameter
    /// to the y coordinate of each pixel. Return value is the
    /// new value for the current pixel.
    /// </summary>
    /// <param name="mapFunc">function, which will be applied</param>
    void Map(Func<int, int, SKColor> mapFunc);

    /// <summary>
    /// Apply a function to all pixels. First parameter
    /// corresponds to the x coordinate, the second parameter
    /// to the y coordinate of each pixel and the third parameter to
    /// the current color of the pixel. Return value is the
    /// new value for the current pixel.
    /// </summary>
    /// <param name="mapFunc">function, which will be applied</param>
    void Map(Func<int, int, SKColor, SKColor> mapFunc);

    /// <summary>
    /// Apply a action to all pixels. First parameter
    /// corresponds to the x coordinate, the second parameter
    /// to the y coordinate of each pixel and the third parameter to
    /// the current color of the pixel. 
    /// </summary>
    /// <param name="mapFunc">function, which will be applied</param>
    void Map(Action<int, int, SKColor> mapFunc);

    /// <summary>
    /// Create a new clone of this render.
    /// </summary>
    /// <returns>clone of this render</returns>
    IRender Clone();

    /// <summary>
    /// Access the color the pixel with the supplied x
    /// and y coordinates. This can also be used to set
    /// the color of the corresponding pixel.
    /// </summary>
    /// <param name="x">x coordinate of the pixel</param>
    /// <param name="y">y coordinate of the pixel</param>
    /// <returns>current color of pixel</returns>
    SKColor this[int x, int y] { get; set; }
}