[Solved] CanvasGadget unsharp with 2DDrawing

Everything else that doesn't fall into one of the other categories.
es_91
Posts: 36
Joined: Sat Aug 29, 2015 10:25 pm

[Solved] CanvasGadget unsharp with 2DDrawing

Post 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 ()
Last edited by es_91 on Thu Sep 08, 2022 11:19 pm, edited 1 time in total.
:mrgreen:
User avatar
Paul
Posts: 195
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Re: Is CanvasGadget doing very unsharp par defaut ?

Post 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 ()
es_91
Posts: 36
Joined: Sat Aug 29, 2015 10:25 pm

Re: Is CanvasGadget doing very unsharp par defaut ?

Post 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
:mrgreen:
Post Reply