IRIGIMA Unlimited

Post Reply
IRIGIMA
Posts: 10
Joined: Wed May 03, 2017 10:30 pm
My devices: iOS iPhone 6
Flag: Great Britain
Contact:

IRIGIMA Unlimited

Post by IRIGIMA » Tue Feb 18, 2020 4:30 pm

IRIGIMA Unlimited
Please see my Facebook page for examples and hope you enjoy exploring.

Here is the code:



setupgraphics:
GRAPHICS
SET TOOLBAR OFF
GET ORIENTATION P
IF p=1 OR p=3 THEN LET p=5
IF p=2 OR p=4 THEN LET p=6
SET ORIENTATION P
xw=SCREEN_WIDTH()/2
yw=SCREEN_HEIGHT()/2
REFRESH OFF

demo=0
democount=0
sq2=1


rem full mode
if demo=0 then
lines=115
lines=lines+1
ltext=23
DIM a$(lines)
DIM ltext$(ltext)
a$(0)=" "

a$(1)="IRIGIMA UNLIMITED - VERSION 2.0"
a$(2)="Built using SmartBasic for iOS on IPhone 6."
a$(3)="Compiled with Xcode V7."
a$(4)=" "
a$(5)="USER MANUAL"
a$(6)=" "
a$(7)="NAVIGATION:"
a$(8)=" "
a$(9)="There are 2 NAVIGATION modes while rendering."
a$(10)="EXPLORATION and PARAMETERS."
a$(11)=" "
a$(12)="EXPLORATION:"
a$(13)=" "
a$(14)="The image can be interrupted or repositioned at any time by:"
a$(15)=" "
a$(16)="1: Long screen press:"
a$(17)="Abort any render currently in progress."
a$(18)="Switches to PARAMETERS."
a$(19)=" "
a$(20)="2: Short screen tap:"
a$(21)="The area will be centralised and magnified."
a$(22)="Magnification levels will be dependant on the SCALE FACTOR parameter."
a$(23)=" "
a$(24)="On render completion - PARAMETERS will automatically become available."
a$(25)=" "
a$(26)="PARAMETERS:"
a$(27)=" "
a$(28)="The following PARAMETERS can be selected by:"
a$(29)=" "
a$(30)="1: Direct input."
a$(31)="2: The INPUT button."
a$(32)=" "
a$(33)="GENERATION ALGORITHM:"
a$(34)="Valid range between 1 and 5."
a$(35)="1: Original base. (distance output from polar fold)"
a$(36)="2: Base transformation variant."
a$(37)="3: Inverted adaption of GENERATION ALGORITHM 2"
a$(38)="4: Circular iterative mapping."
a$(39)="5: GENERATION ALGORITHM 3 with full RGB output."
a$(40)=" "
a$(41)="X/Y OFFSET:"
a$(42)="No known restrictions."
a$(43)="Tested value range: + - 4.7"
a$(44)=" "
a$(45)="FIXED INVERSION RADIUS:"
a$(46)="Zero values not allowed."
a$(47)="All values return ABS(N)"
a$(48)="Tested values: 0.5+"
a$(49)=" "
a$(50)="MINIMUM INVERSION RADIUS:"
a$(51)="All values return ABS(N)"
a$(52)="Tested values 0.5+"
a$(53)=" "
a$(54)="LINEAR DISPLACEMENT:"
a$(55)="No known tested restrictions."
a$(56)=" "
a$(57)="VECTOR ROTATION:"
a$(58)="Parameter setting 0 will bypass this routine."
a$(59)="No known tested restrictions."
a$(60)="(Harmonics at ~ 0.13)"
a$(61)=" "
a$(62)="SCALE FACTOR:"
a$(63)="Zero values not allowed."
a$(64)="New magnification = CURRENT MAGNIFICATION AT * SCALE FACTOR."
a$(65)=" "
a$(66)="LEVEL OF DETAIL:"
a$(67)="No known restrictions."
a$(68)="All values return INT(N)"
a$(69)="Odd / Even variable family types."
a$(70)=" "
a$(71)="SPECULAR INTENSITY: (GENERATION ALGORITHM < 5 only)"
a$(72)="Zero values not allowed."
a$(73)="Adjusts the SPECULAR INTENSITY of the object."
a$(74)="Output will default to SPECULAR with no available settings."
a$(75)=" "
a$(76)="BLACKPOINT INTENSITY: (GENERATION ALGORITHM 5 only)"
a$(77)="Zero values not allowed."
a$(78)="Adjusts the BLACKPOINT of the RGB output channels."
a$(79)=" "
a$(80)="OUTPUT: (GENERATION ALGORITHM 5 only)"
a$(81)="Valid range between 1 and 10."
a$(82)="1 > 6 : FULL RGB TYPE variants."
a$(83)="7: R INTENSITY."
a$(84)="8: G INTENSITY."
a$(85)="9: B INTENSITY."
a$(86)="10: RGB AVERAGE."
a$(87)=" "
a$(88)="BUTTONS:"
a$(89)=" "
a$(90)="RENDER:"
a$(91)="Reverts back to EXPLORATION - applying any parameter changes."
a$(92)="Coordinates and magnification levels not affected."
a$(93)=" "
a$(94)="CENTRE:"
a$(95)="Reverts back to EXPLORATION."
a$(96)="Only SCALE FACTOR is applied."
a$(97)=" "
a$(98)="SAVE IMAGE:"
a$(99)="Saves last render in unique file / folder. (.JPG format)"
a$(100)=" "
a$(101)="INPUT:"
a$(102)="Scrolls through the selectable input PARAMETERS."
a$(103)=" "
a$(104)="Further information and examples can be found on our Facebook page:"
a$(105)="https://www.facebook.com/irigima/"
a$(106)=" "
a$(107)="We hope you enjoy IRIGIMA UNLIMITED V2.0"
a$(108)=" "
a$(109)="End of file..........."
a$(110)=" "
a$(111)="//>"
a$(112)=" "
a$(113)=" "
a$(114)=" "
a$(115)=" "

