dessin 2D

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
nico
Messages : 3702
Inscription : ven. 13/févr./2004 0:57

dessin 2D

Message par nico »

Je ne suis pas très doué en dessin, est-ce que vous auriez des infos sur la façon de dessiner par exemple un cercle en donnant du relief de façon à faire apparaître une demi sphère.

Il doit y avoir des techniques, j'imagine!

:)
lionel_om
Messages : 1500
Inscription : jeu. 25/mars/2004 11:23
Localisation : Sophia Antipolis (Nice)
Contact :

Message par lionel_om »

Euh, je comprend pas ce que tu veux dire...
J'ai mis qq dessins sur mon site, pour ceux que ça inté&resdse de regarder (rubrique dessins)
Webmestre de Basic-univers
Participez à son extension: ajouter vos programmes et partagez vos codes !
nico
Messages : 3702
Inscription : ven. 13/févr./2004 0:57

Message par nico »

Ben c'est simple, donner de la dimension aux dessins et pas seulement dessiner un cercle mais lui donner du relief.
fweil
Messages : 505
Inscription : dim. 16/mai/2004 17:50
Localisation : Bayonne (64)
Contact :

Message par fweil »

nico,

Un jouet pour dire si ça répond en partie à ta question ! Si ça va dans le bon sens j'ajouterai des skins et des paramètres si possible.

Code : Tout sélectionner

Enumeration
  #Window_Main
  #Image
EndEnumeration

  WindowWidth = 640
  WindowHeight = 480
  MaxModes = 1
  If OpenWindow(#Window_Main, 0, 0, WindowWidth, WindowHeight, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered, "MyWindow")
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Escape, #PB_Shortcut_Escape)
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_F1, #PB_Shortcut_F1)
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Left, #PB_Shortcut_Left)
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Right, #PB_Shortcut_Right)
      If CreateGadgetList(WindowID(#Window_Main))
      EndIf
      ImageID = CreateImage(#Image, WindowWidth, WindowHeight)
      cx = WIndowWidth / 2
      cy = WindowHeight / 2
      Quit = #FALSE
      Repeat
        StartDrawing(ImageOutput())
          Radius = 100 * Int(WindowHeight / 100) / 2
          Select Mode
            Case 0
              yRadius = Radius
              For xRadius = yRadius To 0 Step -1
                Color = 255 * xRadius / Radius
                Ellipse(cx, cy, xRadius, yRadius, Color)
              Next
            Case 1
              For x = 0 To Radius
                Color = 255 * x / Radius
                Circle(cx - x / 2, cy + x / 3, Radius - x, Color)
              Next
          EndSelect
        StopDrawing()
        Select WindowEvent()
          Case #PB_Event_CloseWindow
            Quit = #TRUE
          Case #PB_Event_Menu
            Select EventMenuID()
              Case #PB_Shortcut_Escape
                Quit = #TRUE
              Case #PB_Shortcut_F1
                Statistics = 1 - Statistics
              Case #PB_Shortcut_Left
                Mode - 1
                If Mode < 0
                    Mode = 0
                EndIf
              Case #PB_Shortcut_Right
                Mode + 1
                If Mode > MaxModes
                    Mode = MaxModes
                EndIf
            EndSelect
          Case #PB_Event_SizeWindow
            WindowWidth = WindowWidth()
            WindowHeight = WindowHeight()
            ImageID = CreateImage(#Image, WindowWidth, WindowHeight)
            cx = WIndowWidth / 2
            cy = WindowHeight / 2
        EndSelect
        StartDrawing(WindowOutput())
          DrawImage(ImageID, 0, 0)
          If Statistics
              BackColor(0, 0, 40)
              FrontColor(255, 255, 255)
              Locate(10, 10)
              DrawText("FPS : " + Str(FPS))
          EndIf
        StopDrawing()
        NFrames + 1
        If ElapsedMilliseconds() - tz => 1000
            FPS = NFrames
            NFrames = 0
            tz = ElapsedMilliseconds()
        EndIf
        Delay(1)
      Until Quit
  EndIf
End
Mon avatar reproduit l'image de 4x1.8m présentée au 'Salon international du meuble de Paris' en janvier 2004, dans l'exposition 'Shades' réunisant 22 créateurs autour de Matt Sindall. L'original est un stratifié en 150 dpi.
Le Soldat Inconnu
Messages : 4312
Inscription : mer. 28/janv./2004 20:58
Localisation : Clermont ferrand OU Olsztyn
Contact :

Message par Le Soldat Inconnu »

ou alors comme ceci


il faut ma lib Effect pour lancé ce code

Code : Tout sélectionner

Rayon = 45
x = 50
y = 50
Couleur = RGB(50, 200, 25)

CreateImage(0, 100, 100)
StartDrawing(ImageOutput())

  For n = 0 To Rayon - 1
    
    CouleurCercle = ColorLuminosity(Couleur, 0.75 + n / Rayon / 2)
    
    DeplacementCercle = n / (2 * Sqr(2))
    
    Circle(x - DeplacementCercle, y - DeplacementCercle, Rayon - n, CouleurCercle)
  Next
   
StopDrawing()

If OpenWindow(0, 0, 0, 300, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget, "Test") = 0 Or CreateGadgetList(WindowID()) = 0
  End
EndIf

ImageGadget(0, 0, 0, 100, 100, UseImage(0))

Repeat
  Event = WaitWindowEvent()
  
Until Event = #PB_EventCloseWindow
Je ne suis pas à moitié Polonais mais ma moitié est polonaise ... Vous avez suivi ?

[Intel quad core Q9400 2.66mhz, ATI 4870, 4Go Ram, XP (x86) / 7 (x64)]
nico
Messages : 3702
Inscription : ven. 13/févr./2004 0:57

Message par nico »

C'est bien trouvé, mais je perd l'effet en utilisant la transparence. :roll:
Répondre