[ok] roundbox(),box(),circle()... et outline

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

[ok] roundbox(),box(),circle()... et outline

Message par blendman »

salut

On devrait voir normalement une roundbox(), box(),circle(), etc... affichés sur un sprite avec le drawingmode outline mais on ne voit rien.
Visiblement c'est un bug semble-t-il, non ?

Code : Tout sélectionner

InitSprite()
screenwidth = 1024
screenheight = 768

OpenWindow(0, 0, 0, screenwidth, screenheight, "Antialiased Line Demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0),0,0,screenwidth, screenheight)=0
  MessageRequester("Error", "Can't Open Screen!", 0)
  End
EndIf  
    
  
  If CreateSprite(0, 200, 200,#PB_Sprite_AlphaBlending) And StartDrawing(SpriteOutput(0))
    
    DrawingMode(#PB_2DDrawing_AllChannels)
    Box(0,0,200,200,RGBA(0,0,0,0)) ; on efface le calque 
    
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    ; RoundBox(0, 0, 200, 200, 20, 20, RGBA(Random(255), Random(255), Random(255),255)) ; uncomment to see the roundbox()

    
    DrawingMode(#PB_2DDrawing_Outlined)
    Box(0,0,100,100,RGBA(0,0,0,255))
    Circle(50,50,40,RGBA(255,0,0,255))

    y = 0
    For x = 0 To 95 Step 10
      RoundBox(x, y, 200-2*x, 200-2*y, 20, 20, RGBA(Random(255), Random(255), Random(255),255))
      y + 10 
    Next x
    StopDrawing() 
    ; ImageGadget(0, 0, 0, 200, 200, ImageID(0))
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
    
    ClearScreen(RGB(120,120,120))
    DisplayTransparentSprite(0,0,0)
    FlipBuffers()
    
  Until Event = #PB_Event_CloseWindow
[ Edit ]
ça marche avec :

Code : Tout sélectionner

 DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Outlined)
Dernière modification par blendman le ven. 10/juil./2015 14:54, modifié 1 fois.
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

Re: BUG ? roundbox(),box(),circle()... et outline

Message par blendman »

Spock a écrit :ça a l'air de marcher si tu poses le Drawing mode
Apres la creation des dessins
ça ne marche pas chez moi (pb 5.31, win8, x64).
En plus, ça ne marcherait plus dans un autre exemple, où tu voudrais plein de dessins de box/cercle avec outlined ou non :)
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

Re: BUG ? roundbox(),box(),circle()... et outline

Message par blendman »

ça ne marche pas du tout sur ton exemple ^^
LE cercle rouge devrait être outlined, pourtant il est plein là ;)
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

Re: BUG ? roundbox(),box(),circle()... et outline

Message par blendman »

Non, ça ne marche toujours pas , même en le rajoutant , car ton cercle noir ne devrait pas être plein. C'est pour ça que tu vois d'ailleurs tes roundbox() et ton cercle, parce que tu dessines sur a box qui elle est plein et non "outlined".
Je veux dessiner sur du transparent, pas sur une box() pleine ;)
Si tu enlèves la box noir en full, ça ne marchera plus ;)