end if

rem demo mode
if demo=1 then
lines=140
lines=lines+1
ltext=23
DIM a$(lines)
DIM ltext$(ltext)
a$(0)=" "

a$(1)="IRIGIMA VERSION 2.0"
as(2)=" "
a$(3)="Built using SmartBasic for iOS on IPhone 6."
a$(4)="Compiled with Xcode V7."
a$(5)=" "
a$(6)="DEMO MODE."
a$(7)="You have restricted access."
a$(8)=" "
a$(9)="Magnification levels have been limited."
a$(10)="For evaluation purposes only."
a$(11)="UNLIMITED version available via iOS AppStore."
a$(12)=" "
a$(13)="Some incompatible devices may experience the following:"
a$(14)="(Affecting both DEMO and UNLIMITED versions)"
a$(15)=" "
a$(16)="Full resolution rendering unavailable on certain screen types."
a$(17)="Incorrect central magnification on manual mode."
a$(18)="Offset of initial render."
a$(19)="Text positioning and overlapping."
a$(20)=" "
a$(21)=" These points show incompatibility issues with your device."
a$(22)=" "
a$(23)="There have been no further reports."
a$(24)=" "
a$(25)="Please see our following guide for use,"
a$(26)="Or tap the screen to continue."
a$(27)=" "
a$(28)="> "
a$(29)=" "
a$(30)="USER MANUAL"
a$(31)=" "
a$(32)="NAVIGATION:"
a$(33)=" "
a$(34)="There are 2 NAVIGATION modes while rendering."
a$(35)="EXPLORATION and PARAMETERS."
a$(36)=" "
a$(37)="EXPLORATION:"
a$(38)=" "
a$(39)="The image can be interrupted or repositioned at any time by:"
a$(40)=" "
a$(41)="1: Long screen press:"
a$(42)="Abort any render currently in progress."
a$(43)="Switches to PARAMETERS."
a$(44)=" "
a$(45)="2: Short screen tap:"
a$(46)="The area will be centralised and magnified."
a$(47)="Magnification levels will be dependant on the SCALE FACTOR parameter."
a$(48)=" "
a$(49)="On render completion - PARAMETERS will automatically become available."
a$(50)=" "
a$(51)="PARAMETERS:"
a$(52)=" "
a$(53)="The following PARAMETERS can be selected by:"
a$(54)=" "
a$(55)="1: Direct input."
a$(56)="2: The INPUT button."
a$(57)=" "
a$(58)="GENERATION ALGORITHM:"
a$(59)="Valid range between 1 and 5."
a$(60)="1: Original base. (distance output from polar fold)"
a$(61)="2: Base transformation variant."
a$(62)="3: Inverted adaption of GENERATION ALGORITHM 2"
a$(63)="4: Circular iterative mapping."
a$(64)="5: GENERATION ALGORITHM 3 with full RGB output."
a$(65)=" "
a$(66)="X/Y OFFSET:"
a$(67)="No known restrictions."
a$(68)="Tested value range: + - 4.7"
a$(69)=" "
a$(70)="FIXED INVERSION RADIUS:"
a$(71)="Zero values not allowed."
a$(72)="All values return ABS(N)"
a$(73)="Tested values: 0.5+"
a$(74)=" "
a$(75)="MINIMUM INVERSION RADIUS:"
a$(76)="All values return ABS(N)"
a$(77)="Tested values 0.5+"
a$(78)=" "
a$(79)="LINEAR DISPLACEMENT:"
a$(80)="No known tested restrictions."
a$(81)=" "
a$(82)="VECTOR ROTATION:"
a$(83)="Parameter setting 0 will bypass this routine."
a$(84)="No known tested restrictions."
a$(85)="(Harmonics at ~ 0.13)"
a$(86)=" "
a$(87)="SCALE FACTOR:"
a$(88)="Zero values not allowed."
a$(89)="New magnification = CURRENT MAGNIFICATION AT * SCALE FACTOR."
a$(90)=" "
a$(91)="LEVEL OF DETAIL:"
a$(92)="No known restrictions."
a$(93)="All values return INT(N)"
a$(94)="Odd / Even variable family types."
a$(95)=" "
a$(96)="SPECULAR INTENSITY: (GENERATION ALGORITHM < 5 only)"
a$(97)="Zero values not allowed."
a$(98)="Adjusts the SPECULAR INTENSITY of the object."
a$(99)="Output will default to SPECULAR with no available settings."
a$(100)=" "
a$(101)="BLACKPOINT INTENSITY: (GENERATION ALGORITHM 5 only)"
a$(102)="Zero values not allowed."
a$(103)="Adjusts the BLACKPOINT of the RGB output channels."
a$(104)=" "
a$(105)="OUTPUT: (GENERATION ALGORITHM 5 only)"
a$(106)="Valid range between 1 and 10."
a$(107)="1 > 6 : FULL RGB TYPE variants."
a$(108)="7: R INTENSITY."
a$(109)="8: G INTENSITY."
a$(110)="9: B INTENSITY."
a$(111)="10: RGB AVERAGE."
a$(112)=" "
a$(113)="BUTTONS:"
a$(114)=" "
a$(115)="RENDER:"
a$(116)="Reverts back to EXPLORATION - applying any parameter changes."
a$(117)="Coordinates and magnification levels not affected."
a$(118)=" "
a$(119)="CENTRE:"
a$(120)="Reverts back to EXPLORATION."
a$(121)="Only SCALE FACTOR is applied."
a$(122)=" "
a$(123)="SAVE IMAGE:"
a$(124)="Saves last render in unique file / folder. (.JPG format)"
a$(125)=" "
a$(126)="INPUT:"
a$(127)="Scrolls through the selectable input PARAMETERS."
a$(128)=" "
a$(129)="Further information and examples can be found on our Facebook page:"
a$(130)="https://www.facebook.com/irigima/"
a$(131)=" "
a$(132)="We hope you enjoy IRIGIMA DEMO V2.0"
a$(133)=" "
a$(134)="End of file..........."
a$(135)=" "
a$(136)="//>"
a$(137)=" "
a$(138)=" "
a$(139)=" "
a$(140)=" "



