'jpegdemo.bas
'this demo renders parts of a jpeg to a 100x 100 pixel buffer
#include "jpeg4gfxlib.bi"
Randomize timer
dim p1 as any ptr,a as string
dim  as integer i,j,i1

screen 20,32
Dim As Integer r(39)
For i  =0 To 39:r(i)=i:Next
For i=0 To 38:swap r(i) , r((39-i)*Rnd):next

width ,50
locate 30,1:print "rendering random 100x100 pixel sections to put buffer, then PUTting them to screen to build the image"
  for i1=0 to 39
  	j=r(i1)\8
  	i=r(i1) Mod 8
    P1=jpegget("city.jpg",i*100,j*100,(i+1)*100-1,(j+1)*100-1)
    if jpegerr then print printerror$
        put (i*100,j*100),p1,pset
    imagedestroy(p1)     
  next
sleep




