Author Topic: What a great....  (Read 567 times)

Aurel

  • Guest
What a great....
« on: May 26, 2019, 05:30:21 PM »

Aurel

  • Guest
Re: What a great....
« Reply #1 on: May 28, 2019, 06:51:17 AM »
Well...well
I finally figured that most of members there are Americans...
hmm probably that is why that forum is compact

B+

  • Guest
Re: What a great....
« Reply #2 on: May 28, 2019, 02:31:26 PM »
 ;D

Code: [Select]
_TITLE "For Memorial Day" 'trans 2019-05-27 B+ from
'For Memorial Day.txt for Just Basic v1.01 [B+=MGA] 2016-05-29
' plus ad liberty

' notes: American Flag close to proportion standards
'
' verticals:
' Hoist Flag = 1.0 vertical height use 650 pixels because divided by 13 = 50 each stripe
'Hoist Union = 7/13        = 350
'     stripe = 1/13        =  50
' star space = .054        =  350/(10 spaces) = 35 pixels   35/650 ~ .5385
'
' horizontals:
'  Fly Flag length = 1.9   = 650 * 1.9 = 1235
' Fly Union length =  .76  = 650 * .76 = 494
'       star space =  .063  494/(12 spaces) ~  41.167 using 41 * 12 = 492 add 1 pixel before and after stars

'star outer diameter = .0616 * 650 ~ 40 (40.04) so outer radius is 20
' and inner (20 / 2.5) = 8 < does not look right try 7

CONST XMAX = 1235 '<=== actual drawing space needed
CONST YMAX = 650 '<=== actual drawing space needed
CONST PI = _PI
CONST DEG = 180 / PI
CONST RAD = PI / 180

CONST White = &HFFFFFFFF
'https://www.google.com/search?client=opera&q=US+flag+blue+spec&sourceid=opera&ie=UTF-8&oe=UTF-8
CONST OldGloryRed = &HFFBF0A30
CONST OldGloryBlue = &HFF002868

SCREEN _NEWIMAGE(XMAX, YMAX, 32)
_SCREENMOVE 100, 50

LINE (0, 0)-(XMAX, YMAX), OldGloryRed, BF
FOR row = 1 TO 12 STEP 2
    LINE (0, row * 50 - b)-(XMAX, (row + 1) * 50 + b), White, BF
NEXT

'the "Union"
LINE (0, 0)-(494, 350), OldGloryBlue, BF
FOR row = 1 TO 9
    ystar = 35 * row
    IF row MOD 2 = 1 THEN
        FOR col = 0 TO 5
            xstar = 42 + col * 2 * 41
            star xstar, ystar, 7.5, 19.5, 5, 18, White
        NEXT
    ELSE
        FOR col = 0 TO 4
            xstar = 83 + col * 2 * 41
            star xstar, ystar, 7.5, 19.5, 5, 18, White
        NEXT
    END IF
NEXT
_DISPLAY
SLEEP

SUB star (x, y, rInner, rOuter, nPoints, angleOffset, K AS _UNSIGNED LONG)
    ' x, y are same as for circle,
    ' rInner is center circle radius
    ' rOuter is the outer most point of star
    ' nPoints is the number of points,
    ' angleOffset = angle offset IN DEGREES, it will be converted to radians in sub
    ' this is to allow us to spin the polygon of n sides

    pAngle = RAD * (360 / nPoints): radAngleOffset = RAD * angleOffset
    x1 = x + rInner * COS(radAngleOffset)
    y1 = y + rInner * SIN(radAngleOffset)
    FOR i = 0 TO nPoints - 1
        x2 = x + rOuter * COS(i * pAngle + radAngleOffset + .5 * pAngle)
        y2 = y + rOuter * SIN(i * pAngle + radAngleOffset + .5 * pAngle)
        x3 = x + rInner * COS((i + 1) * pAngle + radAngleOffset)
        y3 = y + rInner * SIN((i + 1) * pAngle + radAngleOffset)
        ftri x1, y1, x2, y2, x3, y3, K
        'triangles leaked
        LINE (x1, y1)-(x2, y2), White
        LINE (x2, y2)-(x3, y3), White
        LINE (x3, y3)-(x1, y1), White
        x1 = x3: y1 = y3
    NEXT
    PAINT (x, y), White, White
END SUB

SUB ftri (x1, y1, x2, y2, x3, y3, K AS _UNSIGNED LONG)
    a& = _NEWIMAGE(1, 1, 32)
    _DEST a&
    PSET (0, 0), K
    _DEST 0
    _MAPTRIANGLE _SEAMLESS(0, 0)-(0, 0)-(0, 0), a& TO(x1, y1)-(x2, y2)-(x3, y3)
    _FREEIMAGE a& '<<< this is important!
END SUB