end if

REM splashscreen
PAUSE 1
OPTION TEXT POS normal
DRAW FONT NAME "AvenirNext-UltraLight"
DRAW FONT SIZE 30
DRAW TEXT "irigima" AT 10,50
FILL COLOR 0,0,0
REFRESH
PAUSE 2

scroll:
DRAW FONT NAME "Helvetica"
DRAW FONT SIZE 8
OPTION TEXT POS NORMAL
FOR TEXT=1 TO (lines-1)
alen=LEN(a$(TEXT))
bb$=" "
FOR n=2 TO alen
GET TOUCH 0 AS stx,sty
IF stx<>-1 OR sty<>-1 THEN GOTO scrolloff
bb$=LEFT$(a$(TEXT),n)
FILL RECT 0,100 TO SCREEN_WIDTH(),SCREEN_HEIGHT()
DRAW TEXT bb$ AT 10,SCREEN_HEIGHT()-10
PAUSE 0.03

FOR nt=ltext-1 TO 2 STEP-1
bb$=ltext$(nt)
DRAW TEXT bb$ AT 10,SCREEN_HEIGHT()-((nt)*10)
NEXT nt

REFRESH
NEXT n
PAUSE 1

bb$=a$(TEXT)
ltext$(1)=bb$
FOR nt=ltext-1 TO 2 STEP-1
ltext$(nt)=ltext$(nt-1)
NEXT nt

