openshot-audio  0.1.2
juce_ImageFileFormat.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_IMAGEFILEFORMAT_H_INCLUDED
26 #define JUCE_IMAGEFILEFORMAT_H_INCLUDED
27 
28 
29 //==============================================================================
40 {
41 protected:
42  //==============================================================================
45 
46 public:
48  virtual ~ImageFileFormat() {}
49 
50  //==============================================================================
55  virtual String getFormatName() = 0;
56 
67  virtual bool canUnderstand (InputStream& input) = 0;
68 
70  virtual bool usesFileExtension (const File& possibleFile) = 0;
71 
83  virtual Image decodeImage (InputStream& input) = 0;
84 
85  //==============================================================================
93  virtual bool writeImageToStream (const Image& sourceImage,
94  OutputStream& destStream) = 0;
95 
96  //==============================================================================
102  static ImageFileFormat* findImageFormatForStream (InputStream& input);
103 
108  static ImageFileFormat* findImageFormatForFileExtension (const File& file);
109 
110  //==============================================================================
118  static Image loadFrom (InputStream& input);
119 
127  static Image loadFrom (const File& file);
128 
136  static Image loadFrom (const void* rawData,
137  size_t numBytesOfData);
138 };
139 
140 //==============================================================================
147 {
148 public:
149  //==============================================================================
150  PNGImageFormat();
151  ~PNGImageFormat();
152 
153  //==============================================================================
154  String getFormatName() override;
155  bool usesFileExtension (const File&) override;
156  bool canUnderstand (InputStream&) override;
157  Image decodeImage (InputStream&) override;
158  bool writeImageToStream (const Image&, OutputStream&) override;
159 };
160 
161 
162 //==============================================================================
169 {
170 public:
171  //==============================================================================
172  JPEGImageFormat();
173  ~JPEGImageFormat();
174 
175  //==============================================================================
181  void setQuality (float newQuality);
182 
183  //==============================================================================
184  String getFormatName() override;
185  bool usesFileExtension (const File&) override;
186  bool canUnderstand (InputStream&) override;
187  Image decodeImage (InputStream&) override;
188  bool writeImageToStream (const Image&, OutputStream&) override;
189 
190 private:
191  float quality;
192 };
193 
194 //==============================================================================
201 {
202 public:
203  //==============================================================================
204  GIFImageFormat();
205  ~GIFImageFormat();
206 
207  //==============================================================================
208  String getFormatName() override;
209  bool usesFileExtension (const File&) override;
210  bool canUnderstand (InputStream&) override;
211  Image decodeImage (InputStream&) override;
212  bool writeImageToStream (const Image&, OutputStream&) override;
213 };
214 
215 
216 #endif // JUCE_IMAGEFILEFORMAT_H_INCLUDED
Definition: juce_ImageFileFormat.h:39
Definition: juce_InputStream.h:41
Definition: juce_ImageFileFormat.h:200
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
virtual bool writeImageToStream(const Image &sourceImage, OutputStream &destStream)=0
virtual ~ImageFileFormat()
Definition: juce_ImageFileFormat.h:48
Definition: juce_OutputStream.h:42
virtual bool canUnderstand(InputStream &input)=0
Definition: juce_ImageFileFormat.h:146
virtual bool usesFileExtension(const File &possibleFile)=0
virtual String getFormatName()=0
virtual Image decodeImage(InputStream &input)=0
Definition: juce_ImageFileFormat.h:168
Definition: juce_Image.h:54
ImageFileFormat()
Definition: juce_ImageFileFormat.h:44
Definition: juce_File.h:45