Here is code used to draw squares (more complicated than it needs to be, I know), and something must be selected:
Code: Select all
/c
local player = game.player
local surface = player.surface
local selected = player.selected
local position = selected.position
local X0 = position.x
local Y0 = position.y
local leftmost = -10
local rightmost = 10
local top = -10
local bottom = 10
--[[these aren't 100% accurate]]
local square_size = .5 --[[size of square relative to tile]]
local frequency = 1 --[[ at most 1]]
local occupancy = 1 --[[how much of the square is taken up]]
local period = square_size / frequency
local width_half = occupancy * square_size / 2
local height_half = occupancy * square_size / 2
local DX = (rightmost - leftmost)
local DY = (bottom - top)
for dy = top, bottom, period do
for dx = leftmost, rightmost, period do
local a = (dx - leftmost) / DX
local w = (dy - top) / DY
local force_a = true
if force_a then
a = 1
end
rendering.draw_rectangle{
color = {w, w, w, a},
filled = true,
left_top = {X0 - width_half + dx, Y0 - height_half + dy},
right_bottom = {X0 + width_half + dx, Y0 + height_half + dy},
surface = surface,
time_to_live = 180,
}
end
end
Result = Active_RGB * Active_Alpha + Background_RGB * ( 1 - Active_Alpha )
Active Alpha 1:
Result = Active_RGB
Now, alpha force 0: The result makes no sense. Alpha 0 is fully transparent for tinting, and
Result = Active_RGB * Active_Alpha + Background_RGB * ( 1 - Active_Alpha )
Clearly results in:
Result = Background_RGB
The non-forced code, where whiteness increases from left to right, and alpha increases from top to bottom: This is clear that *just* changing the color results in an increase in opacity, the more white the color is. This is not the same blendmode as normal.