Advertisement
Guest User

svg2setetg.sdlbas

a guest
Aug 6th, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/sdlbrt
  2. finp$="retrorio02.svg" '- svg file in 320x250 pixels size
  3. shell(" convert "+finp$+" "+finp$+".bmp" )
  4. setdisplay(640,250,32,1):paper(8^8-1):ink(0):pen(0):cls
  5. loadimage(finp$+".bmp",1):pasteicon(0,0,1):pasteicon(320,0,1)
  6. shell("rm "+finp$+".bmp" )
  7. dim sttgl$[200],dtal$[200]
  8.  
  9. for y=0 to 249:for x=0 to 319
  10.   ink(0xFFFFFF)
  11.   if (point(320+x,y)mod 256)<128 then:ink(0x000000):end if
  12.   dot(320+x,y)
  13.   next:next
  14.  
  15. for ct=0 to 191
  16.   sttgl$[ct]="seteg("+str$(255)+"),\"00000000000000000000\""
  17.   next
  18.  
  19. open finp$+"_.txt" for output as #1
  20. setcaption("?")
  21. ct=0
  22. for y1=0 to 24
  23.  a$=str$(1210+(y1*2))+" data "
  24.  b$=str$(1211+(y1*2))+" data "
  25.  for x1=0 to 39
  26.   q=0
  27.   for y2=0 to 9:for x2=0 to 7
  28.     if (point(x1*8+x2,y1*10+y2)mod 256)<192 then:q=1:end if
  29.     next:next
  30.   if q<>0 then:
  31.     ink(0xFF0000)
  32.     if ct>=192 then:ink(0xFFFF00):end if
  33.     if ct<192 then
  34.       if x1<20 then:
  35.         a$=a$+"&\""+right$("00"+hex$(ct),2)+"\",":end if
  36.       if x1>=20 then:
  37.         b$=b$+"&\""+right$("00"+hex$(ct),2)+"\",":end if
  38.       end if
  39.     setetgo$=""
  40.     for y2=0 to 9
  41.      btv=0
  42.      for x2=0 to 7
  43.       if (point(320+x1*8+x2,y1*10+y2)mod 256)<128 then:btv+=2^(7-x2):end if
  44.       next
  45.      setetgo$+=right$("00"+hex$(btv),2)
  46.      next
  47.  
  48.     if ct<96 then:
  49.       sttgl$[ct]="setet("+str$(160+ct)+"),\""+setetgo$+"\""
  50.       end if
  51.     if ct>=96 then:
  52.       sttgl$[ct]="seteg("+str$(160+ct-96)+"),\""+setetgo$+"\""
  53.       end if
  54.  
  55.     bar(x1*8,y1*10,x1*8+7,y1*10+9):ct+=1:setcaption(str$(ct))
  56.     end if
  57.   if q=0 then
  58.       if x1<20 then:
  59.         a$=a$+"&\""+right$("00"+hex$(255),2)+"\",":end if
  60.       if x1>=20 then:
  61.         b$=b$+"&\""+right$("00"+hex$(255),2)+"\",":end if
  62.  
  63.     end if
  64.   next
  65.  dtal$[y1*2]=a$
  66.  dtal$[y1*2+1]=b$
  67.  next
  68.  
  69. print #1,"1000 init 7,0"
  70.  
  71. for y1=0 to 191
  72.   'txou$=str$(1050+int(y1/4))+" "+sttgl$[y1]+":"+sttgl$[y1+1]+":"+sttgl$[y1+2]+":"+sttgl$[y1+3]
  73.   txou$=str$(1001+y1)+" "+sttgl$[y1]
  74.   print #1,txou$:next
  75.  
  76. print #1,"1200 restore 1210"
  77. print #1,"1201 for i=0 to 999"
  78. print #1,"1202 read a"
  79. print #1,"1203 if a<96 then poke 16384+(i*2),160+a:poke 16385+(i*2),64+7"
  80. print #1,"1204 if a>=96 and a<192 then poke 16384+(i*2),160+a-96:poke 16385+(i*2),240"
  81. print #1,"1205 if a>=192 then poke 16384+(i*2),32:poke 16385+(i*2),64+7"
  82. print #1,"1206 display"
  83. print #1,"1207 next i"
  84.  
  85. for y1=0 to 49
  86.   print #1,dtal$[y1]:next
  87.  
  88. setcaption(str$(ct))
  89. close #1
  90.  
  91. 'grab(1,0,0,320,240):saveimage("pic1b.bmp",1)
  92. waitkey
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement