Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GR_IMAGE_H
00021 #define GR_IMAGE_H
00022
00023 #include <memory>
00024 #include <string>
00025 #include "ut_types.h"
00026 #include "ut_bytebuf.h"
00027 #include "ut_string_class.h"
00028 #include "ut_misc.h"
00029 #include "ut_vector.h"
00030
00031 class GR_Graphics;
00032
00033 class ABI_EXPORT GR_Image_Point
00034 {
00035 public:
00036 GR_Image_Point(void) : m_iX(0),m_iY(0)
00037 {}
00038 UT_sint32 m_iX;
00039 UT_sint32 m_iY;
00040 };
00041
00042 class ABI_EXPORT GR_Image
00043 {
00044 public:
00045 GR_Image();
00046 virtual ~GR_Image();
00047
00048 virtual UT_sint32 getDisplayWidth(void) const;
00049 virtual UT_sint32 getDisplayHeight(void) const;
00050
00051 virtual bool convertToBuffer(UT_ConstByteBufPtr & ppBB) const = 0;
00052 virtual bool convertFromBuffer(const UT_ConstByteBufPtr & pBB, const std::string& mimetype, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight) = 0;
00058 virtual GR_Image * createImageSegment(GR_Graphics * pG, const UT_Rect & rec) = 0;
00059 virtual void scaleImageTo(GR_Graphics * pG, const UT_Rect & rec);
00060 void getName(char* szName) const;
00061 void getName ( std::string & name) const;
00062 void getName ( UT_String & copy ) const;
00066 virtual bool hasAlpha(void) const = 0;
00070 virtual bool isTransparentAt(UT_sint32 x, UT_sint32 y) = 0;
00071 void GenerateOutline(void);
00072 void DestroyOutline(void);
00073 UT_sint32 GetOffsetFromLeft(GR_Graphics * pG, UT_sint32 pad, UT_sint32 yTop, UT_sint32 height);
00074 UT_sint32 GetOffsetFromRight(GR_Graphics * pG, UT_sint32 pad, UT_sint32 yTop, UT_sint32 height);
00075
00076 bool isOutLinePresent(void) const
00077 { return (m_vecOutLine.getItemCount() > 0);}
00078 enum GRType {
00079 GRT_Unknown,
00080 GRT_Raster,
00081 GRT_Vector
00082 };
00083
00084 static GRType getBufferType(const UT_ConstByteBufPtr & pBB);
00085 virtual GRType getType() const;
00086 virtual bool render(GR_Graphics *pGR, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00087
00088 void setDisplaySize(UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight);
00089
00090 protected:
00091 void setName ( const char * szName );
00092 void setName ( const UT_String & szName );
00093
00094 private:
00095 std::string m_szName;
00096 UT_sint32 m_iDisplayWidth;
00097 UT_sint32 m_iDisplayHeight;
00098 UT_GenericVector<GR_Image_Point *> m_vecOutLine;
00099 };
00100
00101 class ABI_EXPORT GR_RasterImage : public GR_Image
00102 {
00103 public:
00104 virtual bool hasAlpha(void) const = 0;
00105 virtual bool isTransparentAt(UT_sint32 x, UT_sint32 y) = 0;
00106 virtual GRType getType() const { return GRT_Raster; }
00107 };
00108
00109 class ABI_EXPORT GR_ImageFactory
00110 {
00111 public:
00112 virtual ~GR_ImageFactory() {}
00113
00114 virtual GR_Image* createNewImage(const char* pszName, GR_Image::GRType iType = GR_Image::GRT_Raster) = 0;
00115 };
00116
00117 #include "gr_VectorImage.h"
00118
00119 #endif