- 'Image sizing in predefined space using branchless equations 
-   
- 'create test patterns, one wide & one tall 
-     CIRCLE (150, 240),-  x , &HFF0000FF
 
-     CIRCLE (375, 240),-  x , &HFF0000FF
 
-     CIRCLE (600, 240),-  x , &HFF0000FF
 
-   
-     LINE (100 +-  x , 100 +-  x )-(380 --  x , 380 --  x ), &HFFFF0000,-  B 
 
-     LINE (100 +-  x , 470 +-  x )-(380 --  x , 650 --  x ), &HFFFF0000,-  B 
 
-   
- 'Or load images of your choosing in lieu of test patterns 
-   
-   
- x% = 400: y% = 20: x1% = 650: y1% = 300 '                       use predetermined part of the screen (400, 20)-(650, 300) 
- LINE (- x% ,-  y% )-(- x1% ,-  y1% ), &H7F7F7F7F,-  B  , &H0101 '              show target area
 
- Image_Resize x%, y%, x1%, y1%, W&, 0, "c", "u" '                justify up, wide image 
-   
- LINE (- x% ,-  y% )-(- x1% ,-  y1% ), &H7F7F7F7F,-  B  , &H0101 '              show target area
 
- Image_Resize x%, y%, x1%, y1%, T&, 0, "r", "c" '                justify right, tall image 
-   
- x%  = 0- : y%  = 0- : x1%  = _WIDTH - 1- : y1%  = _HEIGHT - 1 '           use full screen
- Image_Resize x%, y%, x1%, y1%, W&, 0, "c", "u" '                justify up, wide image 
-   
- Image_Resize x%, y%, x1%, y1%, T&, 0, "l", "c" '                justify left, tall image 
-   
- Image_Resize x%, y%, x1%, y1%, W&, 0, "c", "d" '                justify down, wide image 
-   
- x% = 25: y% = 450: x1% = 250: y1% = 580 '                       use predetermined part of the screen (25, 450)-(250, 580) 
- LINE (- x% ,-  y% )-(- x1% ,-  y1% ), &H7F7F7F7F,-  B  , &H0101 '              show target area
 
- Image_Resize x%, y%, x1%, y1%, W&, 0, "c", "c" '                justify center, wide image 
-   
- LINE (- x% ,-  y% )-(- x1% ,-  y1% ), &H7F7F7F7F,-  B  , &H0101 '              show target area
 
- Image_Resize x%, y%, x1%, y1%, T&, 0, "c", "c" '                justify center, tall image 
-   
- 'and you get the idea... 
-   
-   
-   
-     'Syntax: upper left x, upper left y, lower right x, lower right y, image handle, destination handle, horizontal justification, vertical justification 
-     'horizontal justifications= "l" left, "c" center, "r" right 
-     'vertical justifications= "u" up, "c" center, "d" down 
-     xp = xpos: yp = ypos: xl = xlim: yl = ylim 
-     xrt  = (- xl  --  xp ) / _WIDTH(- i ) '                               width of area divided by width of image
-     yrt  = (- yl  --  yp ) / _HEIGHT(- i ) '                              height of area divided by height of image
-     rt  = ABS((- xrt  * (- xrt  <-  yrt )) + (- yrt  * (- yrt  <=-  xrt ))) '      pick the smaller of the two ratios to fit area
-     xs  = _WIDTH(- i ) *-  rt  '                                       final image size ratio in x
-     ys  = _HEIGHT(- i ) *-  rt  '                                      final image size ratio in y
-   
-     xp  =-  xp  * ABS(- xj  = "l") + (_SHR(- xl  --  xp , 1) +-  xp  - _SHR(- xs , 1)) * ABS(- xj  = "c") + (- xl  --  xs ) * ABS(- xj  = "r")
-     xl = xp + xs 
-     yp  =-  yp  * ABS(- yj  = "u") + (_SHR(- yl  --  yp , 1) +-  yp  - _SHR(- ys , 1)) * ABS(- yj  = "c") + (- yl  --  ys ) * ABS(- yj  = "d")
-     yl = yp + ys 
-   
-