From: Sylvain Bougnoux Date: Mon, 20 Sep 1999 09:03:37 +0000 (+0000) Subject: Add wxImage::InitAllHandlers() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a14e57f9f7d2e2b3b5d5aa7bf323efe907485408 Add wxImage::InitAllHandlers() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/image.tex b/docs/latex/wx/image.tex index fb4e77ba28..3184dd7479 100644 --- a/docs/latex/wx/image.tex +++ b/docs/latex/wx/image.tex @@ -274,19 +274,33 @@ Gets the width of the image in pixels. Returns TRUE if there is a mask active, FALSE otherwise. +\membersection{wxImage::InitAllHandlers}\label{wximageinitallhandlers} + +\func{static void}{InitAllHandlers}{\void} + +Adds some common image format handlers, which, depending on wxWindows +configuration, can be handlers for BMP (loading) (always installed), GIF +(loading and saving), PCX (loading and saving), PNM (loading and saving as raw +rgb), PNG (loading and saving), JPEG (loading and saving), file formats. + +\wxheading{See also} + +\helpref{wxImageHandler}{wximagehandler} + \membersection{wxImage::InitStandardHandlers} \func{static void}{InitStandardHandlers}{\void} -Adds the standard image format handlers, which, depending on wxWindows -configuration, can be handlers for Windows BMP (loading), PNG -(loading and saving) and JPEG (loading and saving) file formats. +Internal use only. Adds standard image format handlers. It only install BMP +for the time being, which is use by wxBitmap. -This function is called by wxWindows on startup. +This function is called by wxWindows on startup, and shouldn't be called by +the user. \wxheading{See also} \helpref{wxImageHandler}{wximagehandler} +\helpref{wxImage::InitAllHandlers}{wximageinitallhandlers} \membersection{wxImage::InsertHandler} @@ -303,11 +317,13 @@ of a given handler class in an application session.} \membersection{wxImage::LoadFile}\label{wximageloadfile} -\func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type}} +\func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}} \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{const wxString\&}{ mimetype}} -Loads an image from a file. +Loads an image from a file. If no handler type is provided, the library will +try to use wxBITMAP\_TYPE\_BMP or all known handlers previously installed +through a call to \helpref{wxImage::InitAllHandlers}{wximageinitallhandlers}. \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{long}{ type}} @@ -328,8 +344,11 @@ The meaning of {\it stream} data is determined by the {\it type} parameter.} \twocolwidtha{5cm}% \begin{twocollist} \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows image file.} -\twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.} +\twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF image file.} \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Load a JPEG image file.} +\twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Load a PCX image file.} +\twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.} +\twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Load a PNM image file.} \end{twocollist} The validity of these flags depends on the platform and wxWindows configuration.} diff --git a/include/wx/image.h b/include/wx/image.h index 9c503f0a55..cb20ca4bc2 100644 --- a/include/wx/image.h +++ b/include/wx/image.h @@ -356,6 +356,7 @@ public: static void CleanUpHandlers(); static void InitStandardHandlers(); + static void InitAllHandlers(); protected: diff --git a/src/common/image.cpp b/src/common/image.cpp index ab36e52be6..b0b91397f9 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -610,6 +610,25 @@ void wxImage::InitStandardHandlers() AddHandler( new wxBMPHandler ); } +void wxImage::InitAllHandlers() +{ +#if wxUSE_LIBPNG + AddHandler( new wxPNGHandler ); +#endif +#if wxUSE_LIBJPEG + AddHandler( new wxJPEGHandler ); +#endif +#if wxUSE_GIF + AddHandler( new wxGIFHandler ); +#endif +#if wxUSE_PNM + AddHandler( new wxPNMHandler ); +#endif +#if wxUSE_PCX + AddHandler( new wxPCXHandler ); +#endif +} + void wxImage::CleanUpHandlers() { wxNode *node = sm_handlers.First();