qb64-include/negative.bm
2022-05-20 23:31:48 +02:00

25 lines
606 B
Text

Sub negative (image As Long)
Dim olddest As Long
Dim oldsource As Long
Dim y As Long
Dim x As Long
Dim orgc As _Unsigned Long
Dim r As Integer
Dim g As Integer
Dim b As Integer
olddest = _Dest
oldsource = _Source
_Dest image
_Source image
For y = 0 To _Height(image) - 1
For x = 0 To _Width(image) - 1
orgc = Point(x, y)
r = 255 - _Red(orgc)
g = 255 - _Green(orgc)
b = 255 - _Blue(orgc)
PSet (x, y), _RGB32(r, g, b)
Next
Next
_Dest olddest
_Source oldsource
End Sub