FILL RECT 0,100 TO SCREEN_WIDTH(),SCREEN_HEIGHT()
NEXT TEXT
GOTO scroll


scrolloff:
DO
GET TOUCH 0 AS stx,sty
UNTIL stx=-1 AND sty=-1
PAUSE 1
GRAPHICS CLEAR 0,0,0
REFRESH
PAUSE 1


OPTION TEXT POS NORMAL
DRAW FONT NAME "Helvetica"
DRAW FONT SIZE 8
SET BUTTONS CUSTOM
SET BUTTONS FONT NAME "Helvetica"
SET BUTTONS FONT SIZE 8
GET SCREEN SIZE XSIZE,YSIZE


REM ***** SET filename FOR EXPORT
date$=STR$(CURRENT_DATE())
IF LEN(date$)=1 THEN date$="0"& date$
month$=STR$(CURRENT_MONTH())
IF LEN(month$)=1 THEN month$="0"& month$
year$=STR$(CURRENT_YEAR())
hour$=STR$(CURRENT_HOUR())
IF LEN(hour$)=1 THEN hour$="0"& hour$
minute$=STR$(CURRENT_MINUTE())
IF LEN(minute$)=1 THEN minute$="0"& minute$
second$=STR$(CURRENT_SECOND())
IF LEN(second$)=1 THEN second$="0"& second$
tdir$=date$ & month$ & year$ & "-" & hour$ & minute$ & second$

vars:
XSIZE=XSIZE*2
YSIZE=YSIZE*2
SCALE=1.9
cx=-4.1
cy=0.7
mag=1
fset=6
fixedRadius = 1.2
minRadius = 0.5
spec=0.8
rotation=0
rtype=5
zoom=1
pics=0
OUTPUT=1
OUTPUT$=" SPECULAR"

REM text / button fade in / out settings
fade=0.7
fadestep=0.002

REM text setup
DIM t$(40)
t$(1)="irigima"
t$(2)="web"
t$(3)="power"
t$(4)="time"
t$(5)="rtype"
t$(6)="rtypeval"
t$(7)="xoffset"
t$(8)="xoffsetval"
t$(9)="yoffset"
t$(10)="yoffsetval"
t$(11)="fixedinver"
t$(12)="fixedinverval"
t$(13)="mininvrad"
t$(14)="mininvradval"
t$(15)="lindist"
t$(16)="lindistval"
t$(17)="vectorrot"
t$(18)="vectorrotval"
t$(19)="scalefactor"
t$(20)="scalefactorval"
t$(21)="lod"
t$(22)="lodval"
t$(23)="spec"
t$(24)="specval"
t$(25)="output"
t$(26)="outputval"
t$(27)="cx"
t$(28)="cxval"
t$(29)="cy"
t$(30)="cyval"
t$(31)="mag"
t$(32)="magval"
t$(33)="image"
t$(34)="imageval"


REM button setup
DIM b$(10)
b$(1)="render"
b$(2)="continue"
B$(3)="saveimage"
b$(4)="var"
varselect=6

REM page setup for displaying vars
NAME$="PAGE"
PAGE NAME$ SET
PAGE NAME$ FRAME 0,0,SCREEN_WIDTH(),SCREEN_HEIGHT()
PAGE NAME$ COLOR 0,0,0,1
PAGE NAME$ HIDE

REM ***** initial max,min setup

REM calc screen aspect ratio
aspect=XSIZE/YSIZE

REM initial sample area
xmin=(-5*aspect)+1 ! xmax=(5*aspect)+1
ymin=(-5)+1 ! ymax=(5)+1

REM ***** render *****************************

varscalc:
REM set folds
fR2 = fixedRadius * fixedRadius
mR2 = minRadius * minRadius
xcent=((xmax-xmin)/2)+xmin
ycent=((ymax-ymin)/2)+ymin
cfr2=1/fr2

REM calc distance increase per pixel for max and min dependant on x,y size
distx=(xmax-xmin)/XSIZE
disty=(ymax-ymin)/YSIZE

