Add wxImage::InitAllHandlers()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Sylvain Bougnoux
1999-09-20 09:03:37 +00:00
parent 45fcbf3b7a
commit a14e57f9f7
3 changed files with 49 additions and 10 deletions

View File

@@ -274,20 +274,34 @@ Gets the width of the image in pixels.
Returns TRUE if there is a mask active, FALSE otherwise. Returns TRUE if there is a mask active, FALSE otherwise.
\membersection{wxImage::InitStandardHandlers} \membersection{wxImage::InitAllHandlers}\label{wximageinitallhandlers}
\func{static void}{InitStandardHandlers}{\void} \func{static void}{InitAllHandlers}{\void}
Adds the standard image format handlers, which, depending on wxWindows Adds some common image format handlers, which, depending on wxWindows
configuration, can be handlers for Windows BMP (loading), PNG configuration, can be handlers for BMP (loading) (always installed), GIF
(loading and saving) and JPEG (loading and saving) file formats. (loading and saving), PCX (loading and saving), PNM (loading and saving as raw
rgb), PNG (loading and saving), JPEG (loading and saving), file formats.
This function is called by wxWindows on startup.
\wxheading{See also} \wxheading{See also}
\helpref{wxImageHandler}{wximagehandler} \helpref{wxImageHandler}{wximagehandler}
\membersection{wxImage::InitStandardHandlers}
\func{static void}{InitStandardHandlers}{\void}
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, and shouldn't be called by
the user.
\wxheading{See also}
\helpref{wxImageHandler}{wximagehandler}
\helpref{wxImage::InitAllHandlers}{wximageinitallhandlers}
\membersection{wxImage::InsertHandler} \membersection{wxImage::InsertHandler}
\func{static void}{InsertHandler}{\param{wxImageHandler*}{ handler}} \func{static void}{InsertHandler}{\param{wxImageHandler*}{ handler}}
@@ -303,11 +317,13 @@ of a given handler class in an application session.}
\membersection{wxImage::LoadFile}\label{wximageloadfile} \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}} \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}} \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}% \twocolwidtha{5cm}%
\begin{twocollist} \begin{twocollist}
\twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows image file.} \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\_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} \end{twocollist}
The validity of these flags depends on the platform and wxWindows configuration.} The validity of these flags depends on the platform and wxWindows configuration.}

View File

@@ -356,6 +356,7 @@ public:
static void CleanUpHandlers(); static void CleanUpHandlers();
static void InitStandardHandlers(); static void InitStandardHandlers();
static void InitAllHandlers();
protected: protected:

View File

@@ -610,6 +610,25 @@ void wxImage::InitStandardHandlers()
AddHandler( new wxBMPHandler ); 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() void wxImage::CleanUpHandlers()
{ {
wxNode *node = sm_handlers.First(); wxNode *node = sm_handlers.First();