Advertisement
Guest User

svg2setetg.sdlbas

a guest
Aug 6th, 2013
126
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]=str$(1100+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$(1800+y1)+" data "
  24.  for x1=0 to 39
  25.   q=0
  26.   for y2=0 to 9:for x2=0 to 7
  27.     if (point(x1*8+x2,y1*10+y2)mod 256)<192 then:q=1:end if
  28.     next:next
  29.   if q<>0 then:
  30.     ink(0xFF0000)
  31.     if ct>=192 then:ink(0xFFFF00):end if
  32.     if ct<192 then
  33.       a$=a$+"&\""+right$("00"+hex$(ct),2)+"\","
  34.       end if
  35.     setetgo$=""
  36.     for y2=0 to 9
  37.      btv=0
  38.      for x2=0 to 7
  39.       if (point(320+x1*8+x2,y1*10+y2)mod 256)<128 then:btv+=2^(7-x2):end if
  40.       next
  41.      setetgo$+=right$("00"+hex$(btv),2)
  42.      next
  43.  
  44.     'sttgl$[ct]=str$(1100+ct)+" setet("+str$(ct)+"),\""+setetgo$+"\""
  45.  
  46.     if ct<96 then:
  47.       sttgl$[ct]=str$(1100+ct)+" setet("+str$(160+ct)+"),\""+setetgo$+"\""
  48.       end if
  49.     if ct>=96 then:
  50.       sttgl$[ct]=str$(1100+ct)+" seteg("+str$(160+ct-96)+"),\""+setetgo$+"\""
  51.       end if
  52.  
  53.     bar(x1*8,y1*10,x1*8+7,y1*10+9):ct+=1:setcaption(str$(ct))
  54.     end if
  55.   if q=0 then
  56.       a$=a$+"&\""+right$("00"+hex$(255),2)+"\","
  57.     end if
  58.   next
  59.  dtal$[y1]=a$
  60.  next
  61.  
  62. for y1=0 to 191
  63.   print #1,sttgl$[y1]:next
  64.  
  65. print #1,"1400 restore 1800"
  66. print #1,"1401 for i=0 to 999"
  67. print #1,"1402 read a"
  68. print #1,"1403 if a<96 then poke 16384+(i*2),160+a:poke 16385+(i*2),64+7"
  69. print #1,"1404 if a>=96 and a<192 then poke 16384+(i*2),160+a-96:poke 16385+(i*2),240"
  70. print #1,"1405 if a>=192 then poke 16384+(i*2),32:poke 16385+(i*2),64+7"
  71. print #1,"1406 display"
  72. print #1,"1407 next i"
  73.  
  74. for y1=0 to 24
  75.   print #1,dtal$[y1]:next
  76.  
  77. setcaption(str$(ct))
  78. close #1
  79.  
  80. 'grab(1,0,0,320,240):saveimage("pic1b.bmp",1)
  81. waitkey
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement