Author Topic: and another one for your toolbox...  (Read 45908 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: and another one for your toolbox...
« Reply #60 on: December 16, 2019, 10:45:55 pm »
I’ve been working on setting up my forums to help organize and sort toolbox type code.  Take a look at them, bplus, and if they’d help you find/organize your stuff better, feel free to add to them.  http://www.smcneill.online/mybb/index.php

The more tools in a toolset, the more powerful and versatile that toolset becomes.  (As long as you can find the proper tool you need for the job at hand.)
« Last Edit: December 16, 2019, 11:13:29 pm by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: and another one for your toolbox...
« Reply #61 on: December 16, 2019, 10:57:36 pm »
Thanks Steve, your expertise is invaluable! Well I guess I have to sign up to see your Christmas thing ;-))
What's happening with your other forum?





Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: and another one for your toolbox...
« Reply #62 on: December 16, 2019, 11:10:35 pm »
Thanks Steve, your expertise is invaluable! Well I guess I have to sign up to see your Christmas thing ;-))
What's happening with your other forum?

It’s still up and going, but it has nasty upload limits and such which I don’t care for (as well as pop ups and advertisements).  I’m too cheap to pay a monthly fee to remove those adds and increase upload limits, so I figured a personal forum hosted on my own server will eliminate all those annoyances for me.  ;)
« Last Edit: December 16, 2019, 11:12:19 pm by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: and another one for your toolbox...
« Reply #63 on: December 17, 2019, 05:05:12 pm »
Another tool which all toolboxes should have, in some form or another -- an easy to use routine to display a large list on the screen.

Code: [Select]
DIM Array(10) AS STRING
DATA Apple,Banana,Cherry,Date,Fig,Grape,Huckleberry,Iced Fruit,Jambolan,Kiwi,Lemon
FOR i = 0 TO 10
    READ Array(i)
NEXT



choice = 0
DO
    CLS
    DisplayList 10, 10, 20, 5, choice, Array(), -1
    k = _KEYHIT
    SELECT CASE k
        CASE 18432
            choice = choice - 1
            IF choice < 0 THEN choice = 0
        CASE 20480
            choice = choice + 1
            IF choice > 10 THEN choice = 10
    END SELECT
    _DISPLAY
    _LIMIT 30
LOOP



SUB DisplayList (x AS INTEGER, y AS INTEGER, w AS INTEGER, l AS INTEGER, s AS INTEGER, choices() AS STRING, numbered AS _BYTE)
    'x/y location to place the start of our list
    'w is the width of our list on the screen
    'l is the length of the list items we want to display at a time
    's is the starting element that we want to display on the screen
    'choices() is the array that holds the actual list for us
    'numbered is the toggle for if we want to autonumber our list or not.
    '     0 says we don't want to number the list; just display it.
    '     A value less than 0 says we want to display the number index of the visible list
    '     A value greater than 0 says we want to display the number of visible elements from the list on the screen.


    'Some basic error checking is in need here
    IF s < LBOUND(choices) THEN s = LBOUND(choices)
    IF s + l - 1 > UBOUND(choices) THEN l = UBOUND(choices) - s + 1

    LOCATE x
    start = s: finish = s + l - 1
    FOR i = start TO finish
        counter = counter + 1
        IF numbered > 0 THEN counter$ = LTRIM$(STR$(counter)) + ") "
        IF numbered < 0 THEN counter$ = LTRIM$(STR$(counter + start - 1)) + ") "
        LOCATE , y: PRINT counter$ + LEFT$(choices(i), w - LEN(counter$))
    NEXT

END SUB

This is about as simple as it gets, with the actual code here in the sub being smaller than the comments to explain the sub...  Works in all screen modes, with use of simple LOCATE coordinates for placement.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Qbee

  • Newbie
  • Posts: 27
    • View Profile
Re: and another one for your toolbox...
« Reply #64 on: December 17, 2019, 06:42:12 pm »
Hello SMcNeill,

nice tool and works fine!

What I found is that you use x for rows (vertical position, top -> down) and y for columns (horizontal position, left -> right).

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: and another one for your toolbox...
« Reply #65 on: December 17, 2019, 07:16:20 pm »
Quote
Another tool which all toolboxes should have, in some form or another -- an easy to use routine to display a large list on the screen.

Yeah mine looks like this which was pretty much copied from Wiki for mouse wheel demo:
Code: QB64: [Select]
  1. DIM a(1 TO 100) AS STRING
  2. FOR i = LBOUND(a) TO UBOUND(a)
  3.     a(i) = "This is line #" + STR$(i)
  4.  
  5. show a() 'from toolbox
  6.  
  7. 'this uses 20 lines on screen to display an array
  8. SUB show (arr() AS STRING)
  9.     DIM lb AS LONG, ub AS LONG, top AS LONG, i AS LONG, row AS LONG, prevrow AS LONG, n AS LONG
  10.     lb = LBOUND(arr): ub = UBOUND(arr)
  11.     IF ub - lb + 1 < 21 THEN top = ub ELSE top = lb + 19
  12.     CLS: PRINT "press any key to quit scroller..."
  13.     LOCATE 2, 1
  14.     FOR i = lb TO top
  15.         PRINT arr(i)
  16.     NEXT
  17.     DO
  18.         IF ub - lb + 1 > 20 THEN
  19.             DO WHILE _MOUSEINPUT
  20.                 IF row >= lb THEN row = row + _MOUSEWHEEL ELSE row = lb 'prevent under scrolling
  21.                 IF row > ub - 19 THEN row = ub - 19 'prevent over scrolling
  22.                 IF prevrow <> row THEN 'look for a change in row value
  23.                     IF row >= lb AND row <= ub - 19 THEN
  24.                         CLS: PRINT "press any key to quit scroller..."
  25.                         LOCATE 2, 1
  26.                         FOR n = row TO row + 19
  27.                             PRINT arr(n)
  28.                         NEXT
  29.                     END IF
  30.                 END IF
  31.                 prevrow = row 'store previous row value
  32.             LOOP
  33.         END IF
  34.     LOOP UNTIL INKEY$ > ""
  35.  
  36.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: and another one for your toolbox...
« Reply #66 on: January 15, 2020, 12:11:54 pm »
Best Topic now is jumping you to most recent addition that you might find handy in your tool box if you dont have already.

Developed in Deal or No Deal, https://www.qb64.org/forum/index.php?topic=2092.0

