| |
|
|
 Georg Teles | Anbei mein Quelltext von der Clockbar an der ich gerade arbeite, der die Helligkeit eines Bildes ändern lässt
'- Georg Teles 30.05.2018
Randomize
Declare sPic&, hPic&
Declare x&, y&'VAL: Breite, Höhe
Declare h&, v&'POS: horizontal, vertikal
CLS RGB(0,255,0)
x& = 32
y& = 32
' generiere Bild
MCLS x&, y&
CLear h&, v&
StartPaint -1
WhileLoop 0,(x&*y&)-1
SetPixel h&, v&, RGB(rnd(255),rnd(255),rnd(255))
Inc h&
If h& = x&
Inc v&
Clear h&
EndIf
EndWhile
EndPaint
sPic& = Create("hPic",0,"&MEMBMP")
' normales Bild / Quellbild
DrawPic sPic&,0,0;0
' helleres Bild, 200%
hPic& = brightness(sPic&, x&, y&, 200)
DrawPic hPic&,0,48;0
DeleteObject hPic&
' max. helles Bild, 25500% = weiß
hPic& = brightness(sPic&, x&, y&, 25500)
DrawPic hPic&,48,48;0
DeleteObject hPic&
' dunkleres Bild, 50%
hPic& = brightness(sPic&, x&, y&, 50)
DrawPic hPic&,0,96;0
DeleteObject hPic&
' max. dunklers Bild, 0% = schwarz
hPic& = brightness(sPic&, x&, y&, 0)
DrawPic hPic&,48,96;0
DeleteObject hPic&
WaitInput
DeleteObject sPic&
Proc brightness
' (Handle) Quellbild, (Breite) Quellbild, (Höhe) Quellbild, (Helligkeit) 0-25500
Parameters source&, x&, y&, p&
Declare bPic&, h&, v&, px&, r&, g&, b&
Clear h&, v&
MCls x&, y&
WhileLoop 0,(x&*y&)-1
'-------------------------------# Lese Pixel vom Quellbild
StartPaint source&
px& = GetPixel(h&, v&)
r& = GetRValue(px&)
g& = GetGValue(px&)
b& = GetBValue(px&)
EndPaint
'-------------------------------#
Case r& = 0:r& = 1
Case g& = 0:g& = 1
Case b& = 0:b& = 1
'-------------------------------# zeichne mit angepasster Helligkeit
StartPaint -1
SetPixel h&, v&, RGB(r&*(p&/100),g&*(p&/100),b&*(p&/100))
EndPaint
'-------------------------------# horizontal / vertikal
Inc h&
If h& = x&
Inc v&
Clear h&
EndIf
EndWhile
bPic& = Create("hPic",0,"&MEMBMP")
Return bPic&
EndProc
Servus  |
|
|
| |
|
|
|
 | [offtopic]In diesem Zusammenhang vielleicht auch interessant die sehr schnelle Pixels.inc: [...]  (einfach die Downloads in dem Thema aufklappen, dort ist das Paket auch kostenlos ladbar) [/offtopic] |
|
|
| |
|
|