Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
678 connectés 

  FORUM HardWare.fr
  Programmation
  Python

  Tracer une cubique mais pas revenir au début [Image illustration]

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Tracer une cubique mais pas revenir au début [Image illustration]

n°1548605
jijiz
Posté le 25-04-2007 à 12:16:19  profilanswer
 

Bonjour,  
 
Je souhaite afficher uniquement la cubique et non le trait qui part de la fin du tracé et qui revient au début :
 
http://www.hebergement-images.com/05/1177495528_t.png
 
Voici le code :
 

Code :
  1. class CubicDragable(QtGui.QLabel):
  2.     def __init__(self, QP1, QP2, parent=None):
  3.         super (CubicDragable, self).__init__ (parent)
  4.         # Construct the path
  5.         path = QtGui.QPainterPath()
  6.         path.setFillRule(QtCore.Qt.OddEvenFill)
  7.        
  8.         # Drawing the cubic to gap 2 points           
  9.         if (QP1.x()<QP2.x()):
  10.             # Coordinates of the first control point
  11.             QPc1 = QtCore.QPointF((QP2.x()-QP1.x())/2,QP1.y())
  12.             # Coodinates of the second control point
  13.             QPc2 = QtCore.QPointF((QP2.x()-QP1.x())/2,QP2.y())
  14.         else:
  15.             # Coordinates of the first control point
  16.             QPc1 = QtCore.QPointF((QP1.x()-QP2.x())/2,QP1.y())
  17.             # Coodinates of the second control point
  18.             QPc2 = QtCore.QPointF((QP1.x()-QP2.x())/2,QP2.y())
  19.         path.moveTo(QP1)
  20.         path.cubicTo(QPc1,QPc2,QP2)
  21.         path.closeSubpath()
  22.        
  23.         # Area where the path will be drawn
  24.         image = QtGui.QImage(abs(QP1.x()- QP2.x()), abs(QP1.y()- QP2.y()),
  25.                              QtGui.QImage.Format_ARGB32_Premultiplied)
  26.        
  27.         # Start the painting device
  28.         painter = QtGui.QPainter()
  29.         painter.begin(image)
  30.         painter.setRenderHint(QtGui.QPainter.Antialiasing)
  31.         # Dawing the path of our cubic
  32.         painter.drawPath(path)
  33.         self.setPixmap(QtGui.QPixmap.fromImage(image))
  34.         painter.end()


 
Merci

mood
Publicité
Posté le 25-04-2007 à 12:16:19  profilanswer
 

n°1548677
jijiz
Posté le 25-04-2007 à 15:18:46  profilanswer
 

up

n°1548681
MagicBuzz
Posté le 25-04-2007 à 15:24:00  profilanswer
 

marche pas ton image

n°1548682
MagicBuzz
Posté le 25-04-2007 à 15:24:49  profilanswer
 

sinon, y'a pas un "drawCurve" plutôt qu'un "drawPath" ?
car j'ai l'impression que ton problème c'est que le drawPath dessine une forme fermée c'est ça ?

n°1552217
jijiz
Posté le 02-05-2007 à 12:06:13  profilanswer
 

MagicBuzz a écrit :

sinon, y'a pas un "drawCurve" plutôt qu'un "drawPath" ?
car j'ai l'impression que ton problème c'est que le drawPath dessine une forme fermée c'est ça ?


Oui c'est cela. Il doit y avoir une option... sinon je vais éssayer avec drawCurve mais ça m'étonne qu'il n'y ai pas une option.
 
Comment elle marche pas l'image?Je la vois et je ne suis pas au boulot.

n°1552229
MagicBuzz
Posté le 02-05-2007 à 12:23:10  profilanswer
 

ben maintenant je la vois. elle marchait pas l'autre jour (ça chargeait pendant 2 heures puis ça faisait un timeout)

n°1552232
jijiz
Posté le 02-05-2007 à 12:29:49  profilanswer
 

oki


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Python

  Tracer une cubique mais pas revenir au début [Image illustration]

 

Sujets relatifs
[Résolu][C# .Net] Changer le curseur quand je pointe une imageBesoin d'aide zone cliquable sur une image.
Réajuster une imageAffichage d'une image pendant le clic sur un bouton
Ajout d'une simple image avec QTDesignerdessiner un rectangle vide sur une image
Découper une image avec CSSProblème dimension image
Image en fond d'un JButton[résolu] Problème d'image de fond avec Firefox
Plus de sujets relatifs à : Tracer une cubique mais pas revenir au début [Image illustration]


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR