mirror of
https://github.com/irmen/prog8.git
synced 2025-02-16 22:30:46 +00:00
fix gfx2 color of horiz/vert lines
This commit is contained in:
parent
3378586098
commit
4b366358c4
@ -6,6 +6,7 @@
|
||||
; Note: for compatible graphics code that words on C64 too, use the "graphics" module instead.
|
||||
; Note: there is no color palette manipulation here, you have to do that yourself or use the "palette" module.
|
||||
|
||||
; TODO can we make a FB vector table and emulation routines for the Cx16s' GRAPH_init() call? to replace the builtin 320x200 fb driver?
|
||||
|
||||
gfx2 {
|
||||
|
||||
@ -137,7 +138,7 @@ gfx2 {
|
||||
}
|
||||
0, 128 -> {
|
||||
; 1 bpp mode
|
||||
; TODO optimize this to plot 8 pixels at once while possible, note: do mind the stipple setting
|
||||
; TODO optimize this to plot 8 pixels at once while possible, note: do mind the stipple setting and color 0 black
|
||||
repeat length {
|
||||
gfx2.plot(x, y, color)
|
||||
x++
|
||||
@ -147,7 +148,7 @@ gfx2 {
|
||||
}
|
||||
|
||||
sub vertical_line(uword x, uword y, uword height, ubyte color) {
|
||||
; TODO optimize this to use vera special increment mode, note: do mind the stipple setting
|
||||
; TODO optimize this to use vera special increment mode, note: do mind the stipple setting and color 0 black
|
||||
repeat height {
|
||||
plot(x, y, color)
|
||||
y++
|
||||
@ -167,13 +168,13 @@ gfx2 {
|
||||
word @zp dy = y2-y1 as word
|
||||
|
||||
if dx==0 {
|
||||
vertical_line(x1, y1, abs(dy)+1 as uword, 255)
|
||||
vertical_line(x1, y1, abs(dy)+1 as uword, color)
|
||||
return
|
||||
}
|
||||
if dy==0 {
|
||||
if x1>x2
|
||||
x1=x2
|
||||
horizontal_line(x1, y1, abs(dx)+1 as uword, 255)
|
||||
horizontal_line(x1, y1, abs(dx)+1 as uword, color)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -22,18 +22,18 @@ main {
|
||||
|
||||
sub draw() {
|
||||
|
||||
gfx2.rect(10,10, 1, 1, 255)
|
||||
gfx2.rect(20,10, 2, 1, 255)
|
||||
gfx2.rect(30,10, 3, 1, 255)
|
||||
gfx2.rect(40,10, 1, 2, 255)
|
||||
gfx2.rect(50,10, 1, 3, 255)
|
||||
gfx2.rect(60,10, 2, 2, 255)
|
||||
gfx2.rect(70,10, 3, 3, 255)
|
||||
gfx2.rect(80,10, 4, 4, 255)
|
||||
gfx2.rect(90,10, 5, 5, 255)
|
||||
gfx2.rect(100,10, 8, 8, 255)
|
||||
gfx2.rect(110,10, 20, 5, 255)
|
||||
gfx2.rect(80, 80, 200, 140, 255)
|
||||
gfx2.rect(10,10, 1, 1, 4)
|
||||
gfx2.rect(20,10, 2, 1, 4)
|
||||
gfx2.rect(30,10, 3, 1, 4)
|
||||
gfx2.rect(40,10, 1, 2, 4)
|
||||
gfx2.rect(50,10, 1, 3, 4)
|
||||
gfx2.rect(60,10, 2, 2, 4)
|
||||
gfx2.rect(70,10, 3, 3, 4)
|
||||
gfx2.rect(80,10, 4, 4, 4)
|
||||
gfx2.rect(90,10, 5, 5, 4)
|
||||
gfx2.rect(100,10, 8, 8, 4)
|
||||
gfx2.rect(110,10, 20, 5, 4)
|
||||
gfx2.rect(80, 80, 200, 140, 4)
|
||||
|
||||
gfx2.fillrect(10,40, 1, 1, 5)
|
||||
gfx2.fillrect(20,40, 2, 1, 5)
|
||||
@ -49,12 +49,12 @@ main {
|
||||
gfx2.fillrect(82, 82, 200-4, 140-4, 5)
|
||||
|
||||
ubyte i
|
||||
for i in 0 to 255 step 4 {
|
||||
for i in 0 to 254 step 4 {
|
||||
uword x1 = ((gfx2.width-256)/2 as uword) + sin8u(i)
|
||||
uword y1 = (gfx2.height-128)/2 + cos8u(i)/2
|
||||
uword x2 = ((gfx2.width-64)/2 as uword) + sin8u(i)/4
|
||||
uword y2 = (gfx2.height-64)/2 + cos8u(i)/4
|
||||
gfx2.line(x1, y1, x2, y2, i)
|
||||
gfx2.line(x1, y1, x2, y2, i+1)
|
||||
}
|
||||
|
||||
cx16.wait(60)
|
||||
@ -66,7 +66,7 @@ main {
|
||||
gfx2.circle(gfx2.width/2, (gfx2.height/2 as ubyte), radius, radius)
|
||||
}
|
||||
|
||||
gfx2.disc(gfx2.width/2, gfx2.height/2, 108, 255)
|
||||
gfx2.disc(gfx2.width/2, gfx2.height/2, 80, 2)
|
||||
|
||||
ubyte tp
|
||||
for tp in 0 to 15 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user