Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -0,0 +1,20 @@
fakewidth =!= dummy
g = new graphics
drawBars[g, 0, 1, 0, 1/4, 8]
drawBars[g, 1, 0, 1/4, 1/2, 16]
drawBars[g, 0, 1, 1/2, 3/4, 32]
drawBars[g, 1, 0, 3/4, 1, 64]
g.show[640,480,1] // No portable fullscreen mode; user must maximize window.
drawBars[g is graphics, leftColor, rightColor, top, bottom, steps] :=
{
colorStep = (rightColor - leftColor) / steps
color = leftColor
for i=0 to steps-1
{
g.color[color, color, color]
g.fillRectSides[i/dummy/steps, top, (i+1)/dummy/steps, bottom]
color = color + colorStep
}
}

View file

@ -0,0 +1,69 @@
fn drawBarRow _bmp _row _width _number _inverse=
(
local dir = if _inverse then 1 else -1
if not _inverse then
(
setpixels _bmp [0,_row] (for i in 1 to (_width/_number) collect (black))
for i = (_width/_number) to _width by (_width/_number) do
(
local loopPosition = i/(_width-(_width/_number)) as float
local colorsArr = for c in 1 to (_width/_number) collect (white*loopPosition)
setpixels _bmp [i,_row] colorsArr
)
return _bmp
)
else
(
setpixels _bmp [0,_row] (for i in 1 to (_width/_number) collect (white))
for i = _width to (_width/_number) by ((_width/_number)*-1) do
(
local loopPosition = 1.0-(i/(_width-(_width/_number))) as float
local colorsArr = for c in 1 to (_width/_number) collect (white*loopPosition)
setpixels _bmp [i,_row] colorsArr
)
return _bmp
)
)
fn bitmap_verticalBars =
(
local width = (sysinfo.desktopsize).x
local height = (sysinfo.desktopsize).y
local theBitmap = bitmap width height color:white
local row = 0
while row <= (height-1) do
(
local barNumber = 0
case of
(
(row < (height/4)): (barNumber = 1)
(row >= (height/4) and row < (height/2)): (barNumber = 2)
(row >= (height/2) and row < (height-(height/4))): (barNumber = 3)
(row >= (height-(height/4))): (barNumber = 4)
default: return theBitmap
)
case barNumber of
(
1: (
theBitmap = drawBarRow theBitmap row width 8 false
)
2: (
theBitmap = drawBarRow theBitmap row width 16 true
)
3: (
theBitmap = drawBarRow theBitmap row width 32 false
)
4: (
theBitmap = drawBarRow theBitmap row width 64 true
)
)
row += 1
--
)
return theBitmap
)
b = bitmap_verticalBars()
display b

View file

@ -0,0 +1,28 @@
Declare Sub PaintCanvas
Create Form as Qform
Caption = "Rosetta Greyscale"
Center
create Canv as QCanvas
align = 5
onPaint = PaintCanvas
end create
end create
Sub PaintCanvas
NumRows = 4 'Change for number of rows
for curbar = 0 to NumRows-1
Bars = 2^(curbar+3)
for x = 0 to (Bars -1)
x1=Canv.Width/Bars*x
y1=Canv.Height/NumRows*CurBar
x2=Canv.Width/Bars*(x+1)
y2=Canv.Height/NumRows*(CurBar+1)
c=(255/(Bars-1))*x
c=iif(curbar mod 2, 255-c, c)
Canv.FillRect(x1, y1, x2, y2, rgb(c, c, c))
next x
next curbar
end sub
Form.showmodal