something new, its like a scratchcard, i made a background pic and set all pixels nearly invisible within code and use it at fullwindow sprite.
with mouse down i add alpha from the brush image together with background, my pc can do it in realtime with memblock commands.
an other idea is just to fade in your circles by range. means all circles are sprites and fade it via SetSpriteColor ( iSpriteIndex, iRed, iGreen, iBlue, iAlpha ) , so if your mouse get near u add the alpha, its not pixel perfect but will look similar.
//AGK 2.0.20
//MR
#option_explicit
SetVirtualResolution(1024,768)
SetClearColor(0,0,0)
Main()
end
function Main()
local bg as integer
bg=loadsprite("bg.png")
SetSpriteSize(bg,GetVirtualWidth(),GetVirtualHeight())
render()
local back as integer
back= getimage(0,0,GetVirtualWidth(),GetVirtualHeight())
SetImageTransparentColor(back,0,0,0)
ColorTransparent(back)
deletesprite(bg)
local spr as integer
spr= createsprite(back)
SetSpriteSize(spr,GetVirtualWidth(),GetVirtualHeight())
SetSpriteTransparency(spr,1)
local brush as integer
brush = LoadImage("brush.png")
local sprbrush as integer
sprbrush=createsprite(brush)
setspritesize(sprbrush,64,64)
//SetSpriteTransparency(sprbrush,1)
local mx# as float,my# as float
do
print("hold mouse and move")
mx#=getpointerx()
my#=getpointery()
SetSpritePosition(sprbrush,mx#,my#)
if GetPointerstate()=1
print("Paint")
AddAlpha(back,brush,mx#,my#)
endif
sync()
loop
endfunction
function ColorTransparent(img)
local mem as integer
mem=CreateMemblockFromImage(img)
local i as integer
for i=12 to GetMemblockSize(mem) step 4
//r+0 g+1 b+2 a+3
SetMemblockByte(mem,i+3,8) //set all pixels transparent via alpha channel
next
CreateImageFromMemblock(img,mem)
DeleteMemblock(mem)
endfunction
function AddAlpha(iDstImg,iSrcImg,xd,yd)
local memD as integer
memD = CreateMemblockFromImage(iDstImg)
local memS as integer
memS = CreateMemblockFromImage(iSrcImg)
local w as integer
local h as integer
w=GetImageWidth(iSrcImg)
h=GetImageHeight(iSrcImg)
local i as integer
local r as integer
local g as integer
local b as integer
local a1 as integer
local a2 as integer
local offset as integer
local x as integer
local y as integer
local wd as integer
wd=GetImageWidth(iDstImg)
for x=0 to w -1
for y=0 to h -1
//r+0 g+1 b+2 a+3
//Source
offset = 12+ x*4 + (y*w)*4
a1=GetMemblockByte(memS,offset+3) //Alpha
//Destination
offset = 12+(xd+x)*4+((yd+y)*wd)*4
a2=GetMemblockByte(memD,offset+3) //Alpha
SetMemblockByte(memD,offset+3,(a1/2+a2)) //Alpha mix
next
next
CreateImageFromMemblock(iDstImg,memD)
DeleteMemblock(memD)
DeleteMemblock(memS)
endfunction
AGK (Steam) V2.0.19 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)