realbasic-nug.fr
[Top] [All Lists]

Re: Pb avec drawpicture

To: REALbasic NUG French <realbasic-nug dot fr at lists dot realsoftware dot com>
Subject: Re: Pb avec drawpicture
From: Thierry Nauze <ohmi at orange dot fr>
Date: Thu, 25 Oct 2007 16:36:18 +0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug dot fr at lists dot realsoftware dot com
References: <9B52C982-8151-11DC-93DE-000A27AE3336 at sucellus dot net> <CB89038A-50F2-4CA6-87FE-4066A6362FE7 at e-topics dot net> <7B8818E1-2537-4617-83BC-6FF99BF10058 at e-topics dot net> <0D14BE83-B2BA-46B0-A3C8-B6D2E2FECE81 at cretaux dot fr> <471F7C32 dot 1060200 at wanadoo dot fr> <47205D44 dot 8060604 at realsoftware dot fr> <47208370 dot 30306 at wanadoo dot fr>

On 25 oct. 07, at 15:52, Emile Schwarz wrote:

Je ne comprends pas:

Syntax

Graphics.DrawPicture Image, X, Y, [DestWidth], [DestHeight], [SourceX], [SourceY], [SourceWidth], [SourceHeight]



Seuls "Image" et x,y sont nécessaires, DestWidth est optionel tout seul (comme les autres)...


   <quote>
   Notes

DestWidth and DestHeight are used to change the scaling of the picture when it is drawn and default to the Width and Height of the picture. SourceX and SourceY default to 0 and are used to determine the upper-left coordinate you wish to copy from. SourceWidth and SourceHeight default to the Width and Height of the picture and are used to indicate the portion of the picture you wish to copy.
</quote>


Je ne comprends pas l'anglais mais ça doit correspondre à mon exemple ci-dessous :

Ah, donc il ne manque que quelques crochets...

???
Il y a peut-être que trois options possibles :

Graphics.DrawPicture Image, X, Y,
Graphics.DrawPicture Image, X, Y, DestWidth, DestHeight
Graphics.DrawPicture Image, X, Y, DestWidth, DestHeight, SourceX, SourceY, SourceWidth, SourceHeight

Peut-être aurait-il fallu écrire comme ça ?

Graphics.DrawPicture Image, X, Y, [ DestWidth, DestHeight, [SourceX, SourceY, SourceWidth, SourceHeight] ]



C'est comme çà depuis quand ?

Toujours ?


J'ai une image SAGE que je veux éventuellement recadrer pour la caser dans un CANVAS ...

J'appelle une routine ...

monImageRecadree = reCadre(SAGE , CANVAS.width , CANVAS.height)
if monImageRecadree<>nil then
CANVAS.backdrop=monImageRecadree
else
....
end

et la fonction


Function reCadre(imaze as picture, l as integer, h as integer) As picture
  dim largeur, hauteur as Integer
  dim imageRecadree as Picture
  dim echelle as double

  if imaze.width>l or imaze.height>h then
    echelle = max(imaze.width/l,imaze.height/h)
    largeur=imaze.width/echelle
    hauteur=imaze.height/echelle
    imageRecadree=newPicture(largeur,hauteur, Screen(0).Depth)
    if imageRecadree<>nil then
imageRecadree.Graphics.DrawPicture imaze,0,0,largeur,hauteur, 0,0,imaze.width,imaze.height
      return imageRecadree
    else
      return nil
    end

  else
    return imaze

  end

End Function


Dans cette commande,

imageRecadree.Graphics.DrawPicture imaze,0,0,largeur,hauteur, 0,0,imaze.width,imaze.height

les quatre derniers paramètres sont sûrement inutiles puisque je demande de recadrer toute l'image. Ils sont intéressants si tu ne veux prendre qu'une partie de l'image initiale.

En espérant avoir fait avancer le schmilblick ?



--
Thierry NAUZE        Saint-Denis de la Réunion





<Prev in Thread] Current Thread [Next in Thread>