[Implemented] Canvas background color

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Canvas background color

Post by freak »

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.
quidquid Latine dictum sit altum videtur
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Canvas background color

Post by walbus »

And what is the problem for solving the halfe problem ?

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

ut amplio
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Canvas background color

Post by IdeasVacuum »

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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Canvas background color

Post by walbus »

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

There is a simple question :
What does a chief do without Indians ?
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Canvas background color

Post by Fred »

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:

http://www.purebasic.fr/english/search. ... mit=Search
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Canvas background color

Post by IdeasVacuum »

... 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Canvas background color

Post by freak »

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.
quidquid Latine dictum sit altum videtur
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Canvas background color

Post by walbus »

@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
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Canvas background color

Post by freak »

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.
quidquid Latine dictum sit altum videtur
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Canvas background color

Post by walbus »

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 !
Last edited by walbus on Tue Oct 31, 2017 8:39 am, edited 4 times in total.
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: Canvas background color

Post by Kuron »

freak wrote:@everyone else:
I am looking into the issue. We'll see what can be done about it.
Thank you.
Best wishes to the PB community. Thank you for the memories. ♥️
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Canvas background color

Post by freak »

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: Select all

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.
quidquid Latine dictum sit altum videtur
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: [Implemented] Canvas background color

Post by davido »

@freak,

Thank you for taking so much trouble to sort this out.
It is very much appreciated. :D
DE AA EB
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: [Implemented] Canvas background color

Post by walbus »

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)
HanPBF
Enthusiast
Enthusiast
Posts: 563
Joined: Fri Feb 19, 2010 3:42 am

Re: [Implemented] Canvas background color

Post by HanPBF »

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