sets the blending function * * Specifies the arithmetic used when computing pixel values that are written to the frame * buffer. In RGBA mode, pixels can be drawn using a function that blends the source RGBA * pixel values with the destination pixel values already in the frame buffer. * Blending is initially disabled. * * `source_factor` specifies which method is
| 2030 | * ``` |
| 2031 | */ |
| 2032 | int RenderScript_SetBlendFunc(lua_State* L) |
| 2033 | { |
| 2034 | RenderScriptInstance* i = RenderScriptInstance_Check(L); |
| 2035 | uint32_t factors[2]; |
| 2036 | for (uint32_t i = 0; i < 2; ++i) |
| 2037 | { |
| 2038 | factors[i] = luaL_checknumber(L, 1+i); |
| 2039 | } |
| 2040 | for (uint32_t i = 0; i < 2; ++i) |
| 2041 | { |
| 2042 | if (factors[i] != dmGraphics::BLEND_FACTOR_ZERO && |
| 2043 | factors[i] != dmGraphics::BLEND_FACTOR_ONE && |
| 2044 | factors[i] != dmGraphics::BLEND_FACTOR_SRC_COLOR && |
| 2045 | factors[i] != dmGraphics::BLEND_FACTOR_ONE_MINUS_SRC_COLOR && |
| 2046 | factors[i] != dmGraphics::BLEND_FACTOR_DST_COLOR && |
| 2047 | factors[i] != dmGraphics::BLEND_FACTOR_ONE_MINUS_DST_COLOR && |
| 2048 | factors[i] != dmGraphics::BLEND_FACTOR_SRC_ALPHA && |
| 2049 | factors[i] != dmGraphics::BLEND_FACTOR_ONE_MINUS_SRC_ALPHA && |
| 2050 | factors[i] != dmGraphics::BLEND_FACTOR_DST_ALPHA && |
| 2051 | factors[i] != dmGraphics::BLEND_FACTOR_ONE_MINUS_DST_ALPHA && |
| 2052 | factors[i] != dmGraphics::BLEND_FACTOR_SRC_ALPHA_SATURATE && |
| 2053 | factors[i] != dmGraphics::BLEND_FACTOR_CONSTANT_COLOR && |
| 2054 | factors[i] != dmGraphics::BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR && |
| 2055 | factors[i] != dmGraphics::BLEND_FACTOR_CONSTANT_ALPHA && |
| 2056 | factors[i] != dmGraphics::BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA) |
| 2057 | { |
| 2058 | return luaL_error(L, "Invalid blend types: %s.set_blend_func(self, %d, %d)", RENDER_SCRIPT_LIB_NAME, factors[0], factors[1]); |
| 2059 | } |
| 2060 | } |
| 2061 | if (InsertCommand(i, Command(COMMAND_TYPE_SET_BLEND_FUNC, factors[0], factors[1]))) |
| 2062 | return 0; |
| 2063 | else |
| 2064 | return luaL_error(L, "Command buffer is full (%d).", i->m_CommandBuffer.Capacity()); |
| 2065 | } |
| 2066 | |
| 2067 | static bool CheckBlendFactor(uint32_t factor) |
| 2068 | { |
nothing calls this directly
no test coverage detected