Page 1 sur 1
WindowOutput() qu'est-ce exactement?
Publié : sam. 08/mai/2004 9:28
par cederavic
tout est dan le titre... aparement c'est pas le dc car StartDrawing(GetWindowDC_(hwnd)) ne prend pa, je ne voit pa du tout ce que c'est... si quelqu'un sait, merci beaucoup

Publié : sam. 08/mai/2004 9:47
par Patrick88
c'est la fenetre qui contient les gadgets
regarde l'exemple 2DDrawing.pb
If OpenWindow(0, 100, 200, 300, 200, #PB_Window_SystemMenu, "2D Drawing Test")
.....
;
; Some 2D graphics functions...
;
SomeGraphics:
StartDrawing(WindowOutput())
Circle(100,100,50,RGB(0,0,255)) ; a nice blue circle...
.....
patrick
Publié : sam. 08/mai/2004 10:16
par cederavic
oui je sais lol, mais qu'est-ce qu'elle renvoi?
Publié : sam. 08/mai/2004 10:24
par Chris
A priori, c'est pas le DC, parce qu'il est renvoyé par la fonction StartDrawing()
J'ai trouvé ça dans l'aide de StartDrawing(): (pour la 3.90)
The 'Result' value is the DC (Device Context) handle which can be requiered by some WindowsAPI functions.
Chris

Publié : sam. 08/mai/2004 10:45
par cederavic
oui j'ai vu aussi, mais alors c'est quoi ce windowoutput()???

Publié : sam. 08/mai/2004 15:30
par filperj
Juste une idée comme ça, mais c'est peut-être le pointeur vers une structure "DrawingInfoStruct" (voir dans \purebasic\library SDK\PureBasic library descriptor.txt").
Si c'est ça, ça doit être un truc interne à PB, taillé sur mesure pour StartDrawing().
Publié : dim. 09/mai/2004 15:33
par Guimauve
WindowOutput() : Les dessins seront rendus directement sur la fenetre.
À mon avis ça indique à la fonction StartDrawing() où elle doit travailler pour faire son dessin. À savoir le fond de la fenètre encours identifié par le OutputID renvoyé par la commande WindowOutput().
Code : Tout sélectionner
;/--------------------------------------------------------------------------------
;/ Dégradé de couleur dans une fenêtre
;/--------------------------------------------------------------------------------
Procedure Gradient( Color1.l, Color2.l, NbColor.l )
ww = WindowWidth()
wh = WindowHeight()
rt = Red (Color1) : rd = Red (Color2) - rt
gt = Green(Color1) : gd = Green(Color2) - gt
bt = Blue (Color1) : bd = Blue (Color2) - bt
StartDrawing( WindowOutput() )
While i < NbColor
r = MulDiv_( i, rd, NbColor ) + rt
g = MulDiv_( i, gd, NbColor ) + gt
b = MulDiv_( i, bd, NbColor ) + bt
y = MulDiv_( i, wh, Nbcolor )
h = MulDiv_( i+2, wh, NbColor )
Box( 0, y, ww, h, RGB(r,g,b) ) : i+1
Wend
StopDrawing()
EndProcedure
;---------------------------------------------------------------------------------
flags = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered
If OpenWindow( 0, 0, 0, 320, 320, flags, "Dégradé" )
If CreateGadgetList(WindowID())
ButtonGadget( 0, 0, 0, 0, 0, "" )
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow : quit = 1
Case #PB_Event_Gadget : quit = 1
Case #WM_SIZE
;----------------------
ResizeGadget( 0, (WindowWidth()-80)/2, WindowHeight()-40, 80, 35 )
SetGadgetText( 0, Str(WindowWidth())+"x"+Str(WindowHeight()) )
Gradient( $000000, $FF4F4F, 255)
;----------------------
EndSelect
Until quit = 1
EndIf
EndIf
;---------------------------------------------------------------------------------
End
A+
Guimauve
Publié : dim. 09/mai/2004 17:15
par cederavic
oui guimauve, je le sais

Merci fliperj, c'est exactement ça

merci beaucoup