const std = @import("std");
pub const c = @import("c.zig").c;

pub const BlendMode = u32;

pub const BlendOperation = enum(c_int) {
    blendoperationAdd, //dst + src: supported by all renderers
    blendoperationSubtract, //src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan
    blendoperationRevSubtract, //dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan
    blendoperationMinimum, //min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan
    blendoperationMaximum,
};

pub const BlendFactor = enum(c_int) {
    blendfactorZero, //0, 0, 0, 0
    blendfactorOne, //1, 1, 1, 1
    blendfactorSrcColor, //srcR, srcG, srcB, srcA
    blendfactorOneMinusSrcColor, //1-srcR, 1-srcG, 1-srcB, 1-srcA
    blendfactorSrcAlpha, //srcA, srcA, srcA, srcA
    blendfactorOneMinusSrcAlpha, //1-srcA, 1-srcA, 1-srcA, 1-srcA
    blendfactorDstColor, //dstR, dstG, dstB, dstA
    blendfactorOneMinusDstColor, //1-dstR, 1-dstG, 1-dstB, 1-dstA
    blendfactorDstAlpha, //dstA, dstA, dstA, dstA
    blendfactorOneMinusDstAlpha,
};

pub inline fn composeCustomBlendMode(srcColorFactor: BlendFactor, dstColorFactor: BlendFactor, colorOperation: BlendOperation, srcAlphaFactor: BlendFactor, dstAlphaFactor: BlendFactor, alphaOperation: BlendOperation) BlendMode {
    return @intFromEnum(c.SDL_ComposeCustomBlendMode(srcColorFactor, dstColorFactor, @intFromEnum(colorOperation), srcAlphaFactor, dstAlphaFactor, @intFromEnum(alphaOperation)));
}
