Can #PB_2DDrawing_Outlined make all black lines?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Random Terrain
Posts: 63
Joined: Fri Jul 09, 2021 9:48 pm
Location: USA
Contact:

Can #PB_2DDrawing_Outlined make all black lines?

Post by Random Terrain »

If I use DrawingMode(#PB_2DDrawing_Outlined) and draw a black outline box on a canvas, the left line is black, the top line is black, but the right line is gray and the bottom line is gray.

Is there a way to have nothing but black lines on all four sides of a box when using PB_2DDrawing_Outlined?


Thanks.
User avatar
Peter
Posts: 1093
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Can #PB_2DDrawing_Outlined make all black lines?

Post by Peter »

Please provide us with a small working code that demonstrates the behaviour.
User avatar
Random Terrain
Posts: 63
Joined: Fri Jul 09, 2021 9:48 pm
Location: USA
Contact:

Re: Can #PB_2DDrawing_Outlined make all black lines?

Post by Random Terrain »

Peter wrote: Tue Aug 17, 2021 6:57 am Please provide us with a small working code that demonstrates the behaviour.
I cropped down the code the best I could, but when it's cropped, the only thing that is wrong is that the bottom line is thicker and right line is thicker. And for some strange reason the box only appears if you move the mouse pointer over the canvas area in the cropped version.

Code: Select all

Enumeration windows
#Window_Main
EndEnumeration

Enumeration gadgets
#Canvas_Playfield
EndEnumeration

Procedure GadgetEvents()
StartDrawing(CanvasOutput(#Canvas_Playfield))
DrawingMode(#PB_2DDrawing_Outlined)
Box(29, 31, 482, 354, #Black)
StopDrawing()
EndProcedure

Procedure initUI()
If OpenWindow(#Window_Main, 0, 0, 0, 0, "", #PB_Window_Background)
SetWindowColor(#Window_Main, #White)

CanvasGadget(#Canvas_Playfield, 40, 40, 542, 417, #PB_Canvas_Border | #PB_Canvas_Keyboard)

EndIf
EndProcedure


initUI()
BindEvent(#PB_Event_Gadget, @GadgetEvents())

StartDrawing(CanvasOutput(#Canvas_Playfield))
Box(0, 0, 542, 417, $E9EAEA)
StopDrawing()
If I use DrawingMode(#PB_2DDrawing_Outlined) in this program, I get those gray lines:

https://www.randomterrain.com/bb-playfi ... basic_code


Thanks.
munfraid
Posts: 108
Joined: Sat Mar 24, 2018 1:33 pm

Re: Can #PB_2DDrawing_Outlined make all black lines?

Post by munfraid »

I can't explain this effect, but it works when you don't put the drawing partly in the gadget event procedure:

Code: Select all

EnableExplicit

Enumeration windows
  #Window_Main
EndEnumeration

Enumeration gadgets
  #Canvas_Playfield
EndEnumeration

Procedure initUI()
  If OpenWindow(#Window_Main, 0, 0, 0, 0, "", #PB_Window_Background)
    SetWindowColor(#Window_Main, #White)
    CanvasGadget(#Canvas_Playfield, 40, 40, 542, 417, #PB_Canvas_Border | #PB_Canvas_Keyboard)
    StartDrawing(CanvasOutput(#Canvas_Playfield))
    Box(0, 0, 542, 417, $E9EAEA)
    DrawingMode(#PB_2DDrawing_Outlined)
    Box(29, 31, 482, 354, #Black)
    StopDrawing()
  EndIf
EndProcedure

initUI()
Or like this, if #PB_2DDrawing_Outlined makes trouble:

Code: Select all

EnableExplicit

Enumeration windows
  #Window_Main
EndEnumeration

Enumeration gadgets
  #Canvas_Playfield
EndEnumeration

Procedure initUI()
  If OpenWindow(#Window_Main, 0, 0, 0, 0, "", #PB_Window_Background)
    SetWindowColor(#Window_Main, #White)
    CanvasGadget(#Canvas_Playfield, 40, 40, 542, 417, #PB_Canvas_Border | #PB_Canvas_Keyboard)
    StartDrawing(CanvasOutput(#Canvas_Playfield))
    Box(0, 0, 542, 417, $E9EAEA)
    Box(29, 31, 482, 354, #Black)
    Box(30, 32, 480, 352, $E9EAEA)
    StopDrawing()
  EndIf
EndProcedure

initUI()
Your editor has been growing wild and needs some serious workover. Especially the entire drawing needs to be redone and put inside a dedicated procedure. Still very busy, but I'll have a look.
User avatar
Random Terrain
Posts: 63
Joined: Fri Jul 09, 2021 9:48 pm
Location: USA
Contact:

Re: Can #PB_2DDrawing_Outlined make all black lines?

Post by Random Terrain »

munfraid wrote: Tue Aug 17, 2021 6:58 pm I can't explain this effect, but it works when you don't put the drawing partly in the gadget event procedure:
Thanks. When I run your DrawingMode(#PB_2DDrawing_Outlined) example and take a screenshot and zoom in, those thick gray lines are there on the right and bottom instead of thin black lines.

Image

It's as if it's trying to do some kind of fancy effect when you just want thin black lines. I gave up on it and used normal filled in boxes, but it would be nice to be able to use PB_2DDrawing_Outlined in a future online tool if it will ever work properly. In CSS, you can define the thickness of a line and have total control over the look of it. I guess JavaScript doesn't allow that?

munfraid wrote: Tue Aug 17, 2021 6:58 pm Your editor has been growing wild and needs some serious workover. Especially the entire drawing needs to be redone and put inside a dedicated procedure. Still very busy, but I'll have a look.
Yep, since I'm still trying to learn, I'm not exactly sure how to make it less wild yet. I was lucky to get the new code working properly. There are special weird modes that can be done on the Atari 2600 using batari Basic and it felt like jumping through flaming hoops to get them to look the way they do using Stella (Atari 2600 emulator). The last mode I added has a mirrored playfield. If you select one of the multisprite kernel modes and draw on the playfield, you'll be drawing in two places at the same time. Besides trying to figure out math that almost broke my brain, the multisprite kernel can only have one foreground color and one background color, so I had to make sure that was working correctly too.

Thanks.
munfraid
Posts: 108
Joined: Sat Mar 24, 2018 1:33 pm

Re: Can #PB_2DDrawing_Outlined make all black lines?

Post by munfraid »

Thanks for the screenshot, I can confirm this behaviour here. Looks like a bug to me. Wrote a bug report here.
User avatar
Random Terrain
Posts: 63
Joined: Fri Jul 09, 2021 9:48 pm
Location: USA
Contact:

Re: Can #PB_2DDrawing_Outlined make all black lines?

Post by Random Terrain »

munfraid wrote: Wed Aug 18, 2021 10:47 am Thanks for the screenshot, I can confirm this behaviour here. Looks like a bug to me. Wrote a bug report here.
Thanks.
Post Reply