-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmixpaintbasicmode.lua
93 lines (65 loc) · 2.02 KB
/
mixpaintbasicmode.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
--first touch/simulated blit will fill this
local firstCol={x=-1,y=-1}
local lastCol={x=-1,y=-1}
--draws a line from last blit x last blit y to current coords
function mixBasicBlitBrushLineRemember(x,y)
print("mixPaintbasicBlitBrushLineRemember line x,y "..x.." "..y)
--if first call, store x y
if firstCol.x==-1 and firstCol.y==-1 then
firstCol.x=x
firstCol.y=y
else
lastCol.x=x
lastCol.y=y
end
-- local blits=calculateTraj(lastblitx,lastblity,x,y)
-- love.graphics.setCanvas(cvs)
-- if eraseMode== true then
-- love.graphics.setBlendMode('replace')
-- --following is ok for square brush
-- -- love.graphics.setShader(eraserShader)
-- --alternative method
-- --TODO should we not set color to 1.0,1.0,1.0, 0 ?
-- -- dark alpha artifacting
-- love.graphics.setColor(0.0,0.0,0.0,0.0)
-- end
-- --DBG should not be a shader here
-- -- for basic ( looks a cut n paste mistake )
---- if brushShader~=nil then
---- print('brsh shader')
---- love.graphics.setShader(brushShader)
---- end
-- for i,b in ipairs(blits) do
-- if eraseMode== true then
-- --TODO why different x y ? might explain jumpiness
-- -- TODO events are actually recorded for top left of brush, refactor to do
-- love.graphics.circle('fill',x+brshradius,y+brshradius,eraserRadius)
-- else
-- love.graphics.draw(mybrush,b.xbl,b.ybl)
-- end
-- end
---- if brushShader~=nil then
---- love.graphics.setShader()
---- end
-- if eraseMode== true then
-- love.graphics.setColor(1.0,1.0,1.0,1.0)
-- love.graphics.setBlendMode('alpha')
-- end
---- love.graphics.setShader()
-- love.graphics.setCanvas()
-- lastblitx=x
-- lastblity=y
-- dirtycvs=true
end
mixPaintPenUpCB=function()
--add msg first and last pos color
addMsg(' first '..firstCol.x.. ' ' .. firstCol.y)
end
initMixPaintBasicMode=function()
firstCol={x=-1,y=-1}
lastCol={x=-1,y=-1}
blitBrushLineRemember=mixBasicBlitBrushLineRemember
backBufferRender=false
penUpPaintModeCb=nil
basicPaintUnderMode=false
end