a start
This commit is contained in:
parent
29210af86b
commit
0741413c93
11 changed files with 144 additions and 0 deletions
2
bool.bi
Normal file
2
bool.bi
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
Const False = 0
|
||||||
|
Const True = Not False
|
||||||
8
consolecolor.bm
Normal file
8
consolecolor.bm
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
Sub ConsoleColor (Colour As _Unsigned Long)
|
||||||
|
Select Case Colour
|
||||||
|
Case 0 TO 255
|
||||||
|
Print Chr$(27) + "[38;5;" + _Trim$(Str$(Colour)) + "m";
|
||||||
|
Case Is > 255
|
||||||
|
Print Chr$(27) + "[38;2;" + _Trim$(Str$(_Red32(Colour))) + ";" + _Trim$(Str$(_Green32(Colour))) + ";" + _Trim$(Str$(_Blue32(Colour))) + "m";
|
||||||
|
End Select
|
||||||
|
End Sub
|
||||||
19
grayscale.bm
Normal file
19
grayscale.bm
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
Sub grayscale (image As Long)
|
||||||
|
Dim mimg As _MEM
|
||||||
|
Dim As _Offset start, length
|
||||||
|
Dim As _Unsigned _Byte inputRed, inputGreen, inputBlue, nc
|
||||||
|
mimg = _MemImage(image)
|
||||||
|
start = mimg.OFFSET
|
||||||
|
length = start + _Width(image) * _Height(image) * 4
|
||||||
|
Do
|
||||||
|
inputBlue = _MemGet(mimg, start, _Unsigned _Byte)
|
||||||
|
inputGreen = _MemGet(mimg, start + 1, _Unsigned _Byte)
|
||||||
|
inputRed = _MemGet(mimg, start + 2, _Unsigned _Byte)
|
||||||
|
nc = (inputRed * 0.21) + (inputGreen * 0.72) + (inputBlue * 0.07)
|
||||||
|
_MemPut mimg, start, nc As _Unsigned _Byte
|
||||||
|
_MemPut mimg, start + 1, nc As _Unsigned _Byte
|
||||||
|
_MemPut mimg, start + 2, nc As _Unsigned _Byte
|
||||||
|
start = start + 4
|
||||||
|
Loop Until start = length
|
||||||
|
_MemFree mimg
|
||||||
|
End Sub
|
||||||
3
lerp.bm
Normal file
3
lerp.bm
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Function Lerp (v0, v1, t)
|
||||||
|
Lerp = (1 - t) * v0 + t * v1
|
||||||
|
End Function
|
||||||
25
loadhexpalette.bm
Normal file
25
loadhexpalette.bm
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
SUB LoadHexPalette (Filename$, palettearray() AS _UNSIGNED LONG)
|
||||||
|
DIM i AS INTEGER
|
||||||
|
DIM ff AS INTEGER
|
||||||
|
DIM r AS _UNSIGNED _BYTE
|
||||||
|
DIM g AS _UNSIGNED _BYTE
|
||||||
|
DIM b AS _UNSIGNED _BYTE
|
||||||
|
DIM Colorload AS STRING
|
||||||
|
i = LBOUND(palettearray) - 1
|
||||||
|
ff = FREEFILE
|
||||||
|
IF _FILEEXISTS(Filename$) THEN
|
||||||
|
OPEN Filename$ FOR INPUT AS ff
|
||||||
|
DO UNTIL EOF(ff)
|
||||||
|
LINE INPUT #ff, Colorload
|
||||||
|
r = VAL("&H" + MID$(Colorload, 1, 2))
|
||||||
|
g = VAL("&H" + MID$(Colorload, 3, 2))
|
||||||
|
b = VAL("&H" + MID$(Colorload, 5, 2))
|
||||||
|
i = i + 1
|
||||||
|
IF i > UBOUND(palettearray) THEN
|
||||||
|
REDIM _PRESERVE palettearray(i) AS _UNSIGNED LONG
|
||||||
|
END IF
|
||||||
|
palettearray(i) = _RGB32(r, g, b)
|
||||||
|
LOOP
|
||||||
|
CLOSE ff
|
||||||
|
END IF
|
||||||
|
END SUB
|
||||||
3
max.bm
Normal file
3
max.bm
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
FUNCTION Max (num1, num2)
|
||||||
|
Max = ((num1 > num2) * -num1) + ((num2 >= num1) * -num2)
|
||||||
|
END FUNCTION
|
||||||
3
min.bm
Normal file
3
min.bm
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
FUNCTION Min (num1, num2)
|
||||||
|
Min = ((num1 < num2) * -num1) + ((num2 <= num1) * -num2)
|
||||||
|
END FUNCTION
|
||||||
25
negative.bm
Normal file
25
negative.bm
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
Sub negative (__image As Long)
|
||||||
|
Dim __dest As Long
|
||||||
|
Dim __source 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
|
||||||
|
__dest = _Dest
|
||||||
|
__source = _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 __dest
|
||||||
|
_Source __source
|
||||||
|
End Sub
|
||||||
28
noframe.bi
Normal file
28
noframe.bi
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
Declare CustomType Library
|
||||||
|
Function FindWindow& (ByVal ClassName As _Offset, WindowName$)
|
||||||
|
End Declare
|
||||||
|
|
||||||
|
Declare Dynamic Library "User32"
|
||||||
|
Function GetWindowLongA& (ByVal hWnd As _Offset, Byval nIndex As Long)
|
||||||
|
Function SetWindowLongA& (ByVal hWnd As _Offset, Byval nIndex As Long, Byval dwNewLong As Long)
|
||||||
|
Function SetWindowPos& (ByVal hWnd As _Offset, Byval hWndInsertAfter As Long, Byval x As Long, Byval y As Long, Byval cx As Long, Byval cy As Long, Byval wFlags As Long)
|
||||||
|
End Declare
|
||||||
|
|
||||||
|
Const GWL_STYLE = -16
|
||||||
|
Const WS_BORDER = &H800000
|
||||||
|
Const WS_CAPTION = &H00C00000
|
||||||
|
Const WS_THICKFRAME = &H00040000
|
||||||
|
Const WS_MINIMIZEBOX = &H00020000
|
||||||
|
Const WS_MAXIMIZEBOX = &H00010000
|
||||||
|
Const WS_SYSMENU = &H00080000
|
||||||
|
|
||||||
|
Do: Loop Until _ScreenExists
|
||||||
|
|
||||||
|
Dim hwnd As _Offset
|
||||||
|
Dim As Long winstyle, Style, a
|
||||||
|
|
||||||
|
hwnd = _WindowHandle
|
||||||
|
winstyle = GetWindowLongA(hwnd, GWL_STYLE)
|
||||||
|
Style = (WS_CAPTION Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX Or WS_SYSMENU)
|
||||||
|
a = SetWindowLongA&(hwnd, GWL_STYLE, winstyle And Not Style)
|
||||||
25
solarize.bm
Normal file
25
solarize.bm
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
Sub Solarize (__image As Long, __threshold)
|
||||||
|
Dim __Dest As Long
|
||||||
|
Dim __Source 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
|
||||||
|
__Dest = _Dest
|
||||||
|
__Source = _Source
|
||||||
|
_Dest __image
|
||||||
|
_Source __image
|
||||||
|
For __y = 0 To _Height(__image) - 1
|
||||||
|
For __x = 0 To _Width(__image) - 1
|
||||||
|
__orgc = Point(__x, __y)
|
||||||
|
If _Red(__orgc) > __threshold Then __r = 255 - _Red(__orgc) Else __r = _Red(__orgc)
|
||||||
|
If _Green(__orgc) > __threshold Then __g = 255 - _Green(__orgc) Else __g = _Green(__orgc)
|
||||||
|
If _Blue(__orgc) > __threshold Then __b = 255 - _Blue(__orgc) Else __b = _Blue(__orgc)
|
||||||
|
PSet (__x, __y), _RGB32(__r, __g, __b)
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
_Dest __Dest
|
||||||
|
_Source __Source
|
||||||
|
End Sub
|
||||||
3
truncate.bm
Normal file
3
truncate.bm
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
FUNCTION Truncate (value)
|
||||||
|
Truncate = (value > 0) * (((value < 256) * value) + ((value > 255) * 255))
|
||||||
|
END FUNCTION
|
||||||
Loading…
Add table
Add a link
Reference in a new issue