Dans mon code, ça fonctionne aussi si on dessine sur la roundbox() (il faut décommenter la ligne que j'ai mis en commentaire).

Mais je pense que c'est bien un bug effectivement.
Mesa
Messages : 1126
Inscription : mer. 14/sept./2011 16:59

Re: BUG ? roundbox(),box(),circle()... et outline

Message par Mesa »

Comme ça ?

Code : Tout sélectionner

InitSprite()
screenwidth = 1024
screenheight = 768

OpenWindow(0, 0, 0, screenwidth, screenheight, "Antialiased Line Demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0),0,0,screenwidth, screenheight)=0
	MessageRequester("Error", "Can't Open Screen!", 0)
	End
EndIf  
		
	
	If CreateSprite(0, 200, 200,#PB_Sprite_AlphaBlending) And StartDrawing(SpriteOutput(0))
		
		DrawingMode(#PB_2DDrawing_AlphaChannel);<----------------------------
		Box(0,0,200,200,RGBA(0,0,0,0)) ; on efface le calque 
		
		DrawingMode(#PB_2DDrawing_AlphaBlend);<-------------------------------
		RoundBox(0, 0, 200, 200, 20, 20, RGBA(Random(255), Random(255), Random(255),255)) ; uncomment to see the roundbox()

		
		DrawingMode(#PB_2DDrawing_Outlined)
		Box(0,0,100,100,RGBA(0,0,0,255))
		Circle(50,50,40,RGBA(255,0,0,255))

		y = 0
		For x = 0 To 95 Step 10
			RoundBox(x, y, 200-2*x, 200-2*y, 20, 20, RGBA(Random(255), Random(255), Random(255),255))
			y + 10 
		Next x
		StopDrawing() 
		; ImageGadget(0, 0, 0, 200, 200, ImageID(0))
	EndIf
	
	Repeat
		Event = WaitWindowEvent()
		
		ClearScreen(RGB(120,120,120))
		DisplayTransparentSprite(0,10,10)
		FlipBuffers()
		Delay(10)
	Until Event = #PB_Event_CloseWindow
M.
Avatar de l’utilisateur
falsam
Messages : 7324
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Re: BUG ? roundbox(),box(),circle()... et outline

Message par falsam »

Spock a écrit :ça marche si tu poses le Drawing mode
Apres la creation des dessins
C'est une aberration de dire ça.

Dans le jeu que je présente CrazySnake, je n'utilise qu'un seule sprite avec les différents modes et je n'ai pas ce soucis que ce soit en x86 ou x64.

Mes différents DrawingMode() sont appelés avant de faire le dessin comme par exemple cet extrait
;Draw Grid outline
DrawingMode(#PB_2DDrawing_Outlined)
Box(0, 0, 400, 400, LineColor)
DrawingMode(#PB_2DDrawing_Default)
Pour moi il n'y a pas de bug.
Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Avatar de l’utilisateur
falsam
Messages : 7324
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Re: BUG ? roundbox(),box(),circle()... et outline

Message par falsam »

Finalement si il y a peut être un bug avec la combinaison de deux modes (#PB_2DDrawing_AllChannels et #PB_2DDrawing_Outlined)

Si on active le mode #PB_2DDrawing_AllChannels pour afficher un fond invisible et qu'on souhaite afficher des cercles avec le mode #PB_2DDrawing_Outlined sur ce fond invisible, alors effectivement les cercles ne s'affiches pas.

Mais est ce effectivement un bug ?
Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Avatar de l’utilisateur
falsam
Messages : 7324
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Re: BUG ? roundbox(),box(),circle()... et outline

Message par falsam »

@Blendman: Puisque tu géres toute la chaine alpha dans ton sprite, enléve simplement le flag #PB_Sprite_AlphaBlending de la création du sprite et ton code fonctionnera.

Code : Tout sélectionner

InitSprite()
screenwidth = 1024
screenheight = 768

OpenWindow(0, 0, 0, screenwidth, screenheight, "Antialiased Line Demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0),0,0,screenwidth, screenheight)=0
  MessageRequester("Error", "Can't Open Screen!", 0)
  End
EndIf  

If CreateSprite(0, 200, 200) And StartDrawing(SpriteOutput(0))
  
  DrawingMode(#PB_2DDrawing_AlphaChannel);<----------------------------
  Box(0,0,200,200,RGBA(0,0,0,0)) ; on efface le calque 
      
  DrawingMode(#PB_2DDrawing_Outlined)
  Box(0,0,100,100,RGBA(0,0,0,255))
  Circle(50,50,40,RGBA(255,0,0,255))

  y = 0
  For x = 0 To 95 Step 10
    RoundBox(x, y, 200-2*x, 200-2*y, 20, 20, RGBA(Random(255), Random(255), Random(255),255))
    y + 10   
  Next x
  
  StopDrawing()
EndIf
   
Repeat ;Je ne dirais rien sur le repeat manquant :)
  Event = WaitWindowEvent()
      
  ClearScreen(RGB(120,120,120))
  DisplayTransparentSprite(0,10,10)
  FlipBuffers()
  Delay(10)
Until Event = #PB_Event_CloseWindow
Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

Re: BUG ? roundbox(),box(),circle()... et outline

Message par blendman »

Visiblement ça marche avec DrawingMode(#PB_2DDrawing_Outlined|#PB_2DDrawing_alphablend)
(Je pensais l'avoir testé, mais j'ai dû me tromper la première fois).

C'est plutôt une bonne nouvelle :)

Code : Tout sélectionner

screenwidth = 1024
screenheight = 768

OpenWindow(0, 0, 0, screenwidth, screenheight, "Outline+image", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
   If CreateImage(0, screenwidth, screenheight,32,#PB_Image_Transparent) And StartDrawing(ImageOutput(0))
           
      DrawingMode(#PB_2DDrawing_AlphaChannel)
      Box(0,0,screenwidth, screenheight,RGBA(0,0,0,0)) ; on efface le calque
      
      DrawingMode(#PB_2DDrawing_Outlined|#PB_2DDrawing_alphablend)
      Box(0,0,100,100,RGBA(0,0,0,255))
      Circle(50,50,40,RGBA(255,0,0,255))

      y = 0
      For x = 0 To 95 Step 10
         RoundBox(x, y, 200-2*x, 200-2*y, 20, 20, RGBA(Random(255), Random(255), Random(255),255))
         y + 10
      Next x
      StopDrawing()
      ImageGadget(0, 0, 0, screenwidth, screenheight, ImageID(0))
   EndIf
   
   Repeat
     
      Event = WaitWindowEvent(10)
      
   Until Event = #PB_Event_CloseWindow
Avatar de l’utilisateur
falsam
Messages : 7324
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Re: BUG ? roundbox(),box(),circle()... et outline

Message par falsam »

Si si mon bon Monsieur, il n'y a pas de bug. Tu n'utilises pas les bonnes combinaisons de flags

Petit code extrait du survival guide

Code : Tout sélectionner

; survival guide 6_3_200 drawing mode
; pb 4.40 - > 5.30
;
Enumeration
  #w_main
  #g_image
  #i_result
EndEnumeration
;
OpenWindow(#w_main,10,10,870,6*130,"Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
AddKeyboardShortcut(#w_main,#PB_Shortcut_Escape,1)
CreateImage(#i_result,870,6*130,32)
;
StartDrawing(ImageOutput(#i_result))
  ;
  ; top half black
  ;
  DrawingMode(#PB_2DDrawing_Default)
  Box(0,0,870,6*130,RGB(0,0,0))
  ;
  ; first section transparent (alhpa 0)
  ;
  DrawingMode(#PB_2DDrawing_AlphaChannel)
  Box(0,0*130,870,3*130,RGBA(0,0,0,0))
  DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
  DrawText(10,1*130-125,"fully transparent black background",RGBA(255,255,255,255))
  ;
  ; second section half solid (alpha 128)
  ;
  DrawingMode(#PB_2DDrawing_AlphaChannel)
  Box(0,1*130,870,130,RGBA(0,0,0,128))
  DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
  DrawText(10,2*130-125,"half transparent black background",RGBA(255,255,255,255))
  ;
  ; third section solid (alpha 255)
  ;
  DrawingMode(#PB_2DDrawing_AlphaChannel)
  Box(0,2*130,870,130,RGBA(0,0,0,255))
  DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
  DrawText(10,3*130-125,"solid black background",RGBA(255,255,255,255))
  ;
  ; bottom half white
  ;
  DrawingMode(#PB_2DDrawing_Default)
  Box(0,3*130,870,3*130,RGB(255,255,255))
  ;
  ; fourth section transparent (alhpa 0)
  ;
  DrawingMode(#PB_2DDrawing_AlphaChannel)
  Box(0,3*130,870,130,RGBA(0,0,0,0))
  DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
  DrawText(10,4*130-125,"fully transparent white background",RGBA(0,0,0,255))
  ;
  ; fifth section half solid (alpha 128)
  ;
  DrawingMode(#PB_2DDrawing_AlphaChannel)
  Box(0,4*130,870,130,RGBA(0,0,0,128))
  DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
  DrawText(10,5*130-125,"half transparent white background",RGBA(0,0,0,255))
  ;
  ; sixth section solid (alpha 255)
  ;
  DrawingMode(#PB_2DDrawing_AlphaChannel)
  Box(0,5*130,870,130,RGBA(0,0,0,255))
  DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
  DrawText(10,6*130-125,"solid white background",RGBA(0,0,0,255))
  ;
  For row = 0 To 5
    ;
    x = 10
    y = 50+row*130
    ;
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
    DrawText(x,y-25,"default",RGBA(255,0,0,255))
    DrawingMode(#PB_2DDrawing_Default)
    Box(x,y,40,40,RGBA(255,0,0,255))
    Box(x+10,y+10,40,40,RGBA(255,0,0,128))
    Box(x+20,y+20,40,40,RGBA(255,0,0,128))
    Box(x+30,y+30,40,40,RGBA(255,0,0,0))
    ;
    x = x+130
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
    DrawText(x,y-25,"transparent",RGBA(255,0,0,255))
    DrawingMode(#PB_2DDrawing_Transparent)
    Box(x,y,40,40,RGBA(255,0,0,255))
    Box(x+10,y+10,40,40,RGBA(255,0,0,128))
    Box(x+20,y+20,40,40,RGBA(255,0,0,128))
    Box(x+30,y+30,40,40,RGBA(255,0,0,0))
    ;
    x = x+130
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
    DrawText(x,y-25,"xor",RGBA(255,0,0,255))
    DrawingMode(#PB_2DDrawing_XOr)
    Box(x,y,40,40,RGBA(255,0,0,255))
    Box(x+10,y+10,40,40,RGBA(255,0,0,128))
    Box(x+20,y+20,40,40,RGBA(255,0,0,128))
    Box(x+30,y+30,40,40,RGBA(255,0,0,0))
    ;
    x = x+130
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
    DrawText(x,y-25,"outlined",RGBA(255,0,0,255))
    DrawingMode(#PB_2DDrawing_Outlined)
    Box(x,y,40,40,RGBA(255,0,0,255))
    Box(x+10,y+10,40,40,RGBA(255,0,0,128))
    Box(x+20,y+20,40,40,RGBA(255,0,0,128))
    Box(x+30,y+30,40,40,RGBA(255,0,0,0))
    ;
    x = x+130
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
    DrawText(x,y-25,"blend",RGBA(255,0,0,255))
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    Box(x,y,40,40,RGBA(255,0,0,255))
    Box(x+10,y+10,40,40,RGBA(255,0,0,128))
    Box(x+20,y+20,40,40,RGBA(255,0,0,128))
    Box(x+30,y+30,40,40,RGBA(255,0,0,0))
    ;
    x = x+130
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
    DrawText(x,y-25,"clip",RGBA(255,0,0,255))
    DrawingMode(#PB_2DDrawing_AlphaClip)
    Box(x,y,40,40,RGBA(255,0,0,255))
    Box(x+10,y+10,40,40,RGBA(255,0,0,128))
    Box(x+20,y+20,40,40,RGBA(255,0,0,128))
    Box(x+30,y+30,40,40,RGBA(255,0,0,0))
    ;
    x = x+130
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
    DrawText(x,y-25,"channel",RGBA(255,0,0,255))
    DrawingMode(#PB_2DDrawing_AlphaChannel)
    Box(x,y,40,40,RGBA(255,0,0,255))
    Box(x+10,y+10,40,40,RGBA(255,0,0,128))
    Box(x+20,y+20,40,40,RGBA(255,0,0,128))
    Box(x+30,y+30,40,40,RGBA(255,0,0,0))
    ;
  Next row
StopDrawing()
;
ImageGadget(#g_image,0,0,870,6*130,ImageID(#i_result))
Repeat
  event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow Or event = #PB_Event_Menu
Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

Re: BUG ? roundbox(),box(),circle()... et outline

Message par blendman »

@falsam : mais ma bonne dame, j'ai indiqué la solution (en gardant le "pb_sprite_alphablending dont j'ai besoin) :
Visiblement ça marche avec DrawingMode(#PB_2DDrawing_Outlined|#PB_2DDrawing_alphablend)
:mrgreen:
Avatar de l’utilisateur
falsam
Messages : 7324
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Re: [ok] roundbox(),box(),circle()... et outline

Message par falsam »

Non mais tu as corrigé ton précédent message !!! J'aurais du quoter cette phrase ou tu affirmais que tu ne pouvais plus afficher de niveau de transparence si on supprimait le flag #PB_Sprite_AlphaBlending lors de la création du sprite.

Tu veux me faire passer pour un dingue hein ? Avoues !!
Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Avatar de l’utilisateur
falsam
Messages : 7324
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Re: [ok] roundbox(),box(),circle()... et outline

Message par falsam »

blendman a écrit :@falsam : mais ma bonne dame, j'ai indiqué la solution (en gardant le "pb_sprite_alphablending dont j'ai besoin) : :mrgreen:
Non mais genre je n'aurais pas lu ton message !!!

Et bien si je l'ai lu et je peux clamer haut et fort que toi Blendman (là je te montre du doigts tremblant de rage) tu es un fourbe et heureusement que mon cache navigateur fonctionne bien.

Ton message date de 14:16 et tu l'as modifié. Voici ta réponse précédente à la même heure.

Image


Il est juste de demander que cet homme soit puni !!!

Image

Ouiiiiii qu'on jette le mécréant au bucher .....
Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

Re: [ok] roundbox(),box(),circle()... et outline

Message par blendman »

J'aurais du quoter cette phrase ou tu affirmais que tu ne pouvais plus afficher de niveau de transparence si on supprimait le flag #PB_Sprite_AlphaBlending lors de la création du sprite
Ben, je confirme: si tu supprimes #PB_Sprite_AlphaBlending, tu ne peux plus utiliser la transparence (RGBA() ou la transparence d'une image png) avec ton sprite :D :

Code : Tout sélectionner

InitSprite()
screenwidth = 1024
screenheight = 768
UsePNGImageDecoder()
OpenWindow(0, 0, 0, screenwidth, screenheight, "Sprite", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0),0,0,screenwidth, screenheight)=0
  MessageRequester("Error", "Can't Open Screen!", 0)
  End
EndIf 

If CreateSprite(0, 200, 200) 
  file$ =OpenFileRequester("image","","png|*.png",0)
  If file$ <> ""
    LoadImage(0,file$)
  EndIf
  
  If StartDrawing(SpriteOutput(0))
    
  DrawingMode(#PB_2DDrawing_AlphaChannel)
  Box(0,0,200,200,RGBA(0,0,0,0)) ; on efface le calque
     
  DrawingMode(#PB_2DDrawing_Outlined)
  Box(0,0,100,100,RGBA(0,0,0,255))
  Circle(50,50,40,RGBA(255,0,0,255))
  

  y = 0
  For x = 0 To 95 Step 10
    RoundBox(x, y, 200-2*x, 200-2*y, 20, 20, RGBA(Random(255), Random(255), Random(255),255))
    y + 10   
  Next x
  
  DrawingMode(#PB_2DDrawing_AlphaBlend)
  DrawAlphaImage(ImageID(0),0,0)
  
  Box(50,50,50,50,RGBA(0,120,0,10)) ; devrai être transparent et ne l'est pas
  Box(110,50,50,50,RGBA(0,120,0,255)) ; pour comparer
      
  StopDrawing()
EndIf
EndIf
   
Repeat 
  Event = WaitWindowEvent(10)
     
  ClearScreen(RGB(120,120,120))
  DisplayTransparentSprite(0,10,10)
  FlipBuffers()
 
Until Event = #PB_Event_CloseWindow
Ou alors, il existe une technique magique que je ne connais pas :).

Or, moi, je veux mixer transparence (image ou box, circle,RGBA(), etc..) avec élément outlined (box, circle). Donc, la solution était bien d'utiliser drawingmode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Outlined) pour dessiner mes box,cercle en outlined + mes box,cercle ou image avec transparence.

J'ai modifié mon message car j'ai eu la réponse entre temps (et je suis sympa, je ne voulais te foutre la honte lol :mrgreen:
parce que répondre à une question "j'ai un bug avec l'alpha de mon image" par "tu n'as qu'à pas utiliser l'alpha", ben :roll: :mrgreen: (je rigole :)))

Non, mais tu vois ça, moi, je suis sympa, je veux t'éviter la honte et toi, tu veux me brûler, roh :mrgreen: (comme si il ne faisait pas assez chaud ^^)
PS (edit !!!! pour FAlsam) : ton message m'a bien fait rire :D
Avatar de l’utilisateur
falsam
Messages : 7324
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Re: [ok] roundbox(),box(),circle()... et outline

Message par falsam »

blendman a écrit :J'ai modifié mon message car j'ai eu la réponse entre temps (et je suis sympa, je ne voulais te foutre la honte lol
Je prend à témoin les lecteurs de ce forum : Avez vous l'impertinence de Blendman dans ces propos ? Et avec quel insolence il cherche à m'enfoncer ?

̶M̶o̶i̶ ̶P̶r̶é̶s̶i̶d̶e̶n̶t̶ ̶ Oops pardon je reprend. Moi Monsieur c'est vrai que je ne suis pas bon en 2D et 3D et oui je vais surement m'enfoncer un peu plus. Alors alors y si vous le permetez.
blendman a écrit :Ben, je confirme: si tu supprimes #PB_Sprite_AlphaBlending, tu ne peux plus utiliser la transparence (RGBA() ou la transparence d'une image png) avec ton sprite
Tu verras dans ce code que j'ai supprimé ton #PB_Sprite_AlphaBlending.

Je vais afficher ton sprite trois fois de suite avec tes boites Outlinés et en faisant varier le canal alpha (La transparence pour ceux qui ne savent pas de on parle)

Va y mon gars. CopieColle ce code et exécutes le

Code : Tout sélectionner

InitSprite() : InitKeyboard()

screenwidth = 1024
screenheight = 768

OpenWindow(0, 0, 0, screenwidth, screenheight, "Antialiased Line Demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0),0,0,screenwidth, screenheight)=0
  MessageRequester("Error", "Can't Open Screen!", 0)
  End
EndIf  

If CreateSprite(0, 200, 200) And StartDrawing(SpriteOutput(0))
  
  DrawingMode(#PB_2DDrawing_AlphaChannel);<----------------------------
  Box(0,0,200,200,RGBA(0,0,0,0)) ; on efface le calque 
      
  DrawingMode(#PB_2DDrawing_Outlined)
  Box(0,0,100,100,RGBA(0,0,0,255))
  Circle(50,50,40,RGBA(255,0,0,255))

  y = 0
  For x = 0 To 95 Step 10
    RoundBox(x, y, 200-2*x, 200-2*y, 20, 20, RGBA(Random(255), Random(255), Random(255),255))
    y + 10   
  Next x
  
  StopDrawing()
EndIf

CopySprite(0, 1)
CopySprite(0, 2)

Repeat
  Repeat
      Event = WindowEvent()
       
      Select Event    
        Case #PB_Event_CloseWindow
          End
      EndSelect  
  Until Event=0  
  ExamineKeyboard()
  
  ClearScreen(RGB(120,120,120))
  
 
  DisplayTransparentSprite(0,10,10, 255)
  
  DisplayTransparentSprite(1,220,10, 128)
  
  DisplayTransparentSprite(2,420,10, 64)
  FlipBuffers()
 
  
Until KeyboardPushed(#PB_Key_Escape)
ça alors (virgule) il y a eu de la magie.
Dernière modification par falsam le ven. 10/juil./2015 17:25, modifié 1 fois.
Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Répondre