A comma money format or comma fixed decimal places for type Double#:
Code: QB64: [Select]
  1. _TITLE "commaD$ and money$ test" 'b+ 2020-01-14
  2.  
  3. FOR i = 1 TO 20
  4.     test# = (-10) ^ (i - 1) + RND
  5.     PRINT i - 1, commaD$(test#, 6);
  6.     LOCATE i, 50: PRINT money$(test#)
  7. PRINT "As you can see the integer part is limited to 15 places,"
  8. PRINT " Trillions for Type Double#."
  9.  
  10. FUNCTION commaD$ (n#, nDecPlaces%) 'only works right for double# type
  11.     DIM place AS INTEGER, s$, front$, back$
  12.     commaD$ = _TRIM$(STR$(n#))
  13.     IF LEFT$(commaD$, 1) = "-" THEN s$ = "-": commaD$ = MID$(commaD$, 2) ELSE s$ = ""
  14.     place = INSTR(commaD$, ".")
  15.     IF place = 0 THEN place = LEN(commaD$) + 1
  16.     WHILE place > 4
  17.         commaD$ = MID$(commaD$, 1, place - 4) + "," + MID$(commaD$, place - 3)
  18.         place = INSTR(commaD$, ",")
  19.     WEND
  20.     'fix to nDecPlaces
  21.     place = INSTR(commaD$, ".")
  22.     IF nDecPlaces% THEN
  23.         IF place THEN
  24.             front$ = MID$(commaD$, 1, place)
  25.             back$ = MID$(commaD$, place + 1)
  26.             IF LEN(back$) > nDecPlaces% THEN commaD$ = front$ + LEFT$(back$, nDecPlaces%)
  27.             IF LEN(back$) < nDecPlaces% THEN commaD$ = front$ + LEFT$(back$ + STRING$(nDecPlaces%, "0"), nDecPlaces%)
  28.         ELSE
  29.             commaD$ = commaD$ + "." + STRING$(nDecPlaces%, "0")
  30.         END IF
  31.     ELSE
  32.         IF place THEN commaD$ = MID$(commaD$, 1, place - 1)
  33.     END IF
  34.     commaD$ = s$ + commaD$
  35.  
  36. 'this might make a nice Money format
  37. FUNCTION money$ (n#) 'only works right for double# type
  38.     money$ = _TRIM$(STR$(n#))
  39.     IF LEFT$(money$, 1) = "-" THEN s$ = "-": money$ = MID$(money$, 2) ELSE s$ = ""
  40.     place = INSTR(money$, ".")
  41.     IF place = 0 THEN place = LEN(money$) + 1
  42.     WHILE place > 4
  43.         money$ = MID$(money$, 1, place - 4) + "," + MID$(money$, place - 3)
  44.         place = INSTR(money$, ",")
  45.     WEND
  46.  
  47.     'fix this for 2 places after decimal
  48.     place = INSTR(money$, ".")
  49.     IF place THEN
  50.         front$ = MID$(money$, 1, place)
  51.         back$ = MID$(money$, place + 1)
  52.         IF LEN(back$) > 2 THEN money$ = front$ + LEFT$(back$, 2)
  53.         IF LEN(back$) < 2 THEN money$ = front$ + LEFT$(back$ + "00", 2)
  54.     ELSE
  55.         money$ = money$ + ".00"
  56.     END IF
  57.     money$ = "$" + s$ + money$
  58.  
  59.  
« Last Edit: January 15, 2020, 01:04:16 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: and another one for your toolbox...
« Reply #67 on: January 25, 2020, 02:51:11 pm »
I don't know it this will get used much but here is STxAxTIC's Curve Smoother modified into a Toolbox SUB and demo's here: https://www.qb64.org/forum/index.php?topic=2114.msg113585#msg113585

Code: QB64: [Select]
  1. '======================= Feature SUB =======================================================================
  2. ' This code takes a dynamic points array and adds and modifies points to smooth out the data,
  3. ' to be used as Toolbox SUB. b+ 2020-01-24 adapted and modified from:
  4. ' Curve smoother by STxAxTIC https://www.qb64.org/forum/index.php?topic=184.msg963#msg963
  5. SUB Smooth (arr() AS XY, targetPoints AS INTEGER, smoothIterations AS INTEGER)
  6.     'TYPE XY
  7.     '    x AS SINGLE
  8.     '    y AS SINGLE
  9.     'END TYPE
  10.     ' targetPoints is the number of points to be in finished smoothed out array
  11.     ' smoothIterations is number of times to try and round out corners
  12.  
  13.     DIM rad2Max, kmax, k, numPoints, xfac, yfac, rad2, j
  14.     numPoints = UBOUND(arr)
  15.     REDIM _PRESERVE arr(0 TO targetPoints) AS XY
  16.     REDIM temp(0 TO targetPoints) AS XY
  17.     DO
  18.         '
  19.         ' Determine the pair of neighboring points that have the greatest separation of all pairs.
  20.         '
  21.         rad2Max = -1
  22.         kmax = -1
  23.         FOR k = 1 TO numPoints - 1
  24.             xfac = arr(k).x - arr(k + 1).x
  25.             yfac = arr(k).y - arr(k + 1).y
  26.             rad2 = xfac ^ 2 + yfac ^ 2
  27.             IF rad2 > rad2Max THEN
  28.                 kmax = k
  29.                 rad2Max = rad2
  30.             END IF
  31.         NEXT
  32.         '
  33.         ' Starting next to kmax, create a `gap' by shifting all other points by one index.
  34.         '
  35.         FOR j = numPoints TO kmax + 1 STEP -1
  36.             arr(j + 1).x = arr(j).x
  37.             arr(j + 1).y = arr(j).y
  38.         NEXT
  39.  
  40.         '
  41.         ' Fill the gap with a new point whose position is determined by the average of its neighbors.
  42.         '
  43.         arr(kmax + 1).x = .5 * (arr(kmax).x + arr(kmax + 2).x)
  44.         arr(kmax + 1).y = .5 * (arr(kmax).y + arr(kmax + 2).y)
  45.  
  46.         numPoints = numPoints + 1
  47.     LOOP UNTIL (numPoints = targetPoints)
  48.     '
  49.     ' At this stage, the curve still has all of its sharp edges. Use a `relaxation method' to smooth.
  50.     ' The new position of a point is equal to the average position of its neighboring points.
  51.     '
  52.     FOR j = 1 TO smoothIterations
  53.         FOR k = 2 TO numPoints - 1
  54.             temp(k).x = .5 * (arr(k - 1).x + arr(k + 1).x)
  55.             temp(k).y = .5 * (arr(k - 1).y + arr(k + 1).y)
  56.         NEXT
  57.         FOR k = 2 TO numPoints - 1
  58.             arr(k).x = temp(k).x
  59.             arr(k).y = temp(k).y
  60.         NEXT
  61.     NEXT
  62.  

A really nice update to yCP:
Code: QB64: [Select]
  1. 'update 2020-01-24 now with _printwidth so can use any FONT
  2. SUB yCP (y, s$) 'for xmax pixel wide graphics screen Center Print at pixel y row
  3.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(s$)) / 2, y), s$



Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: and another one for your toolbox...
« Reply #68 on: February 15, 2020, 11:42:00 am »
Feature for February 2020: cText demo
Code: QB64: [Select]
  1. _TITLE "Blinking and more with text string" 'b+ 2020-02-15
  2.  
  3. '===================================================================================
  4. ' Lets blink between colors white and blue, expanding and shrinking text for 10 secs
  5. '===================================================================================
  6.  
  7. s$ = "Blink colors white and blue, expanding and shrinking centered text for 10 secs"
  8. SCREEN _NEWIMAGE(800, 600, 32)
  9. th = 16 'Text Height - start normal
  10. dh = 1  'change height
  11. flashTimes = 100 'with limit 10 this will take 10 times a second and be done in 100/10 secs
  12. start$ = TIME$
  13. WHILE _KEYDOWN(27) = 0
  14.     CLS
  15.     PRINT start$; ", ";
  16.     IF flashTimes THEN
  17.         IF toggle = 1 THEN C~& = &HFFFFFFFF ELSE C~& = &HFF0000FF
  18.         cText _WIDTH / 2, _HEIGHT / 2, th, C~&, s$
  19.         toggle = 1 - toggle
  20.         th = th + dh
  21.         IF th > 64 THEN th = 64: dh = -dh
  22.         IF th < 6 THEN th = 6: dh = -dh
  23.         flashTimes = flashTimes - 1
  24.         lastFlash$ = TIME$
  25.     ELSE
  26.         cText _WIDTH / 2, _HEIGHT / 2, 16, &HFFFFFF00, s$
  27.     END IF
  28.     PRINT lastFlash$; " <<<< notice these numbers are not flashing even though we CLS every frame"
  29.     _DISPLAY '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> eliminates blinking screens when use CLS
  30.     _LIMIT 10 '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  allows maximum number of loops of 10 per sec
  31.  
  32. 'center the text at x, y with given height and color
  33. SUB cText (x, y, textHeight, K AS _UNSIGNED LONG, txt$)
  34.     DIM fg AS _UNSIGNED LONG, cur&, I&, mult, xlen
  35.     fg = _DEFAULTCOLOR
  36.     'screen snapshot
  37.     cur& = _DEST
  38.     I& = _NEWIMAGE(8 * LEN(txt$), 16, 32)
  39.     _DEST I&
  40.     COLOR K, _RGBA32(0, 0, 0, 0)
  41.     _PRINTSTRING (0, 0), txt$
  42.     mult = textHeight / 16
  43.     xlen = LEN(txt$) * 8 * mult
  44.     _PUTIMAGE (x - .5 * xlen, y - .5 * textHeight)-STEP(xlen, textHeight), I&, cur&
  45.     COLOR fg
  46.     _FREEIMAGE I&
  47.  
« Last Edit: February 15, 2020, 11:59:28 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: and another one for your toolbox...
« Reply #69 on: March 03, 2020, 02:46:43 pm »
I am posting this as a candidate for the forum Toolbox after seeing the issue of image rotation come up once again last night. Starting about here: https://www.qb64.org/forum/index.php?topic=2219.msg115122#msg115122

I found my own latest version of Rotozoom posted in this thread needed a little fix (8 updates in one day https://www.qb64.org/forum/index.php?topic=1511.msg112211#msg112211) and I want this demo posted to be sure I don't have such an obvious mistake go into Toolbox. So last chance to break this guys.

I have researched forum starting with STxAxTIC and Fellippe's code in above link, found nice stuff from Steve (working with text 3 subs and at least 100 lines...) and William33's (has more paramenters than needed IMHO but short and sweet too), found [banned user] and Old Moses citing my Rotozoom2, so I think I meet STxAxTIC's stringent criteria.

Code: QB64: [Select]
  1. _TITLE "Another RotoZoom Demo" 'b+ started 2020-03-02
  2.  
  3. CONST xmax = 1200, ymax = 700, xc = 600, yc = 350
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5. _SCREENMOVE 100, 40
  6. DIM SHARED s&, ao
  7. DIM a, x, y, x1, y1, xs, dxs, ddxs, ys, dys, ddys, maxScale
  8.  
  9. ' Starting from an image I pulled from Internet, I used Paint 3D to give it a transparent background.
  10. s& = _LOADIMAGE("tspike.png") 't for transparent background
  11.  
  12.  
  13. ' Standard Rotation about the image center on a given X, Y location. Rotating image in middle of screen,
  14. ' I used something like this to find ideal angle for level point on left head on right.
  15. WHILE _KEYDOWN(27) = 0
  16.     a = a + _PI(1 / 36)
  17.     IF a > _PI(1.999) THEN a = 0
  18.     CLS
  19.     RotoZoom3 xc, yc, s&, 1, 1, a
  20.     PRINT "Raw image rotation:": PRINT
  21.     PRINT "radian angle:"; a; "   degrees:"; _R2D(a) \ 1; " press key for next angle... esc to rotate on y axis"
  22.     WHILE LEN(INKEY$) = 0: _LIMIT 60: WEND
  23.  
  24. ao = _PI(.27) ' I have to offset the image angle by this amount so that the spike point is on the left
  25. '               and the head is on the right at 0 degrees or radians.
  26.  
  27.  
  28. 'Demo of the independent x and y scale for axis rotations
  29. maxScale = 4: dxs = .01: ddxs = 1: xs = maxScale:
  30.     CLS
  31.     PRINT "Press any for rotation on x axis..."
  32.     RotoZoom3 xc, yc, s&, xs, maxScale, ao
  33.     IF xs + dxs > maxScale OR xs + dxs < -maxScale THEN ddxs = ddxs * -1
  34.     xs = xs + dxs * ddxs
  35.     _DISPLAY
  36.     _LIMIT 60
  37.  
  38. ys = maxScale: dys = .01: ddys = 1
  39.     CLS
  40.     PRINT "Press any to see layout of image over whole screen and end demo..."
  41.     RotoZoom3 xc, yc, s&, maxScale, ys, ao
  42.     IF ys + dys > maxScale OR ys + dys < -maxScale THEN ddys = ddys * -1
  43.     ys = ys + dys * ddys
  44.     _DISPLAY
  45.     _LIMIT 60
  46.  
  47. ' Demo of an applied layout on screen
  48. COLOR , &HFFBBBBBB: CLS ' the image has slight gray halo so hide with gray background
  49. FOR x = 40 TO _WIDTH - 40 STEP 20
  50.     RotoZoom3 x, 15, s&, .2, .2, _PI(1.5 + .27)
  51.     RotoZoom3 x, _HEIGHT - 15, s&, .2, .2, _PI(.5 + .27)
  52. FOR y = 40 TO _HEIGHT - 40 STEP 20
  53.     RotoZoom3 15, y, s&, .2, .2, _PI(1 + .27)
  54.     RotoZoom3 _WIDTH - 15, y, s&, .2, .2, _PI(.27)
  55. FOR a = 0 TO _PI(2) STEP _PI(1 / 6)
  56.     x1 = xc + 200 * COS(a)
  57.     y1 = yc + 200 * SIN(a)
  58.     RotoZoom3 x1, y1, s&, 2, 2, a + ao
  59.  
  60. 'And finally a little show. What is better than a knife thrower throwing bananas?
  61. WHILE _KEYDOWN(27) = 0
  62.     CLS
  63.     drawKite xc, .9 * ymax, 600, a + ao
  64.     _DISPLAY
  65.     _LIMIT 30
  66.     a = a + _PI(2 / 360)
  67.  
  68. SUB drawKite (x, y, s, a)
  69.     RotoZoom3 x, y, s&, s / _WIDTH(s&), s / _HEIGHT(s&), a + ao
  70.     IF s > 10 THEN
  71.         drawKite x + .5 * s * COS(_PI(2) - a), (y - .25 * s) + .25 * s * SIN(_PI(2) - a), s / 1.5, a
  72.         drawKite x + .5 * s * COS(_PI + a), (y - .25 * s) + .25 * s * SIN(_PI + a), s / 1.5, a
  73.     END IF
  74.  
  75. ' Description:
  76. ' Started from a mod of Galleon's in Wiki that both scales and rotates an image.
  77. ' This version scales the x-axis and y-axis independently allowing rotations of image just by changing X or Y Scales
  78. ' making this tightly coded routine a very powerful and versatile image tool.
  79. SUB RotoZoom3 (X AS LONG, Y AS LONG, Image AS LONG, xScale AS SINGLE, yScale AS SINGLE, radianRotation AS SINGLE)
  80.     ' This assumes you have set your drawing location with _DEST or default to screen.
  81.     ' X, Y - is where you want to put the middle of the image
  82.     ' Image - is the handle assigned with _LOADIMAGE
  83.     ' xScale, yScale - are shrinkage < 1 or magnification > 1 on the given axis, 1 just uses image size.
  84.     ' These are multipliers so .5 will create image .5 size on given axis and 2 for twice image size.
  85.     ' radianRotation is the Angle in Radian units to rotate the image
  86.     ' note: Radian units for rotation because it matches angle units of other Basic Trig functions
  87.     '       and saves a little time converting from degree.
  88.     '       Use the _D2R() function if you prefer to work in degree units for angles.
  89.  
  90.     DIM px(3) AS SINGLE: DIM py(3) AS SINGLE ' simple arrays for x, y to hold the 4 corners of image
  91.     DIM W&, H&, sinr!, cosr!, i&, x2&, y2& '   variables for image manipulation
  92.     W& = _WIDTH(Image&): H& = _HEIGHT(Image&)
  93.     px(0) = -W& / 2: py(0) = -H& / 2 'left top corner
  94.     px(1) = -W& / 2: py(1) = H& / 2 ' left bottom corner
  95.     px(2) = W& / 2: py(2) = H& / 2 '  right bottom
  96.     px(3) = W& / 2: py(3) = -H& / 2 ' right top
  97.     sinr! = SIN(-radianRotation): cosr! = COS(-radianRotation) ' rotation helpers
  98.     FOR i& = 0 TO 3 ' calc new point locations with rotation and zoom
  99.         x2& = xScale * (px(i&) * cosr! + sinr! * py(i&)) + X: y2& = yScale * (py(i&) * cosr! - px(i&) * sinr!) + Y
  100.         px(i&) = x2&: py(i&) = y2&
  101.     NEXT
  102.     _MAPTRIANGLE _SEAMLESS(0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image TO(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
  103.     _MAPTRIANGLE _SEAMLESS(0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image TO(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
  104.  

EDIT: 2020-03-04 added a little show at end of demo after fixing some minor details, the zip bas file has been updated as shown above.

Here is demo in zip for the test image:
* Another RotoZoom Demo.zip (Filesize: 11.24 KB, Downloads: 332)
« Last Edit: March 04, 2020, 09:27:43 pm by bplus »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: and another one for your toolbox...
« Reply #70 on: March 03, 2020, 05:25:56 pm »
Cool bplus!

So by all means, feel free to add that to where ever you see fit. I'm so vocal about the filtration process so eventually I dont have to do it. There will be a prevailing style which will, if broken, stand out on it's own as irregular. Since it's still early I'm bull-dogging this but soon that can be over.

Anyway, post away. Make things minimal and explain parameters nicely like we did in the ellipse work.... actually nvm, I see you've covered that
« Last Edit: March 03, 2020, 05:27:13 pm by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: and another one for your toolbox...
« Reply #71 on: March 03, 2020, 06:30:05 pm »
Thanks for your support STxAxTIC :)

I am still finding little bugs, fortunately it's in the demo. I am going to check this again with fresh eyes a couple more times, try applying in more situations wait if someone catches something. Oh, I am curious how this might work as a _PUTIMAGE substitute.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: and another one for your toolbox...
« Reply #72 on: March 04, 2020, 09:14:28 am »
Great Bplus!
Is it a nail that goes around?
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: and another one for your toolbox...
« Reply #73 on: March 04, 2020, 10:48:48 am »
Great Bplus!
Is it a nail that goes around?

Just what I was thinking this morning, what a great demo that would be, like a knife thrower only with bananas.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: and another one for your toolbox...
« Reply #74 on: March 04, 2020, 04:18:03 pm »
Hey Friend 
about
Quote
Just what I was thinking this morning, what a great demo that would be, like a knife thrower only with bananas.
I think that in a female prison it would be a great success!  :-) As for the nail in your demo it changes continuosly point of view! ;-)
Programming isn't difficult, only it's  consuming time and coffee