OVH Cloud OVH Cloud

Intérêt de GDI+ ?

11 réponses
Avatar
JM
Bonjour!

Je souhaiterais savoir s'il est intéressant de se plonger dans GDI+.
Est-ce que ce n'est pas trop lent, vraiment utile... ?
Merci d'avance

10 réponses

1 2
Avatar
Remi Thomas
JM wrote:
Bonjour!

Je souhaiterais savoir s'il est intéressant de se plonger dans GDI+.
Est-ce que ce n'est pas trop lent, vraiment utile... ?
Merci d'avance



Bonjour,

C'est plus lent que GDI mais:
- c'est totalement objet
- c'est trés puissant (transparence, bitmap, jpeg/gif/tiff/png, ...)
- ce sont les mêmes API en C++ et .NET

Rémi

--
Rémi Thomas - MVP Visual C++
Développeur Windows indépendant
http://www.xtware.com/cv
Avatar
JM
Est-ce qu'on peut interfacer facilement GDI et GDI+ ?
Tout simplement parce que j'ai quelques milliers de lignes de code et
que j'ai pas envie de passer 3 ans à tout refaire !

Merci

Remi Thomas a écrit :
JM wrote:

Bonjour!

Je souhaiterais savoir s'il est intéressant de se plonger dans GDI+.
Est-ce que ce n'est pas trop lent, vraiment utile... ?
Merci d'avance




Bonjour,

C'est plus lent que GDI mais:
- c'est totalement objet
- c'est trés puissant (transparence, bitmap, jpeg/gif/tiff/png, ...)
- ce sont les mêmes API en C++ et .NET

Rémi



Avatar
AMcD®
JM wrote:
Est-ce qu'on peut interfacer facilement GDI et GDI+ ?
Tout simplement parce que j'ai quelques milliers de lignes de code et
que j'ai pas envie de passer 3 ans à tout refaire !



Que veux-tu dire ? Parce que il ne s'agit que d'appeller des fonctions d'API
hein. Un est direct, GDI, l'autre est objet, GDI+. Tu feras :