REM precalc rotation to save time
rotx=SIN(rotation)
roty=COS(rotation)

main:
REM ***render screen
FOR py=0 TO YSIZE
REM user has inturrupted render
GET TOUCH 0 AS tx,ty
IF tx<>-1 OR ty<>-1 THEN GOTO touchscreen
REFRESH
FOR px=0 TO XSIZE

REM calc sample position value for min>max
x=(px*distx)+xmin
y=(py*disty)+ymin

iterationloop:
REM iterate transformations (fold, polar fold variant, scale+offset, rotation)

REM hold initial start position for colour
sx=x
sy=y

REM iterations
FOR n=1 TO fset

fold:
IF x > 1.0 THEN x = 2 - x
IF x < -1.0 THEN x = -2- x
IF y > 1.0 THEN y = 2 - y
IF y < -1.0 THEN y = -2-y

REM check for any singularities
r2 =(x*x) + (y*y)
REM error trap for type resulting in div0
IF r2=0 THEN
c=0
rr=0
gg=0
bb=0
GOSUB drawpixel
GOTO endfold
END IF

REM chose folding algorithm

REM colour algorithm

IF rtype>=5 THEN
GOSUB type3
GOTO endfold
ENDIF

REM greyscale algorithms

IF rtype=1 THEN
GOSUB type1
GOTO endfold
END IF

IF rtype=2 THEN
GOSUB type2
GOTO endfold
END IF

IF rtype=3 THEN
GOSUB type3
GOTO endfold
ENDIF

IF rtype=4 THEN
GOSUB type4
GOTO endfold
ENDIF

endfold:

REM scalar
x =(x*SCALE)+cx
y =(y*SCALE)+cy

REM apply pre calculated rotation if <>0
IF rotation=0 THEN GOTO skiprotation
x=x+(rotx*x)
y=y+(roty*y)

skiprotation:

NEXT n

IF rtype=5 THEN GOSUB pixelcolour
IF rtype<5 THEN GOSUB pixelbw
GOSUB drawpixel

NEXT px
NEXT py
GOTO vardisplay

REM *** end screen render *****************

pixelcolour:
sspec=1/(spec*10)
xd=x-sx
yd=y-sy
dist=(SQRT((xd*xd)+(yd*yd)))/sq2
rrr=ABS(dist*sspec)^3
ggg=ABS(xd*sspec)^3
bbb=ABS(yd*sspec)^3
GOSUB OUTPUT
RETURN

OUTPUT:
REM change RGB values

IF OUTPUT=1 THEN
rr=rrr
gg=ggg
bb=bbb
RETURN
ENDIF
IF OUTPUT=2 THEN
rr=rrr
gg=bbb
bb=ggg
RETURN
ENDIF
IF OUTPUT=3 THEN
rr=ggg
gg=rrr
bb=bbb
RETURN
ENDIF
IF OUTPUT=6 THEN
rr=ggg
gg=bbb
bb=rrr
RETURN
ENDIF
IF OUTPUT=5 THEN
rr=bbb
gg=ggg
bb=rrr
RETURN
ENDIF
IF OUTPUT=4 THEN
rr=bbb
gg=rrr
bb=ggg
RETURN
ENDIF
IF OUTPUT=7 THEN
rr=rrr
gg=rrr
bb=rrr
RETURN
ENDIF
IF OUTPUT=8 THEN
rr=ggg
gg=ggg
bb=ggg
RETURN
ENDIF
IF OUTPUT=9 THEN
rr=bbb
gg=bbb
bb=bbb
RETURN
ENDIF
IF OUTPUT=10 THEN
ave=(rrr+ggg+bbb)/3
rr=ave
gg=ave
bb=ave
RETURN
ENDIF


pixelbw:
IF r2=0 THEN RETURN
c=(cfr2/r2)/(spec*10)
rr=c
gg=c
bb=c
RETURN

drawpixel:
DRAW PIXEL px,py COLOR bb,gg,rr
RETURN

REM inverse polar fold variations

type1:
IF r2 < mR2 THEN
x = x * fR2 / mR2
y = y * fR2 / mR2
END IF
IF r2 < fR2 THEN
x = x * fR2 / r2
y = y * fR2 / r2
END IF
RETURN

type2:
IF r2 < mR2 THEN
x = x * fR2 / mR2
y = y * fR2 / mR2
END IF
IF r2 > fR2 THEN
x = x * fR2 / r2
y = y * fR2 / r2
END IF
RETURN

