Page 1 of 1

[Solved] CanvasGadget unsharp with 2DDrawing

Posted: Mon Sep 05, 2022 5:41 pm
by es_91
[Original title: Is CanvasGadget doing very unsharp par defaut ?]

Hey community!

Below is an image taken as screen shot using latest Opera with Windows 10 125% dpi desktop zoom. As you propably notice the canvas draw (code is down below) is making horrible aliasing effects, not so the "proper" gadgets.

Can you confirm that? What should the canvas be of use at all when it is unsharp per definition?

Image

Code: Select all

loadFont (0, "Courier", 12)

openWindow (0, 
            0, 0, 0, 0, "", 
            #pb_window_background)

openWindow (1,
            0, 0, 0, 0, "", 
            #pb_window_borderless)

procedure sizeOne ()
	
	resizeWindow (1, 
	              0, 0, windowWidth (0), windowHeight (0))
	
endProcedure

bindEvent (#pb_event_sizeWindow, 
           @sizeOne ())

textGadget (0, 15, 15, 200, 20, "Will this line pixelate?")

setGadgetFont (0, fontId (0))

canvasGadget (1, 15, 45, 200, 80)

if startDrawing (canvasOutput (1))
	
	drawingFont (fontId (0))
	
	box (0, 0, gadgetWidth (1), gadgetheight (1), #white)
	
	drawText (15, 15, "Will this text pixelate?", #black, #white)
	
	stopDrawing ()
	
endIf

sizeOne ()

Re: Is CanvasGadget doing very unsharp par defaut ?

Posted: Tue Sep 06, 2022 3:45 am
by Paul
Have you considered VectorDrawing on the Canvas?

Code: Select all

LoadFont (0, "Courier", 12)

OpenWindow (0,  0, 0, 0, 0, "", #PB_Window_Background)
OpenWindow (1, 0, 0, 0, 0, "", #PB_Window_BorderLess)

Procedure sizeOne ()	
	ResizeWindow (1, 0, 0, WindowWidth (0), WindowHeight (0))	
EndProcedure

BindEvent (#PB_Event_SizeWindow, @sizeOne ())

TextGadget (0, 15, 15, 200, 20, "Will this line pixelate?")
SetGadgetFont (0, FontID (0))
CanvasGadget (1, 15, 45, 200, 80)

If StartDrawing (CanvasOutput (1))	
	DrawingFont (FontID (0))	
	Box (0, 0, GadgetWidth (1), GadgetHeight (1), #White)	
	DrawText (15, 15, "Will this text pixelate?", #Black, #White)	
	StopDrawing ()	
EndIf

If StartVectorDrawing(CanvasVectorOutput(1))
  VectorFont(FontID(0))
  MovePathCursor(15,35)
  DrawVectorText("Will this text pixelate?")
  StopDrawing()
EndIf

sizeOne ()

Re: Is CanvasGadget doing very unsharp par defaut ?

Posted: Thu Sep 08, 2022 3:01 pm
by es_91
:shock: Excellent! Thank you so much. I always ignore novelty functionality - since i hardly read the docs..

This looks really good. Puts power to the canvas (! ^^)

Image
Paul wrote:

Code: Select all

If StartVectorDrawing(CanvasVectorOutput(1))
  VectorFont(FontID(0))
  MovePathCursor(15,35)
  DrawVectorText("Will this text pixelate?")
  StopDrawing()
EndIf