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

pub const BlendMode = u32;

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

pub const BlendFactor = enum(c_int) {
    blendfactorZero = 0x1, //0, 0, 0, 0
    blendfactorOne = 0x2, //1, 1, 1, 1
    blendfactorSrcColor = 0x3, //srcR, srcG, srcB, srcA
    blendfactorOneMinusSrcColor = 0x4, //1-srcR, 1-srcG, 1-srcB, 1-srcA
    blendfactorSrcAlpha = 0x5, //srcA, srcA, srcA, srcA
    blendfactorOneMinusSrcAlpha = 0x6, //1-srcA, 1-srcA, 1-srcA, 1-srcA
    blendfactorDstColor = 0x7, //dstR, dstG, dstB, dstA
    blendfactorOneMinusDstColor = 0x8, //1-dstR, 1-dstG, 1-dstB, 1-dstA
    blendfactorDstAlpha = 0x9, //dstA, dstA, dstA, dstA
    blendfactorOneMinusDstAlpha = 0xA,
};

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)));
}