type4:
IF r2 < mR2 THEN
x = x * R2 / mR2
y = y * R2 / mR2
END IF
IF r2 > mR2 THEN
x = x * fR2 / r2
y = y * fR2 / r2
END IF
RETURN

type3:
IF r2 < mR2 THEN
x = x * mR2 / R2
y = y * mR2 / R2
END IF
IF r2 > fR2 THEN
x = x * fR2 / r2
y = y * fR2 / r2
END IF
RETURN

zoom:
xcent=((xmax-xmin)/2)+xmin
ycent=((ymax-ymin)/2)+ymin

centx=(SCREEN_WIDTH())-(SIZE/2)
centy=(SCREEN_HEIGHT())-(SIZE/2)

xw=SCREEN_WIDTH()/2
yw=SCREEN_HEIGHT()/2

newxmin=(((tx-xw-(XSIZE/4))*2)*distx)+xmin+((xmax-xmin)/2)
newymin=(((ty-yw-(YSIZE/4))*2)*disty)+ymin+((yMAX-yMIN)/2)
newxmax=(((tx-xw+(XSIZE/4))*2)*distx)+xmin+((xmax-xmin)/2)
newymax=(((ty-yw+(YSIZE/4))*2)*disty)+ymin+((yMAX-yMIN)/2)

xcent=(((tx-xw)*2)*distx)+xmin+((xmax-xmin)/2)
ycent=(((ty-yw)*2)*disty)+yMIN+((yMAX-yMIN)/2)

xmin=xcent+((newxmin-xcent)/zoom)
ymin=ycent+((newymin-ycent)/zoom)
xmax=xcent+((newxmax-xcent)/zoom)
ymax=ycent+((newymax-ycent)/zoom)

mag=mag*zoom

rem demo mode?
if demo=1 then
democount=democount+1
if democount> 3 then goto demoend
endif
GOTO varscalc

touchscreen:
counter=0
usercount:
REM wait for user input off
GET TOUCH 0 AS ttx,tty
REM zoom select
IF ttx=-1 AND tty=-1 THEN GOTO zoom
REM page select
IF ttx<>-1 AND tty<>-1 AND counter>0 THEN GOTO vardisplay
PAUSE 1
counter=counter+1
GOTO usercount

vardisplay:

rem store old valid vars
gosub oldvars:

PAGE NAME$ AT 0,0
PAGE NAME$ HIDE
varselect=6

REM text display
REM delete old text first causing error on input
FOR n=1 TO 34
FIELD t$(n) DELETE
NEXT n
FIELD t$(1) TEXT "IRIGIMA V2.0" AT 10,0 RO
FIELD T$(2) TEXT "https://www.facebook.com/irigima/" AT 10,10 RO
charge$=""
IF BATTERY_STATE () =1 THEN LET charge$=" - CHARGING..."
FIELD T$(3) TEXT "POWER AT: " & BATTERY_LEVEL ()&"%" & charge$ AT 10,30 RO
FIELD t$(4) TEXT "DIR// " & tdir$ AT 10,40 RO
FIELD t$(5) TEXT "GENERATION ALGORITHM:" AT 10,60 RO
FIELD t$(6) TEXT rtype AT 140,60
FIELD t$(7) TEXT "X-OFFSET:" AT 10,70 RO
FIELD t$(8) TEXT cx AT 140,70
FIELD t$(9) TEXT "Y-OFFSET:" AT 10,80 RO
FIELD t$(10) TEXT cy AT 140,80
FIELD t$(11) TEXT "FIXED INVERSION RADIUS:" AT 10,90 RO
FIELD t$(12) TEXT fixedradius AT 140,90
FIELD t$(13) TEXT "MINIMUM INVERSION RADIUS:" AT 10,100 RO
FIELD t$(14) TEXT minradius AT 140,100
FIELD t$(15) TEXT "LINEAR DISPLACEMENT:" AT 10,110 RO
FIELD t$(16) TEXT SCALE AT 140,110
FIELD t$(17) TEXT "VECTOR ROTATION:" AT 10,120 RO
FIELD t$(18) TEXT rotation AT 140,120
FIELD t$(19) TEXT "SCALE FACTOR (RATIO):" AT 10,130 RO
FIELD t$(20) TEXT zoom AT 140,130
FIELD t$(21) TEXT "LEVEL OF DETAIL:" AT 10,140 RO
FIELD t$(22) TEXT fset AT 140,140
if rtype=5 then FIELD t$(23) TEXT "BLACKPOINT INTENSITY:" AT 10,150 RO
if rtype<> 5 then FIELD t$(23) TEXT "SPECULAR INTENSITY:" AT 10,150 RO
FIELD t$(24) TEXT spec AT 140,150

