Page 1 sur 1

DrawRotatedText qualité police laisse à désiré

Publié : sam. 25/mars/2017 0:03
par Shadow
Salut,

Je trouve que DrawRotatedText utilise une mauvaise qualité de police, le rendus est mauvais...
Même avec l'option #PB_Font_HighQuality activé, ça change rien :|
Une idée ?

Code : Tout sélectionner

If OpenWindow(0, 0, 0, 200, 200, "DrawRotatedText Exemple", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  a = LoadFont(#PB_Any, "", 0, #PB_Font_HighQuality)
  If CreateImage(0, 200, 200) And StartDrawing(ImageOutput(0))
    Box(0, 0, 200, 200, RGB(255, 255, 255))
    DrawingFont(FontID(a))
    
    For Angle = 0 To 360 Step 45
      DrawRotatedText(100, 100, "Hello World!", Angle, RGB(0, 0, 0))
    Next Angle
    StopDrawing() 
    ImageGadget(0, 0, 0, 200, 200, ImageID(0))
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf

Re: DrawRotatedText qualité police laisse à désiré

Publié : sam. 25/mars/2017 0:25
par SPH
Plutot bien je trouve ! 8)
Image

Re: DrawRotatedText qualité police laisse à désiré

Publié : sam. 25/mars/2017 9:51
par Mesa
Si, mais tu l'as déjà trouvé, c'est la bibliothèque vectordrawing qui utilise l'antialiasing.

Si tu veux faire une animation comme du texte tournant, rien ne sera mieux que d'utiliser les bibliothèque screen et sprite, elles sont faites pour.

Cependant, sous windows seulement, le mieux que l'on puisse avoir sans directx est d'utiliser la solution ici:
http://www.purebasic.fr/english/viewtop ... rawing.pbi
Télécharge gDrawing_v0.85b2.zip et regarde l'exemple22.

Essai ce code:

Code : Tout sélectionner

;EnableExplicit

;#gDrawing_NO_DLL_IMPORT = 1

XIncludeFile "gDrawing.pbi"

Global metafile, mainWin, canvas, angle.f

Procedure OnTimer()
  Protected windowWidth  = WindowWidth(mainWin)
  Protected windowHeight = WindowHeight(mainWin)
  If gStartDrawing( CanvasOutput(canvas) )
    gClear(RGBA($80,$80,$80,$FF))
    gSetPenColor(RGBA(0,0,0,$FF))
    gSetFont("Arial",20,#PB_Font_Bold)
    height = gTextHeight()
    angle=angle + 3;angle + 0.1
    gDrawRotatedFormattedText(100,100,350,height,"http://www.purebasic.com/news/",angle,RGBA(255,255,0,255))
    
    gStopDrawing()
  EndIf
EndProcedure

Procedure OnSize()
  ResizeGadget(canvas,0,0,WindowWidth(mainWin),WindowHeight(mainWin))
  OnTimer()
EndProcedure


If gInit()
  
  mainWin  = OpenWindow(#PB_Any  , 0, 0, 600,600,"gDrawing feature demo",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
  canvas   = CanvasGadget(#PB_Any, 0, 0, WindowWidth(mainWin),WindowHeight(mainWin))
  WindowBounds(mainWin,100,100,800,600)
  AddWindowTimer(mainWin, 0, 16)
  BindEvent(#PB_Event_Timer     , @OnTimer())
  BindEvent(#PB_Event_SizeWindow, @OnSize())
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
  
  gEnd()
EndIf

M.

Re: DrawRotatedText qualité police laisse à désiré

Publié : sam. 25/mars/2017 16:12
par Shadow
Merci Mesa,

En faite c'est pour mon bouton...
C'est quoi cette lib de fou là ?
A quoi elle sert, c'est un mastodonte !

Et DrawRotatedText n'est pas vectordrawing !
Rien a voir !

Re: DrawRotatedText qualité police laisse à désiré

Publié : sam. 25/mars/2017 17:02
par Marc56
16 Octobre 2015 : Version 5.40 LTS
- Ajouté: Nouvelle bibliothèque Vectorielle 2D
https://www.purebasic.com/french/docume ... story.html


PureBasic - VectorDrawing
https://www.purebasic.com/french/docume ... index.html

Re: DrawRotatedText qualité police laisse à désiré

Publié : sam. 25/mars/2017 17:50
par Shadow
Bon je crois que ont ne se comprends pas...
DrawRotatedText NE FAIS PAS PARTIE DE VECTORDRAWING !!!

Maintenant peut être que tu me dit "Utilise la Lib VectorDrawing au lieux de DrawRotatedText" ???
C'est une bonne idée ça merci.

Re: DrawRotatedText qualité police laisse à désiré

Publié : sam. 25/mars/2017 17:54
par Ar-S
Shadow a écrit :Bon je crois que ont ne se comprends pas...
DrawRotatedText NE FAIS PAS PARTIE DE VECTORDRAWING !!!
Maintenant peut être que tu me dit "Utilise la Lib VectorDrawing au lieux de DrawRotatedText" ???
C'est une bonne idée ça merci.
Pour info Mesa ecrit la doc en fr donc je pense qu'il sait que DrawRotatedText n'est pas du vectordrawing...
Il te dit juste que l'antialiasing (ce qui fait que l'image soit adoucie) est dispo sur vectordrawing et pas via drawtext classique.
Excuse le de te conseiller.

Re: DrawRotatedText qualité police laisse à désiré

Publié : sam. 25/mars/2017 17:59
par Shadow
Ah non autant pour moi, j'avais pas compris en faite, merci Mesa :)
Dur de la feuille moi peut être, pas compris j'y peux rien :)