@Gray+RGBを透明度に割当て --track0:Alpha,-255,255,0,1 --track1:R,-255,255,0,1 --track2:G,-255,255,0,1 --track3:B,-255,255,0,1 --check0:Alpha値反転,0 --dialog:MODE[0-3],local md=0;先にRGB処理/chk,chk1=0;readme,local readme="モードはGray,R,G,Bの順で変動"; ------------------------------------set local t0=math.floor(obj.track0) local t1=math.floor(obj.track1) local t2=math.floor(obj.track2) local t3=math.floor(obj.track3) local ow,oh=obj.getpixel() md = md % 4 ------------------------------------ local len = ow * oh - 1 obj.pixeloption("type","rgb") for i=0,len do x0 = i % ow y0 = math.floor(i / ow) r,g,b,a = obj.getpixel(x0,y0,"rgb") if(md == 0)then if(chk1 == 0)then al = math.floor((r + g + b) / 3 + 0.5) + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end else r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end al = math.floor((r + g + b) / 3 + 0.5) + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end end elseif(md == 1)then if(chk1 == 0)then al = r + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end else r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end al = r + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end end elseif(md == 2)then if(chk1 == 0)then al = g + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end else r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end al = g + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end end elseif(md == 3)then if(chk1 == 0)then al = b + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end else r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end al = b + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end end end obj.putpixel(x0,y0,r,g,b,al) end @HSVを透明度に割当て --track0:Alpha,-255,255,0,1 --track1:R,-255,255,0,1 --track2:G,-255,255,0,1 --track3:B,-255,255,0,1 --check0:Alpha値反転,0 --dialog:MODE[0-3],local md=0;色相ずらし[0-360],local h0=0;先にRGB処理/chk,chk1=0;readme,local readme="モードはHSV(平均),H,S,Vの順で変動"; ------------------------------------set local t0=math.floor(obj.track0) local t1=math.floor(obj.track1) local t2=math.floor(obj.track2) local t3=math.floor(obj.track3) local ow,oh=obj.getpixel() md = md % 4 ------------------------------------ local len = ow * oh - 1 obj.pixeloption("type","rgb") for i=0,len do x0 = i % ow y0 = math.floor(i / ow) r,g,b,a = obj.getpixel(x0,y0,"rgb") h,s,v = HSV(RGB(r,g,b)) h = (h + h0) % 360 if(md == 0)then if(chk1 == 0)then al = math.floor((h * 255 / 360 + s * 255 / 100 + v * 255 / 100) / 3 + 0.5) + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end else r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end al = math.floor((h * 255 / 360 + s * 255 / 100 + v * 255 / 100) / 3 + 0.5) + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end end elseif(md == 1)then if(chk1 == 0)then al = h * 255 / 360 + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end else r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end al = h * 255 / 360 + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end end elseif(md == 2)then if(chk1 == 0)then al = s * 255 / 100 + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end else r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end al = s * 255 / 100 + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end end elseif(md == 3)then if(chk1 == 0)then al = v * 255 / 100 + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end else r = r + t1 if(r < 0)then r = 0 end if(r > 255)then r = 255 end g = g + t2 if(g < 0)then g = 0 end if(g > 255)then g = 255 end b = b + t3 if(b < 0)then b = 0 end if(b > 255)then b = 255 end al = v * 255 / 100 + t0 if(obj.check0)then al = 255 - al end if(al < 0)then al = 0 end if(al > 255)then al = 255 end end end obj.putpixel(x0,y0,r,g,b,al) end --[[http://madeinpc.blog50.fc2.com/]]--