pleyo.com

/src/trunk2/BAL/Interfaces/graphics/ImageSource.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004, 2005, 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 ImageSource_h
00028 #define ImageSource_h
00029 
00030 #include <wtf/Noncopyable.h>
00031 #include <wtf/Vector.h>
00032 
00033 #ifdef  __OWB__
00034 namespace BAL {
00035 class BIImageDecoder;
00036 class RGBA32Buffer;
00037 class BINativeImage;
00038 }
00039 using BAL::BIImageDecoder;
00040 #endif // __OWB__
00041 
00042 #if PLATFORM(CG)
00043 typedef struct CGImageSource* CGImageSourceRef;
00044 typedef struct CGImage* CGImageRef;
00045 typedef const struct __CFData* CFDataRef;
00046 #elif PLATFORM(QT)
00047 class QPixmap;
00048 #elif PLATFORM(CAIRO)
00049 struct _cairo_surface;
00050 typedef struct _cairo_surface cairo_surface_t;
00051 #endif
00052 
00053 namespace WebCore {
00054 
00055 class IntSize;
00056 class SharedBuffer;
00057 
00058 #if PLATFORM(CG)
00059 typedef CGImageSourceRef NativeImageSourcePtr;
00060 typedef CGImageRef NativeImagePtr;
00061 #elif PLATFORM(QT)
00062 class ImageDecoderQt;
00063 typedef ImageDecoderQt* NativeImageSourcePtr;
00064 typedef QPixmap* NativeImagePtr;
00065 #elif defined(__OWB__)
00066 typedef BAL::BIImageDecoder* NativeImageSourcePtr;
00067 typedef const Vector<char>* NativeBytePtr;
00068 typedef BAL::BINativeImage* NativeImagePtr;
00069 #else
00070 class ImageDecoder;
00071 typedef ImageDecoder* NativeImageSourcePtr;
00072 typedef cairo_surface_t* NativeImagePtr;
00073 #endif
00074 
00075 #ifndef __OWB__ // moved to ImageObserver.h
00076 const int cAnimationLoopOnce = -1;
00077 const int cAnimationNone = -2;
00078 #endif //__OWB__
00079 
00080 class ImageSource : Noncopyable {
00081 public:
00082     ImageSource();
00083     ~ImageSource();
00084 
00085     void clear();
00086 
00087     bool initialized() const;
00088     
00089     void setData(SharedBuffer* data, bool allDataReceived);
00090 
00091     bool isSizeAvailable();
00092     IntSize size() const;
00093     
00094     int repetitionCount();
00095     
00096     size_t frameCount() const;
00097     
00098     NativeImagePtr createFrameAtIndex(size_t);
00099     
00100     float frameDurationAtIndex(size_t);
00101     bool frameHasAlphaAtIndex(size_t); // Whether or not the frame actually used any alpha.
00102     bool frameIsCompleteAtIndex(size_t); // Whether or not the frame is completely decoded.
00103 
00104 private:
00105     NativeImageSourcePtr m_decoder;
00106 };
00107 
00108 }
00109 
00110 #endif

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

pleyo.com
pleyo.com