Page 1 of 1

Problem with text and text background when clipping

Posted: Wed Jul 03, 2024 10:02 am
by coco2
I'm having strange behaviour trying to clip inside a canvas on my Mac. Is this something I'm doing or is it a bug?

The problem looks like the text background is in one place, and the text appears 10 pixels up and to the left which corresponds to the clip region values.

Code: Select all

OpenWindow(0, 0, 0, 400, 400, "Test", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 400, 400)
LoadFont(0, "Arial", 18)
StartDrawing(CanvasOutput(0))
DrawingFont(FontID(0))
ClipOutput(10, 10, 400, 400)
DrawText(50, 50, "Test", #Green, #Blue)
StopDrawing()
Repeat
  event = WaitWindowEvent(10)
Until event = #PB_Event_CloseWindow

Re: Problem with text and text background when clipping

Posted: Wed Jul 03, 2024 4:10 pm
by mk-soft
Do everything as it should, ClipOutput limits the output range

Code: Select all

OpenWindow(0, 0, 0, 400, 400, "Test", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 400, 400)
LoadFont(0, "Arial", 24)
StartDrawing(CanvasOutput(0))
DrawingFont(FontID(0))
DrawText(10, 10, "I like PureBasic!", #Blue, #Green)
h = TextHeight("X")
ClipOutput(10, 10 + h/2, 400, 400)
DrawText(10, 10, "I like PureBasic!", #Green, #Blue)
StopDrawing()
Repeat
  event = WaitWindowEvent(10)
Until event = #PB_Event_CloseWindow

Re: Problem with text and text background when clipping

Posted: Wed Jul 03, 2024 10:04 pm
by coco2
This is what I get:
https://imgur.com/DjxdH4y

Re: Problem with text and text background when clipping

Posted: Wed Jul 03, 2024 10:49 pm
by mk-soft
Added PB-Version, macOS Version, HW and Monitor settings for Bugreport

Re: Problem with text and text background when clipping

Posted: Thu Jul 04, 2024 7:58 am
by coco2
PureBasic 6.04 LTS macOS arm64
macOS version: 14.5
Hardware: Mac Mini
CPU: M2
Cores: 8C CPU, 10C GPU
RAM: 8GB
HDD: 256GB
Model no.: A2686
Monitor: 1080P

Re: Problem with text and text background when clipping

Posted: Thu Jul 04, 2024 8:09 am
by coco2
I updated to version 6.11 and there's no problem now