PureBasic Forum
https://www.purebasic.fr/english/

[Implemented] Canvas background color
https://www.purebasic.fr/english/viewtopic.php?f=3&t=68935
Page 2 of 3

Author:  freak [ Mon Oct 30, 2017 10:56 am ]
Post subject:  Re: Canvas background color

Adding the option to set a background color only solves half the problem. You would still have the same effect if you actually need to draw something except the background color into the resized area.

Author:  walbus [ Mon Oct 30, 2017 11:32 am ]
Post subject:  Re: Canvas background color

And what is the problem for solving the halfe problem ?

A unchangeable presetted white background is simple senseless....

ut amplio

Author:  IdeasVacuum [ Mon Oct 30, 2017 12:25 pm ]
Post subject:  Re: Canvas background color

I understand that point Freak, but when the canvas is simply resized without any drawing on it other than a box to set it's colour, the flicker issue is there - if the colour could be preset (like a container gadget for example), that would make a difference.

Ignoring the flicker issue, it would still be nice to be able to preset the back colour rather than having to draw it.

Author:  walbus [ Mon Oct 30, 2017 1:12 pm ]
Post subject:  Re: Canvas background color

It doesn't seem to matter much what the users want

There is a simple question :
What does a chief do without Indians ?

Author:  Fred [ Mon Oct 30, 2017 1:16 pm ]
Post subject:  Re: Canvas background color

walbus wrote:
It doesn't seem to matter much what the users want


It's not because we don't implement a feature we don't care about what users wants. A quick search shows 900 features and requests granted:

search.php?keywords=Implemented&terms=all&author=&fid%5B%5D=3&sc=1&sf=titleonly&sk=t&sd=d&sr=topics&st=0&ch=300&t=0&submit=Search

Author:  IdeasVacuum [ Mon Oct 30, 2017 1:37 pm ]
Post subject:  Re: Canvas background color

... I second that Fred. It's almost impossible to get feature requests implemented in most other programming languages, many of which are well behind PB anyway.

Author:  freak [ Mon Oct 30, 2017 1:39 pm ]
Post subject:  Re: Canvas background color

walbus wrote:
It doesn't seem to matter much what the users want

There is a simple question :
What does a chief do without Indians ?


If you don't have anything constructive to add why do you even post here? As others have shown here, it is possible to have a civilized discussion about the actual issue even if the opinions might differ. Maybe you should give that a try.

@everyone else:
I am looking into the issue. We'll see what can be done about it.

Author:  walbus [ Mon Oct 30, 2017 1:46 pm ]
Post subject:  Re: Canvas background color

@Freak
Because you didn't answer my questions !

Being insulted is also not a solution...

We are also normal people and you can answer us if we ask, with whole sentences

We, the users, are your customers, not your servants and petitioners

Author:  freak [ Mon Oct 30, 2017 2:12 pm ]
Post subject:  Re: Canvas background color

Can you point me to the insult please? Or the half sentence maybe? I tried to have a normal discussion, but obviously that is not possible.

In case you were wondering: This is the exact reason why I rarely respond in the Feature request forum anymore.

Author:  walbus [ Mon Oct 30, 2017 2:29 pm ]
Post subject:  Re: Canvas background color

Freak, PB is freds and your software, i think
Fixing bugs is so primarily your problem, not mine
Nobody wants software with many bugs

It's not just about this thread
I haven't had any joy in programming for a long time
Why am I doing it anyway ?
Think about it !

It's not about arguing either
I can look back many years, many things, i see, are not new to me

You mean I shouldn't be wondering if you don't write in the forum anymore
Now I have to laugh, is it my forum or yours ?
I also don't care about it at all !

Author:  Kuron [ Mon Oct 30, 2017 2:53 pm ]
Post subject:  Re: Canvas background color

freak wrote:
@everyone else:
I am looking into the issue. We'll see what can be done about it.


Thank you.

Author:  freak [ Wed Nov 01, 2017 5:54 pm ]
Post subject:  Re: Canvas background color

I think I have a good solution now.
  • I changed the resize code so that if you bind a callback to the #PB_EventType_Resize event for the CanvasGadget, you get a chance to update the content before the resized content is drawn to the screen. This way there is no flicker, even if you draw stuff into the resized area.
  • I also added SetGadgetColor() support as well, so can define the color for the resized area


So the example from above will have to look like this for a flicker-free resize:
Code:
Procedure ResizeOne()
 
  If StartDrawing (CanvasOutput (1))
    Box(0, 0, GadgetWidth (1), GadgetHeight (1), #Red)
    StopDrawing()
  EndIf
 
EndProcedure

Procedure ResizeTwo()
 
  If StartDrawing (CanvasOutput (2))
    Box(0, 0, GadgetWidth (2), GadgetHeight (2), #Green)
    StopDrawing()
  EndIf
 
EndProcedure


OpenWindow (0, 0, 0, 1280, 1024, "SplitterGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

CanvasGadget   (1, 0, 0,   0,   0)
CanvasGadget   (2, 0, 0,   0,   0)
SplitterGadget (0, 1, 1, 1278, 1022, 1, 2)

ResizeOne()
ResizeTwo()
BindGadgetEvent(1, @ResizeOne(), #PB_EventType_Resize)
BindGadgetEvent(2, @ResizeTwo(), #PB_EventType_Resize)

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow


All this will be in PB 5.70.

Author:  davido [ Wed Nov 01, 2017 6:37 pm ]
Post subject:  Re: [Implemented] Canvas background color

@freak,

Thank you for taking so much trouble to sort this out.
It is very much appreciated. :D

Author:  walbus [ Wed Nov 01, 2017 6:43 pm ]
Post subject:  Re: [Implemented] Canvas background color

davido wrote:
@freak,

Thank you for taking so much trouble to sort this out.
It is very much appreciated. :D


Aut viam inveniam aut faciam (Hannibal)

Author:  HanPBF [ Wed Nov 01, 2017 7:46 pm ]
Post subject:  Re: [Implemented] Canvas background color

Can't wait to buy the upgrade version!
Thanks a lot for this going to be updated!

Page 2 of 3 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/