///|
pub(all) struct ImageDropShadow2D {
  offset : @math.Vec2
  blur_radius : Double
  color : @render.Color
} derive(Eq, Debug)

///|
pub fn ImageDropShadow2D::ImageDropShadow2D(
  color : @render.Color,
  offset? : @math.Vec2 = @math.Vec2::zero(),
  blur_radius? : Double = 0.0,
) -> ImageDropShadow2D {
  { offset, blur_radius: blur_radius.max(0.0), color }
}

///|
pub(all) struct ImageMaterialDrawCommand2D {
  image : ImageDrawCommand2D
  opacity : Double
  brightness : Double
  saturation : Double
  drop_shadow : ImageDropShadow2D?
}

///|
pub fn ImageMaterialDrawCommand2D::ImageMaterialDrawCommand2D(
  image : ImageDrawCommand2D,
  opacity? : Double = 1.0,
  brightness? : Double = 1.0,
  saturation? : Double = 1.0,
  drop_shadow? : ImageDropShadow2D? = None,
) -> ImageMaterialDrawCommand2D {
  {
    image,
    opacity: opacity.clamp(min=0.0, max=1.0),
    brightness: brightness.max(0.0),
    saturation: saturation.max(0.0),
    drop_shadow,
  }
}

///|
pub fn ImageMaterialDrawCommand2D::is_neutral(
  self : ImageMaterialDrawCommand2D,
) -> Bool {
  (self.opacity - 1.0).abs() < 0.000001 &&
  (self.brightness - 1.0).abs() < 0.000001 &&
  (self.saturation - 1.0).abs() < 0.000001 &&
  self.drop_shadow is None
}