GDI+
====
Graphics g(hDC);
Point pt1(100,100),pt2(200,200;
Pen pen(Color::Black,5);
g.DrawLine(&pen, pt1,pt2);

GDI
====
HPEN hPen;
hPen = CreatePen(PS_SOLID, 0, RGB(0, 0, 0));
SelectObject(hDC,hPen);
MoveTo(hDC,100,100,NULL);
LineTo(hDC,200,200);

Enfin, en gros quoi...

--
AMcD®

http://arnold.mcdonald.free.fr/
Avatar
JM
Merci pour l'exemple :-)

En gros, d'après cet exemple, on peut mixer les deux, non?

AMcD® a écrit :
JM wrote:

Est-ce qu'on peut interfacer facilement GDI et GDI+ ?
Tout simplement parce que j'ai quelques milliers de lignes de code et
que j'ai pas envie de passer 3 ans à tout refaire !




Que veux-tu dire ? Parce que il ne s'agit que d'appeller des fonctions d'API
hein. Un est direct, GDI, l'autre est objet, GDI+. Tu feras :

GDI+
==== >
Graphics g(hDC);
Point pt1(100,100),pt2(200,200;
Pen pen(Color::Black,5);
g.DrawLine(&pen, pt1,pt2);

GDI
==== >
HPEN hPen;
hPen = CreatePen(PS_SOLID, 0, RGB(0, 0, 0));
SelectObject(hDC,hPen);
MoveTo(hDC,100,100,NULL);
LineTo(hDC,200,200);

Enfin, en gros quoi...



Avatar
Aurelien REGAT-BARREL
> Je souhaiterais savoir s'il est intéressant de se plonger dans GDI+.



GDI+ c'est pas un wrapper C++ de Win32. Y'a pas mal de nouveautés qu'on
apprend vite à apprécier, comme l'antialiasing par exemple. Mais c'est tout
en software. Donc ça dépend de ce que tu recherches.

--
Aurélien REGAT-BARREL
Avatar
Dominique Vaufreydaz
Bonjour,

JM wrote:
Merci pour l'exemple :-)



Je pense (attention, j'ai pas verifie) comme tu peux le faire pour MFC
et l'api WIN32 de base.

Qu'on me corrige si je me trompe !

Doms.
--
Impose ta chance, serre ton bonheur et va vers ton risque.
A te regarder, ils s'habitueront.
René Char, Les Matinaux.
----
http://Dominique.Vaufreydaz.free.fr/
http://TitchKaRa.free.fr/
http://logiciels.ntfaqfr.com/
Avatar
Christian ASTOR
JM wrote:

En gros, d'après cet exemple, on peut mixer les deux, non?



On peut utiliser les 2, mais je ne vois pas l'intérêt de les mixer

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/aboutGDIPlus/whatsnewinGDIPlus.asp
Avatar
JM
Bah j'ai un code d'une taille qui commence à devenir imposante, et je
n'ai as envie de refaire toute la partie graphique...
Voila voila...

Christian ASTOR a écrit :
JM wrote:

En gros, d'après cet exemple, on peut mixer les deux, non?




On peut utiliser les 2, mais je ne vois pas l'intérêt de les mixer

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/aboutGDIPlus/whatsnewinGDIPlus.asp



Avatar
Aurelien REGAT-BARREL
Oui, on peut.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q311221

--
Aurélien REGAT-BARREL
Avatar
lio_fr
JM wrote:

Bonjour!

Je souhaiterais savoir s'il est intéressant de se plonger dans GDI+.
Est-ce que ce n'est pas trop lent, vraiment utile... ?
Merci d'avance



une copie de la doc d un logiciel professionnel (manifold) utilisant l
export GDI. Les format se differencie par le supoort des couches (
layeur) et de l opacité ... Le seul format ou what you see is waht you
print sont les machine NEXT (pdf/pdf je crois )

Exporting to EMF, PS and PDF
Manifold offers four quasi-vector graphics arts / imaging formats to use
when exporting print layouts as "images."


EMF (GDI) Enhanced Meta File format, the 32 bit version of WMF (Windows
Meta File) format. This option writes EMF using classic Windows GDI
(Graphics Device Interface). Use the GDI version as a possible
workaround only if the GDI+ version does not provide satisfactory results.
EMF (GDI+) EMF written using GDI+. Microsoft's GDI+ was developed for
Windows XP and is installed by Manifold on all Windows systems if not
already installed. The GDI+ version should be used by default, as GDI+
includes numerous improvements over GDI.
PDF Portable Document Format, read by Adobe Acrobat Reader and other
applications.
PS PostScript format.

Exporting Multipage Layouts

Multipage layouts may be exported to PDF and PS, but not to EMF.
However, a single page of a multipage layout may be exported to EMF.
When a multipage layout is exported to EMF, the Export EMF File dialog
will include a Page option that allows specification of which page in
the multipage layout is to be exported.

When exporting a multipage layout to PDF or PS, a Pages option (called a
page filter) appears that controls which pages from the layout appear in
the exported image. Enter a series of page numbers or page ranges
separated by commas. White space is ignored and reverse ranges are
interpreted correctly. For example, We could enter 1, 2, 5-8 or 1, 2,
8-5 and get the same results. See the Multipage Layouts topic for an
example of using page filters.

About GDI and GDI+

Manifold uses Windows system routines wherever possible for maximum
performance and continuing quality as Windows updates are released. The
Graphics Device Interface (GDI) is a Windows subsystem used for a
variety of utility tasks involving device-independent graphics,
including export to EMF format. The original GDI has now been replaced
by GDI+, which was developed with Windows XP and has been released by
Microsoft in DLLs that developers can install on earlier Windows
systems. Manifold automatically installs GDI+ on Windows systems other
than XP.

The GDI+ version of the EMF exporter should always be used by default.
If problems occur when using the resulting files in other programs, try
using the GDI version to see if reverting to the earlier Windows
technology solves the problem (as it might with some programs that were
tested or developed using GDI and not GDI+).

Compatibility

Although the four formats in this topic are often thought to be
"universal," device independent formats the usage of these formats is no
guarantee that the visual appearance of what one program writes will be
recovered when the file is read by a different program. For example,
neither .pdf nor .ps can render opacity. If a layout includes a map
that shows a drawing below an image that has 50% opacity in the map, the
.pdf created by exporting the layout to a .pdf file will show the image
with 100% opacity. .emf exports using ordinary GDI do support opacity
for images and surfaces but not for drawings.

All four formats in this topic may be thought of as programming
languages as much as they are formats. They operate not only by
providing data but also by providing instructions on how a document is
to be dynamically constructed based upon that data. Whenever a program
reads one of these programs it must synthesize the desired document
using the data and instructions contained in the file. The program must
do its best to synthesize the desired document even if its capabilities
or the facilities of its host system (such as fonts that might be
available) may be less able than those in the system that wrote the file.

The full range of possibilities for describing a document within these
four systems can be very complex and extensive and few programs (if any)
that read or write these formats have implemented all of the
capabilities that are theoretically possible. As a result, there can be
considerable variation in how different programs interpret the
instructions for synthesizing a document contained in these formats.
Small differences in capability or interpretation can result in
documents that are visibly different.
1 2