more用ペイントソース2


colbox

func colbox(l[0],l[1],l[2]){
soft1("採集")
soft2("決定")
lock()
col(0)
rect(63,60,114,102)
rect(62,59,116,104)
color(255,255,190)
frect(64,61,113,101)
col(0)
rect(90,70,60,60)
rect(69,140,30,15)
rect(105,140,30,15)
rect(141,140,30,15)
col(0xFFFFFF)
frect(70,141,28,13)
frect(106,141,28,13)
frect(142,141,28,13)
color(rgb[sl],rgb[sl],rgb[sl])
frect(91,71,59,59)
col(0)
for(sl=0;sl<3;sl++){
rgb[sl]=l[sl]
nc();
}
unlock(0)
sl--
nc()
clearkey()
while(1){
flg=1
s=input()
bt=tick
while(s==scan){
if(flg||tick-bt>=300){
flg=0
if(s&262144){
  while(s&262144){s=scan}
  rgba=rgb[0]<<16
  rgba=rgba+(rgb[1]<< 8)
  rgba=rgba+rgb[2]
  if(rgba==0){rgba=1}
  return rgba
}elsif(s&131072){
 rgba=colsel(rgb[0],rgb[1],rgb[2])
 if(rgba==0){rgba=1}
 return rgba
}elsif(s&4096){rgb[sl]++;nc()}
elsif(s&8192){sl--;dd()sleep(50)
}
elsif(s&16384){sl++;dd()sleep(50)
}
elsif(s&32768){rgb[sl]--;nc()}
elsif(s&65536){rgb[sl]=inputdlg("",rgb[sl],5000,2)
nc()
}}
}
}return rgba
sleep(50)
}
func nc(){
if(rgb[sl]<0){rgb[sl]=0}
if(rgb[sl]>255){rgb[sl]=255}lock()
clear(70+sl*36,141,28,14)
col(0)
text(rgb[sl],72+sl*36,141,0)color(rgb[0],rgb[1],rgb[2])
frect(91,71,59,59)
unlock(0)
}
func dd(){
if(sl<0){sl=0}
if(sl>2){sl=2}
col(0)
rect(69+0*36,140,30,15)rect(69+1*36,140,30,15)rect(69+2*36,140,30,15)
col(0xFF0000)
rect(69+sl*36,140,30,15)
}
func colsel(){
while(1){
sleep(90)
s=scan
myo=myo-((s&4096)!=0)+((s&32768)!=0)
if(myo<chy){myo=chy}elsif(myo>chh){myo=chh}
mxo=mxo-((s&8192)!=0)+((s&16384)!=0)
if(mxo<chx){mxo=chx}elsif(mxo>chw){mxo=chw}
rgb=ct[mxo-chx][myo-chy]
if(rgb==0){rgb=(255<<16)+(255<<8)+(255)}
if(s&65536){
break;
}
lock()
repaint()
trgt(off)
if(mxo*pw>159&&myo*pw>159){ col(0)
rect(10,10,60,60)
col(rgb)
frect(11,11,59,59)
}else{
col(0)
rect(170,170,60,60)
col(rgb)
frect(171,171,59,59)
}
unlock(0)
}
repaint()
return rgb
}

io

func loadi(fromsave){
 repaint()
 if(fromsave==1||fromsave=="YES"){
  if(ismore()){
   repaint()
   msgdlg("","ロード先を選択してください")
   lnum=inputdlg("","1".vkret.load(0).
"※一行目のみを書き換えてください",5000,0)
   lnum=substr(lnum,0,index(lnum,vkret))
   img=load(setscl(lnum))
  }else{
   img=load()
  }
  img=substr(img,5,strlen(img)-5)
  img=substr(img,0,strlen(img)-1)
 }else{
  img=inputdlg("","",5000,0)
 }
 repaint()
 showwait()
 unlock(1)
 if(index(img,"!pckdimg!")!=-1){
  msgdlg("","圧縮形式の画像です。".vkret."ロードに若干時間がかかります")
  repaint()
  showwait()
  unlock(1)
  img=imgunpack(img)
 }
 splitstring(img,",")
 lw=result[result[0]*3+2]
 lh=result[result[0]*3+3]
 lwn=result[0]*3+2
 lhn=result[0]*3+3
 for(i=0;i<result[0];i++){
  co[i]=result[i*3+1]<<16
  co[i]=co[i]+(result[i*3+2]<<8)
  co[i]=co[i]+result[i*3+3]
 }
 if(csx!=lw&&csy!=lh){
  csx=lw
  csy=lh
  initialize()
 }
 showwait()
 trgt(bk)
 for(y=0;y<lh;y++){
  for(x=0;x<lw;x++){
   trgt(bk)
   ct[x][y]=co[result[lwn+2+x+y*lw]]
   col(ct[x][y])
   frect((chx+x)*pw+1,(chy+y)*pw+1,pw-1,pw-1)
   trgt(smpw)
   col(ct[x][y])
   point(x,y)
  }
 }
}
func saveimg(ifpack){
if(ismore()){
 iname=""
 ilist=(load()==0?"":load();)
 if((sc=index(ilist,lnum.":"))!=-1){
  iname=substr(ilist,sc+strlen(lnum.":"),index(ilist,",",sc)-sc-strlen(lnum.":"))
 }
 iname=inputdlg(iname."
名前を入力してください
※一行目だけを編集してください",2)
 iname=substr(iname,0,index(iname,vkret))
 if(iname==""){msgdlg("error","名前が空白です")repaint()return}
 repaint()
 inum=inputdlg("1
セーブ先の番号を入力してください
※一行目だけを編集してください
".load(0),0)
 inum=substr(inum,0,index(inum,vkret))
 inum=setscl(inum)
 if(inum<1){msgdlg("error","数字は1以上の整数を指定してください")repaint()return}
 ilist=(load()==0?"":load();)
 if((sc=index(ilist,inum.":"))!=-1){
  ilist=substr(ilist,0,sc).inum.":".iname.",".substr(ilist,index(ilist,",",sc)+1)
 }else{
  ilist=ilist.inum.":".iname.","
 }
 save(ilist)
 repaint()
}
r=yndlg("","透明色を選びますか?")
if(r=="YES"||r==1){tp=colsel()}else{tp="nil"colrate[tp]=-1}
change=0
repaint()
showwait()
tc=""
numcol=0
imgtable=""
sim=","
for(y=0;y<csy;y++){
 for(x=0;x<csx;x++){
  rgb=ct[x][y]
  if(rgb==0){rgb=(255<<16)+(255<<8)+(255)}
  if(index(sim,",".rgb.",")==-1){
   sim=sim.rgb.","
   colrate[rgb]=numcol
   colr=(0xFF0000 & rgb)>>16   colg=(0x00FF00 & rgb)>>8    colb=(0x0000FF & rgb)
   tc=tc.",".colr.",".colg.",".colb
   imgtable=imgtable.",".(numcol)
   numcol++
  }else{imgtable=imgtable.",".colrate[rgb]}
 }
}
svs=numcol.tc.",".colrate[tp].",".csx.",".csy.imgtable
if(ifpack){svs=imgpack(svs)}
svs="img=\"".svs."\""
if(ismore()){
 save(svs,inum)
}else{
 save(svs)
}
repaint()
msgdlg("","セーブ完了")
}

more用ペイントソース3