pleyo.com

/src/trunk2/BAL/Implementations/ImageDecoders/Generic/PNG/PNGImageDecoder.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
00003  * Copyright (C) 2007 Pleyo.  All rights reserved.
00004  * 
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
00015  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
00018  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025  */
00026 
00027 #ifndef PNG_DECODER_H_
00028 #define PNG_DECODER_H_
00029 
00030 #include "BIImageDecoder.h"
00031 #include "ImageDecoderCommonImplementation.h"
00032 #include "ImageObserver.h"
00033 
00034 namespace BC {
00035 
00036 class PNGImageReader;
00037 
00038 // This class decodes the PNG image format.
00039 class BCPNGImageDecoder : public BAL::BIImageDecoder
00040 {
00041 public:
00042     BCPNGImageDecoder();
00043     ~BCPNGImageDecoder();
00044 
00045     // Take the data and store it.
00046     virtual void setData(const Vector<char>* data, bool allDataReceived);
00047 
00048     // Whether or not the size information has been decoded yet.
00049     virtual bool isSizeAvailable() const;
00050 
00051     virtual BAL::RGBA32Buffer* frameBufferAtIndex(size_t index);
00052 
00053     virtual bool supportsAlpha() const { return true; }
00054 
00055     virtual IntSize size() const { return mImageDecoderCommonImplementation.size(); }
00056 
00057     virtual int frameCount() { return 1; }
00058 
00059     virtual int repetitionCount() const { return WebCore::cAnimationNone; }
00060 
00061 public:
00062     void decode(bool sizeOnly = false) const;
00063 
00064     PNGImageReader* reader() { return m_reader; }
00065 
00066     // Callbacks from libpng
00067     void decodingFailed() { mImageDecoderCommonImplementation.setFailed( true ); }
00068     void headerAvailable();
00069     void rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, int interlacePass);
00070     void pngComplete();
00071 
00072 private:
00073     mutable PNGImageReader* m_reader;
00074 
00075     ImageDecoderCommonImplementation mImageDecoderCommonImplementation;
00076 };
00077 
00078 }
00079 
00080 #endif

Generated on Wed Nov 21 20:04:16 2007 for Origyn Web Browser by Doxygen 1.5.3

pleyo.com
pleyo.com