SHARE
TWEET

rasterpixels2svgsquares_1011071357.sdlbas

a guest Aug 17th, 2019 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/sdlbrt
  2. finp$="DangenTrantor16.png":xed=128:yed=96
  3. fout$=finp$+".svg"
  4.  
  5. setdisplay(xed,yed,32,1):paper(8^8-1):ink(0):pen(0):cls
  6. loadimage(finp$,1):pasteicon(0,0,1)
  7.  
  8. pixid=0
  9.  
  10. open fout$ for output as #1
  11.   print #1,"<?xml version=\"1.0\" standalone=\"no\"?>"
  12.   print #1,"<svg width=\""+str$(xed)+"\" height=\""+str$(yed)+"\" id=\"svg2\" version=\"1.0\">"
  13.  
  14.   for y=0 to yed-1
  15.     for x=0 to xed-1
  16.       u=point(x,y) mod 256
  17.       if u<128 then:
  18.         pixid+=1
  19.         print #1,"<path id=\""+str$(pixid)+"\""
  20.         print #1,"style=\"fill:#000000;stroke:none;fill-opacity:1;\""
  21.                 '- d=\"M 46,6 L 42,6 L 42,1 L 7,1 L 7,42 L 42,42 L 42,21 L 46,21 L 46,6 z\"/>
  22.         print #1,"d=\"M "+str$(x)+","+str$(y)+" l 1,0 l 0,1 l -1,0 l 0,-1 z\"/>"
  23.         end if
  24.       next:next
  25.  
  26.   print #1,"</svg>"
  27.   close #1
  28.  
  29.  
  30. 'grab(1,0,0,320,240):saveimage("pic1b.bmp",1)
  31. 'waitkey
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top