OUTPUT$=" SPECULAR"
IF OUTPUT=1 AND rtype=5 THEN OUTPUT$=" FULL RGB TYPE:"
IF OUTPUT=2 AND rtype=5 THEN OUTPUT$=" FULL RGB TYPE:"
IF OUTPUT=3 AND rtype=5 THEN OUTPUT$=" FULL RGB TYPE:"
IF OUTPUT=4 AND rtype=5 THEN OUTPUT$=" FULL RGB TYPE:"
IF OUTPUT=5 AND rtype=5 THEN OUTPUT$=" FULL RGB TYPE:"
IF OUTPUT=6 AND rtype=5 THEN OUTPUT$=" FULL RGB TYPE:"
IF OUTPUT=7 AND rtype=5 THEN OUTPUT$=" R INTENSITY"
IF OUTPUT=8 AND rtype=5 THEN OUTPUT$=" G INTENSITY"
IF OUTPUT=9 AND rtype=5 THEN OUTPUT$=" B INTENSITY"
IF OUTPUT=10 AND rtype=5 THEN OUTPUT$=" RGB AVERAGE"


FIELD t$(25) TEXT "OUTPUT -" & OUTPUT$ AT 10,160 RO
FIELD t$(26) TEXT OUTPUT AT 140,160
FIELD t$(27) TEXT "X CENTRE:" AT 10,180 RO
FIELD t$(28) TEXT xcent-1 AT 147,180 RO
FIELD t$(29) TEXT "Y CENTRE:" AT 10,190 RO
FIELD t$(30) TEXT ycent-1 AT 147,190 RO
FIELD t$(31) TEXT "CURRENT MAGNIFICATION AT:" AT 10,200 RO
FIELD t$(32) TEXT mag AT 147,200 RO
FIELD t$(33) TEXT "CURRENT SAVED IMAGE:" AT 10,210 RO
IF PICS=0 THEN LET pics$="N/A"
IF pics<>0 THEN pics$=STR$(pics)
FIELD t$(34) TEXT pics$ AT 147,210 RO

FOR n=1 TO 34
FIELD T$(n) FONT NAME "Helvetica"
FIELD T$(n) FONT COLOR 1,1,1
FIELD T$(n) BACK COLOR 0,0,0
FIELD T$(n) BACK ALPHA 0
FIELD T$(n) FONT SIZE 8
NEXT n

FILL COLOR 0,0,0
DRAW COLOR 1,1,1

BUTTON b$(1) TEXT "RENDER" AT 200,65 SIZE 80,20
BUTTON b$(2) TEXT "CENTRE" AT 200,110 SIZE 80,20
BUTTON b$(3) TEXT "SAVE IMAGE" AT 200,155 SIZE 80,20
BUTTON b$(4) TEXT "INPUT" AT 200,200 SIZE 80,20

REM fade page in

PAGE NAME$ ALPHA 0
PAGE NAME$ SHOW
IF rtype<>5 THEN FIELD T$(26) HIDE
FOR n=0 TO fade STEP fadestep
REFRESH
PAGE NAME$ ALPHA n
REFRESH
NEXT n


REM page routines

pageselect:
b1=BUTTON_PRESSED (b$(1))
b2=BUTTON_PRESSED (b$(2))
b3=BUTTON_PRESSED (b$(3))
b4=BUTTON_PRESSED (b$(4))
IF b1=1 THEN GOTO button1
IF b2=1 THEN GOTO button2
IF b3=1 THEN GOTO button3
IF b4=1 THEN GOTO button4
GOTO pageselect

REM fade page out

button1:
REM keep vars set by user and redraw
REM fade page
FOR n=fade TO 0 STEP -fadestep
PAGE NAME$ ALPHA n
REFRESH
NEXT n
REM set centre screen
tx=xw
ty=yw
REM user vars
rtype=FIELD_TEXT$ (t$(6))
cx= FIELD_TEXT$ (t$(8))
cy= FIELD_TEXT$ (t$(10))
fixedradius=FIELD_TEXT$(t$(12))
minradius=FIELD_TEXT$(t$(14))
SCALE=FIELD_TEXT$(t$(16))
rotation=FIELD_TEXT$(t$(18))
zoom=FIELD_TEXT$(t$(20))
fset=FIELD_TEXT$(t$(22))
spec=FIELD_TEXT$(t$(24))
OUTPUT=FIELD_TEXT$(t$(26))
PAGE NAME$ HIDE
gosub varcheck
GOTO varscalc

