mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 02:59:19 +01:00
31 lines
1.4 KiB
Scala
31 lines
1.4 KiB
Scala
package ocelot.desktop.graphics_v2
|
|
|
|
import ocelot.desktop.color.Color
|
|
import ocelot.desktop.geometry.{Rect2D, Transform2D}
|
|
|
|
trait Encoder2D {
|
|
|
|
/** Draws a rectangle with a specified image and color.
|
|
*
|
|
* @param rect Rectangle to draw (its position and size).
|
|
* @param image Fill image.
|
|
* Pass [[Image.None]] for a solid fill. (default).
|
|
* @param color Color which is multiplied with the image linearly, i.e. tint.
|
|
* Pass [[Color.White]] for no tint (default).
|
|
*/
|
|
def rect(rect: Rect2D, image: Image = Image.None, color: Color = Color.White): Unit
|
|
|
|
/** Draws a group of objects with various optional effects. Takes a callback with a sub-encoder.
|
|
*
|
|
* @param scissor Apply a scissor rectangle (specified in the coordinate system of this encoder,
|
|
* not local coordinates of the inner encoder).
|
|
* @param transform Apply a transform to the inner encoder.
|
|
* @param color Apply a tint color to the group as a whole (i.e. if you make it semi-transparent,
|
|
* the entire group will be transparent without any color mixing within the group).
|
|
* @param callback Callback taking a sub-encoder.
|
|
*/
|
|
def group(scissor: Option[Rect2D] = None,
|
|
transform: Transform2D = Transform2D.identity,
|
|
color: Color = Color.White)(callback: Encoder2D => Unit): Unit
|
|
}
|