This draws the shape on the bitmap once
It displayed on the screen after the completion.
By doing this method, it draws in just 40 seconds (iPad3).
In addition, it also tests other bitmap functions.
References : Oh!X 1988 March "Introductory of X68000BASIC" Akira Nakamori
// Self square fractal drawing // bitmap use type // fdirect=NO // And tile paste // And bitmap functions test // for X-BASIC for iOS v2.0 width(64) // vpriority(TPAGE,GPAGE0,GPAGE1,GPAGE2,GPAGE3) vpage(B_TPAGE+B_GPAGE0+B_GPAGE1+B_GPAGE2+B_GPAGE3,YES) apage(GPAGE0) // int wx=512,wy=512 if YES then {://------------------------------------ bitmapOpen(wx,wy) drawFractal(wx,wy,0) bitmapImgLoad(128,128,wx,wy):// wx,wy is translated to float bitmapClose() // hitKey() wipe() wx=128 wy=128 dim int getAry(128*128) //int size1 //int youso=sizeofArray(getAry,size1) //print "number of elements=";youso;"/1element size=";size1 bitmapOpen(wx,wy) drawFractal(wx,wy,5) bitmapTileImgLoad(128.0,128.0,512.0,512.0) bitmapGet(0,0,64,64,getAry) bitmapClose() // hitKey() wipe() wx=512:wy=512 bitmapOpen(wx,wy) int i,sx,sy,ex,ey,col,h,s for i=0 to 10 h=rnd()*360 s=rnd()*256 col=hsv(h,s,255,255) // sx=rand() mod wx ex=rand() mod wx sy=rand() mod wy ey=rand() mod wy bitmapLine(sx,sy,ex,ey,col) // sx=rand() mod wx ex=rand() mod wx sy=rand() mod wy ey=rand() mod wy bitmapBox(sx,sy,ex,ey,col) // sx=rand() mod wx ex=rand() mod wx sy=rand() mod wy ey=rand() mod wy bitmapFill(sx,sy,ex,ey,col) // sx=rand() mod wx sy=rand() mod wy ex=rand() mod 100+1:// radius locate(0,i):print "x,y,r=";sx,sy,ex bitmapCircle(sx,sy,ex,col) bitmapPaint(sx,sy,col) next bitmapPut(200,200,200+64,200+64,getAry) bitmapImgLoad(128,128,wx,wy):// wx,wy is translated to float bitmapClose() // hitKey() }://------------------------------------ if YES then {://------------------------------------ // Test for bitmapImageFile() // Please write exist image file name wipe() wx=512:wy=512 bitmapOpen(wx,wy) // bitmapImageFile("IMG1.JPG",10,10,256,256) bitmapImgLoad(128,128,wx,wy):// wx,wy is translated to float hitKey() // bitmapImageFile("IMG2.PIC") bitmapImgLoad(128,128,wx,wy):// wx,wy is translated to float hitKey() // bitmapImageFile("GAROU.CUT") bitmapImgLoad(128,128,wx,wy):// wx,wy is translated to float // bitmapClose() }://------------------------------------ // end //--------- func drawFractal(wx;int,wy;int,ty;int) locate(0,ty+0):print "wx*wy=";wx;"*";wy locate(0,ty+1):print "start=";time$ // int MAXREP=50 int MAXDOT=wx int MAXCOL=255 float remin=-0.5# float remax= 0.5# float immin=-0.5# float immax= 0.5# float recon=-0.04# float imcon=-0.695# int rep,ix,iy float x,y,re,im,dx,dy // dx=(remax-remin)/MAXDOT dy=(immax-immin)/MAXDOT // for iy=0 to MAXDOT-1 locate(0,ty+2):print "line=";iy for ix=0 to MAXDOT-1 x=remin+ix*dx y=immin+iy*dy for rep=0 to MAXREP re=x*x-y*y+recon im=2#*x*y+imcon if ((re*re+im*im)>4#) then break x=re:y=im next int c=(rep mod MAXCOL)*4 bitmapPset(ix,iy,c,c,c,255) //gcolor(c,c,c,255) //pset(ix,iy) next next locate(0,ty+2):print "end=";time$ endfunc //--------- func hitKey() setFunctionKey(0,localizedString("ここを押してください","Hit This Button"),'!') displayFunctionKey(YES,0,0) while inkey()=0 endwhile cls() displayFunctionKey(NO,0,0) endfunc //--------- func str localizedString(js;str,es;str) if isLocalizeJapan() then return(js) return (es) endfunc //---------
This is the completed image (gray scale). |
Zip archive file : XBetc.zip
No comments:
Post a Comment