2026-07-25 12:39:32 +02:00
|
|
|
internal import CPlaydate
|
|
|
|
|
|
|
|
|
|
extension Graphics {
|
|
|
|
|
/// How source pixels combine with the destination when drawing.
|
|
|
|
|
public enum DrawMode: UInt32, Sendable {
|
2026-07-25 12:55:53 +02:00
|
|
|
/// Source pixels replace the destination.
|
2026-07-25 12:39:32 +02:00
|
|
|
case copy = 0
|
2026-07-25 12:55:53 +02:00
|
|
|
/// White source pixels are treated as transparent.
|
2026-07-25 12:39:32 +02:00
|
|
|
case whiteTransparent = 1
|
2026-07-25 12:55:53 +02:00
|
|
|
/// Black source pixels are treated as transparent.
|
2026-07-25 12:39:32 +02:00
|
|
|
case blackTransparent = 2
|
2026-07-25 12:55:53 +02:00
|
|
|
/// Opaque source pixels draw white.
|
2026-07-25 12:39:32 +02:00
|
|
|
case fillWhite = 3
|
2026-07-25 12:55:53 +02:00
|
|
|
/// Opaque source pixels draw black.
|
2026-07-25 12:39:32 +02:00
|
|
|
case fillBlack = 4
|
2026-07-25 12:55:53 +02:00
|
|
|
/// Source pixels are XORed with the destination.
|
2026-07-25 12:39:32 +02:00
|
|
|
case xor = 5
|
2026-07-25 12:55:53 +02:00
|
|
|
/// The inverse of `xor`.
|
2026-07-25 12:39:32 +02:00
|
|
|
case nxor = 6
|
2026-07-25 12:55:53 +02:00
|
|
|
/// Source pixels draw inverted.
|
2026-07-25 12:39:32 +02:00
|
|
|
case inverted = 7
|
|
|
|
|
|
|
|
|
|
init(_ mode: LCDBitmapDrawMode) { self = DrawMode(rawValue: UInt32(mode.rawValue)) ?? .copy }
|
|
|
|
|
var cValue: LCDBitmapDrawMode { LCDBitmapDrawMode(LCDBitmapDrawMode.RawValue(rawValue)) }
|
|
|
|
|
}
|
|
|
|
|
}
|