Sending Color to Specific Location
#2
Something simple like this?

Code: (Select All)
Screen _NewImage(640, 480, 32)
$Color:32
Color White
_PrintString (100, 100), "Hello World"

For i = 0 To 10 Step 2
    ChangeColor 100 + i * _FontWidth, 100, 1, White, Red
Next


Sub ChangeColor (WhereX, WhereY, HowManyCharacters, OriginalColor As _Unsigned Long, NewColor As _Unsigned Long)
    Static m As _MEM
    Dim o As _Offset
    m = _MemImage(0)
    x1 = WhereX
    y1 = WhereY
    x2 = x1 + HowManyCharacters * _FontWidth
    y2 = y1 + HowManyCharacters * _FontHeight
    $Checking:Off
    For y = y1 * _Width * 4 To y2 * _Width * 4 Step _Width
        For x = x1 * 4 To x2 * 4 Step 4
            o = m.OFFSET + y + x
            If _MemGet(m, o, _Unsigned Long) = OriginalColor Then _MemPut m, o, NewColor
        Next
    Next
    $Checking:On
End Sub
Reply


Messages In This Thread
Sending Color to Specific Location - by Dimster - 12-16-2022, 04:03 PM
RE: Sending Color to Specific Location - by SMcNeill - 12-16-2022, 04:39 PM
RE: Sending Color to Specific Location - by Pete - 12-16-2022, 05:12 PM
RE: Sending Color to Specific Location - by Pete - 12-16-2022, 07:47 PM



Users browsing this thread: 5 Guest(s)