Page 1 of 1

Canvas colour

Posted: Fri Jan 06, 2017 3:52 pm
by collectordave
Hi

I have some code that creates a canvas gadget and then sets the colour of the gadget to the background on which it is drawn.

Code: Select all

    ;Get background colour where gadget will be drawn
    StartDrawing(WindowOutput(ThisWindow))
      MyGadgetArray.MyGadget(CurrentGadget)\BackColour = Point(x, y)
    StopDrawing()
    
    ;Set Colour Of Canvas To Background
    StartDrawing(CanvasOutput(ThisGadget))
      DrawingMode(#PB_2DDrawing_AllChannels)
      Box(0, 0, OutputWidth(), OutputHeight(), MyGadgetArray.MyGadget(CurrentGadget)\BackColour)
    StopDrawing()
This works on windows but not on the MAC

Anyone have any ideas?

Regards

cd

Re: Canvas colour

Posted: Fri Jan 06, 2017 4:02 pm
by RASHAD
Hi collectordave
I am a Windows user only
But I suggest

Code: Select all

;Get background colour where gadget will be drawn
    
    HideGadget(ThisGadget,1)
    StartDrawing(WindowOutput(ThisWindow))
      MyGadgetArray.MyGadget(CurrentGadget)\BackColour = Point(x, y)
      Delay(10)
    StopDrawing()
    HideGadget(ThisGadget,0)
   
    ;Set Colour Of Canvas To Background
    StartDrawing(CanvasOutput(ThisGadget))
      DrawingMode(#PB_2DDrawing_AllChannels)
      Box(0, 0, OutputWidth(), OutputHeight(), MyGadgetArray.MyGadget(CurrentGadget)\BackColour)
    StopDrawing()

Re: Canvas colour

Posted: Fri Jan 06, 2017 4:13 pm
by Keya

Re: Canvas colour

Posted: Fri Jan 06, 2017 5:18 pm
by collectordave
Thanks exactly what i was after.

Also found that using DrawingMode(#PB_2DDrawing_AllChannels) before drawing the box stops the back colour from being drawn as well.

Removed that line wherever I was using it and it all works.

Thanks again

cd