button2:
REM just zoom
REM fade page
FOR n=fade TO 0 STEP fadestep
PAGE NAME$ ALPHA n
REFRESH
NEXT n
REM set centre screen
tx=xw
ty=yw
REM keep zoom level but ommit other vars
zoom=FIELD_TEXT$(t$(20))
FOR n=fade TO 0 STEP -fadestep
PAGE NAME$ ALPHA n
REFRESH
NEXT n
PAGE NAME$ HIDE
gosub varcheck
GOTO zoom

button3:
REM save screenshot
IF pics=0 THEN DIR tdir$ CREATE
IF pics=0 THEN DIR tdir$ SET
tt$=date$ & month$ & year$ & "-" & hour$ & minute$ & second$ & "-" & (pics+1) &".jpg"
DIR "" SET
pics=pics+1
GRAPHICS SAVE 0,0,SCREEN_WIDTH(),SCREEN_HEIGHT() TO tt$
ALBUM EXPORT tt$
PAUSE 1
PAGE NAME$ ALPHA 0
FIELD t$(34) DELETE
FIELD t$(34) TEXT pics AT 147,210 RO
FIELD T$(34) FONT NAME "Helvetica"
FIELD T$(34) FONT COLOR 1,1,1
FIELD T$(34) BACK COLOR 0,0,0
FIELD T$(34) BACK ALPHA 0
FIELD T$(34) FONT SIZE 8
PAUSE 1
REM fade page
FOR n=0 TO fade STEP fadestep
PAGE NAME$ ALPHA n
REFRESH
NEXT n
GOTO pageselect

button4:
FIELD t$(varselect) SELECT 10,0
varselect=varselect+2
IF varselect>26 THEN varselect=6
GOTO pageselect

rem end of demo screen
demoend:
FOR n=1 TO 34
FIELD t$(n) DELETE
NEXT n
FIELD t$(1) TEXT "IRIGIMA V2.0" AT 10,0 RO
FIELD T$(2) TEXT "Thank you for using this DEMO version." at 10,20 ro
field t$(3) text "IRIGIMA UNLIMITED available via iOS AppStore." at 10,30 ro
FIELD T$(4) TEXT "Please visit our Facebook page -" AT 10,50 RO
FIELD T$(5) TEXT "For further information and examples." AT 10,60 RO
FIELD T$(6) TEXT "https://www.facebook.com/irigima/" AT 10,80 RO


FOR n=1 TO 34
FIELD T$(n) FONT NAME "Helvetica"
FIELD T$(n) FONT COLOR 1,1,1
FIELD T$(n) BACK COLOR 0,0,0
FIELD T$(n) BACK ALPHA 0
FIELD T$(n) FONT SIZE 8
NEXT n

for n= 1 to 4
button b$(n) delete
next n

FILL COLOR 0,0,0
DRAW COLOR 1,1,1

PAGE NAME$ ALPHA 0
PAGE NAME$ SHOW
REM fade page
FOR n=0 TO fade STEP fadestep
PAGE NAME$ ALPHA n
REFRESH
NEXT n
pause 10
exit

oldvars:
rem store all input variables for error check

oldrtype=rtype
oldcx=cx
oldcy=cy
oldfixedradius=fixedradius
oldminradius=minradius
oldscale=SCALE
oldrotation=rotation
oldzoom=zoom
oldfset=fset
oldspec=spec
oldoutput=OUTPUT
return


varcheck:
rem check any invalid input vars
errorflag=0
zoom=abs(zoom)

if rtype>5 then
rtype=oldrtype
errorflag=1
endif

if rtype<1 then
rtype=oldrtype
errorflag=1
endif

if fixedradius=0 then
fixedradius=oldfixedradius
errorflag=1
endif

if zoom=0 then
zoom=oldzoom
errorflag=1
endif

if spec=0 then
spec=oldspec
errorflag=1
endif

if output<1 then
output=oldoutput
errorflag=1
endif

if output>10 then
output=oldoutput
errorflag=1
endif

if errorflag=1 then
goto vardisplay
end if


return

Post Reply