2014-08-02

mdiappのブラシスクリプトが消えていたので転載しておく

左右対称ブラシ

function use_base()

return true

end

function main( x, y, p )

if firstDraw then

firstDrawX = x

firstDrawY = y

end

local w = bs_width()

if w < 0.25 then

w = 0.25

end

local updateDist = w / 4

if w > 20 then

updateDist = w/10

end

if w > 100 then

updateDist = w/14

end

if not firstDraw then

local distance = bs_distance( lastDrawX - x, lastDrawY - y )

if distance < updateDist then

return 0

end

end

local r,g,b = bs_fore()

bs_ellipse( x,y, w,w, 0, r,g,b,255 )

local bsx,bsy = bs_base()

local noInit = (bsx == -1) and (bsy == -1)

if noInit then

bsx = firstDrawX

bsy = firstDrawY

end

bs_ellipse( bsx - (x - bsx), y, w,w, 0, r,g,b,255 )

lastDrawX = x

lastDrawY = y

firstDraw = false

return 1

end

lastDrawX = 0

lastDrawY = 0

firstDraw = true

firstDrawX = 0

firstDrawY = 0



上下対称ブラシ

function use_base()

return true

end

function main( x, y, p )

if firstDraw then

firstDrawX = x

firstDrawY = y

end

local w = bs_width()

if w < 0.25 then

w = 0.25

end

local updateDist = w / 4

if w > 20 then

updateDist = w/10

end

if w > 100 then

updateDist = w/14

end

if not firstDraw then

local distance = bs_distance( lastDrawX - x, lastDrawY - y )

if distance < updateDist then

return 0

end

end

local r,g,b = bs_fore()

bs_ellipse( x,y, w,w, 0, r,g,b,255 )

local bsx,bsy = bs_base()

local noInit = (bsx == -1) and (bsy == -1)

if noInit then

bsx = firstDrawX

bsy = firstDrawY

end

bs_ellipse( x,bsy - (y - bsy), w,w, 0, r,g,b,255 )

lastDrawX = x

lastDrawY = y

firstDraw = false

return 1

end

lastDrawX = 0

lastDrawY = 0

firstDraw = true

firstDrawX = 0

firstDrawY = 0



回転対称ブラシ

function use_base()

return true

end

function param1()

return "num", 2, 100, 16

end

function main( x, y, p )

if firstDraw then

firstDrawX = x

firstDrawY = y

end

local w = bs_width()

if w < 0.25 then

w = 0.25

end

local updateDist = w / 4

if w > 20 then

updateDist = w/10

end

if w > 100 then

updateDist = w/14

end

if not firstDraw then

local distance = bs_distance( lastDrawX - x, lastDrawY - y )

if distance < updateDist then

return 0

end

end

local bsx,bsy = bs_base()

local noInit = (bsx == -1) and (bsy == -1)

if noInit then

bsx = firstDrawX

bsy = firstDrawY

end

local num = bs_param1()

local r,g,b = bs_fore()

local i

for i=0,num-1 do

local vx,vy = bs_rotate( x-bsx, y-bsy, 3.14159*2 / num * i )

bs_ellipse( bsx + vx, bsy + vy, w,w, 0, r,g,b,255 )

end

lastDrawX = x

lastDrawY = y

firstDraw = false

return 1

end

lastDrawX = 0

lastDrawY = 0

firstDraw = true

firstDrawX = 0

firstDrawY = 0

記事への反応(ブックマークコメント)

ログイン ユーザー登録
ようこそ ゲスト さん