Greyscale bars/Display: Difference between revisions
Content added Content deleted
m (changed iShade rounding mode due to shading errors at some bar ends; aligned equal signs in assignment groups) |
|||
Line 1,395: | Line 1,395: | ||
Define.i iHeight, iWidth, iDepth |
Define.i iHeight, iWidth, iDepth |
||
iHeight = DesktopHeight(0) |
iHeight = DesktopHeight(0) |
||
iWidth = DesktopWidth(0) |
iWidth = DesktopWidth(0) |
||
iDepth = DesktopDepth(0) |
iDepth = DesktopDepth(0) |
||
If OpenScreen(iWidth, iHeight, iDepth, "Press ENTER to exit") |
If OpenScreen(iWidth, iHeight, iDepth, "Press ENTER to exit") |
||
Line 1,403: | Line 1,403: | ||
If StartDrawing(ScreenOutput()) |
If StartDrawing(ScreenOutput()) |
||
bMode = #True ; Pow = #True; Add = #False |
bMode = #True ; Pow = #True; Add = #False |
||
iLines = 4 ; Number of Lines |
iLines = 4 ; Number of Lines |
||
If iLines < 1 : iLines = 1 : EndIf ; Pow/Add-Min |
If iLines < 1 : iLines = 1 : EndIf ; Pow/Add-Min |
||
Line 1,412: | Line 1,412: | ||
If iLines > 32 : iLines = 32 : EndIf ; Add-Max |
If iLines > 32 : iLines = 32 : EndIf ; Add-Max |
||
EndIf |
EndIf |
||
fLine = iHeight / iLines |
fLine = iHeight / iLines |
||
iLines - 1 |
iLines - 1 |
||
Line 1,421: | Line 1,421: | ||
iSpans = (iRow + 1) * 8 - 1 ; Add: 8, 16, 24, 32, 40, 48, ... |
iSpans = (iRow + 1) * 8 - 1 ; Add: 8, 16, 24, 32, 40, 48, ... |
||
EndIf |
EndIf |
||
fSpan = iWidth / (iSpans + 1) |
fSpan = iWidth / (iSpans + 1) |
||
fColor = 255 / iSpans |
fColor = 255 / iSpans |
||
iTop = Round(iRow * fLine, #PB_Round_Up) |
iTop = Round(iRow * fLine, #PB_Round_Up) |
||
iWide = Round(fSpan, #PB_Round_Up) |
iWide = Round(fSpan, #PB_Round_Up) |
||
iHigh = Round(fLine, #PB_Round_Up) |
iHigh = Round(fLine, #PB_Round_Up) |
||
For iCol = 0 To iSpans |
For iCol = 0 To iSpans |
||
iShade = Round(fColor * iCol, # |
iShade = Round(fColor * iCol, #PB_Round_Nearest) |
||
If iRow % 2 <> 0 : iShade = 255 - iShade : EndIf ; Alternation |
If iRow % 2 <> 0 : iShade = 255 - iShade : EndIf ; Alternation |
||
Box(Round(iCol * fSpan, #PB_Round_Up), iTop, iWide, iHigh, |
Box(Round(iCol * fSpan, #PB_Round_Up), iTop, iWide, iHigh, |