File indexing completed on 2024-04-21 14:57:38

0001 /*
0002     Large image displaying library.
0003 
0004     Copyright (C) 2004 Maks Orlovich (maksim@kde.org)
0005 
0006     Permission is hereby granted, free of charge, to any person obtaining a copy
0007     of this software and associated documentation files (the "Software"), to deal
0008     in the Software without restriction, including without limitation the rights
0009     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0010     copies of the Software, and to permit persons to whom the Software is
0011     furnished to do so, subject to the following conditions:
0012 
0013     The above copyright notice and this permission notice shall be included in
0014     all copies or substantial portions of the Software.
0015 
0016     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0017     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0018     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0019     AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0020     AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0021     CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0022 
0023 */
0024 
0025 #ifndef IMAGE_LOADER_PROVIDER_H
0026 #define IMAGE_LOADER_PROVIDER_H
0027 
0028 #include <QByteArray>
0029 
0030 namespace khtmlImLoad
0031 {
0032 
0033 class ImageLoader;
0034 /**
0035 To register new image formats, new copies of ImageLoaderProvider's must be
0036 created and registered with ImageManager::loaderDatabase().
0037 */
0038 class ImageLoaderProvider
0039 {
0040 public:
0041     virtual ~ImageLoaderProvider() {}
0042     enum Type {
0043         Efficient,
0044         Foreign
0045     };
0046 
0047     /**
0048      Returns the type of the loader. An "efficient" loader does not duplicate any data, and will therefore be preferred;
0049      while a "foreign" loader has to duplicate a large amount of image data to fit in w/the original
0050      framework, and should therefore only be used when a better loader is not available
0051     */
0052     virtual Type type() = 0;
0053 
0054     /**
0055      Creates a loader for an image format that can decode a file starting with given data, or 0 if that's not possible.
0056     */
0057     virtual ImageLoader *loaderFor(const QByteArray &prefix) = 0;
0058 };
0059 
0060 }
0061 
0062 #endif