Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes

GR_Image Class Reference

#include <gr_Image.h>

Inheritance diagram for GR_Image:
GR_RasterImage GR_VectorImage GR_CairoRasterImage GR_Win32Image GR_CairoVectorImage GR_CocoaImage GR_UnixImage GR_UnixImage GR_RSVGVectorImage GR_RSVGVectorImage

List of all members.

Public Types

enum  GRType { GRT_Unknown, GRT_Raster, GRT_Vector }

Public Member Functions

 GR_Image ()
virtual ~GR_Image ()
virtual UT_sint32 getDisplayWidth (void) const
virtual UT_sint32 getDisplayHeight (void) const
virtual bool convertToBuffer (UT_ByteBuf **ppBB) const =0
virtual bool convertFromBuffer (const UT_ByteBuf *pBB, const std::string &mimetype, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight)=0
virtual GR_ImagecreateImageSegment (GR_Graphics *pG, const UT_Rect &rec)=0
virtual void scaleImageTo (GR_Graphics *pG, const UT_Rect &rec)
void getName (char *szName) const
void getName (std::string &name) const
void getName (UT_String &copy) const
virtual bool hasAlpha (void) const =0
virtual bool isTransparentAt (UT_sint32 x, UT_sint32 y)=0
void GenerateOutline (void)
void DestroyOutline (void)
UT_sint32 GetOffsetFromLeft (GR_Graphics *pG, UT_sint32 pad, UT_sint32 yTop, UT_sint32 height)
UT_sint32 GetOffsetFromRight (GR_Graphics *pG, UT_sint32 pad, UT_sint32 yTop, UT_sint32 height)
bool isOutLinePresent (void) const
virtual GRType getType () const
virtual bool render (GR_Graphics *pGR, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight)
void setDisplaySize (UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight)

Static Public Member Functions

static GRType getBufferType (const UT_ByteBuf *pBB)

Protected Member Functions

void setName (const char *szName)
void setName (const UT_String &szName)

Private Attributes

std::string m_szName
UT_sint32 m_iDisplayWidth
UT_sint32 m_iDisplayHeight
UT_GenericVector
< GR_Image_Point * > 
m_vecOutLine

Member Enumeration Documentation

Enumerator:
GRT_Unknown 
GRT_Raster 
GRT_Vector 

Constructor & Destructor Documentation

GR_Image::GR_Image (  ) 
GR_Image::~GR_Image (  )  [virtual]

References DestroyOutline().


Member Function Documentation

virtual bool GR_Image::convertFromBuffer ( const UT_ByteBuf pBB,
const std::string &  mimetype,
UT_sint32  iDisplayWidth,
UT_sint32  iDisplayHeight 
) [pure virtual]
virtual bool GR_Image::convertToBuffer ( UT_ByteBuf **  ppBB  )  const [pure virtual]
virtual GR_Image* GR_Image::createImageSegment ( GR_Graphics pG,
const UT_Rect rec 
) [pure virtual]

This should be overridden by platform code. The idea is to create a new image from the rectangular segment in device units defined by UT_Rect rec. The Image should be deleted by the calling routine.

Implemented in GR_RSVGVectorImage, GR_RSVGVectorImage, GR_Win32Image, GR_CairoRasterImage, and GR_VectorImage.

Referenced by FV_FrameEdit::drawFrame(), and GR_Graphics::fillRect().

void GR_Image::DestroyOutline ( void   ) 

Destroy the outline

References m_vecOutLine, and UT_VECTOR_PURGEALL.

Referenced by GenerateOutline(), and ~GR_Image().

void GR_Image::GenerateOutline ( void   ) 

Generate an outline of an image with transparency. This is a collection of (x,y) points marking the first non-transparent point from the left and right side of the image. This outline is used by GetOffsetFromLeft and facitates "tight" text wrapping around objects.

References UT_GenericVector< T >::addItem(), DestroyOutline(), getDisplayHeight(), getDisplayWidth(), isTransparentAt(), GR_Image_Point::m_iX, GR_Image_Point::m_iY, and m_vecOutLine.

Referenced by GetOffsetFromLeft(), and GetOffsetFromRight().

GR_Image::GRType GR_Image::getBufferType ( const UT_ByteBuf pBB  )  [static]
void GR_Image::getName ( std::string &  name  )  const

References m_szName.

void GR_Image::getName ( UT_String copy  )  const

References m_szName.

void GR_Image::getName ( char *  szName  )  const
UT_sint32 GR_Image::GetOffsetFromLeft ( GR_Graphics pG,
UT_sint32  pad,
UT_sint32  yTop,
UT_sint32  height 
)

Return the distance from the left side of the image that is "pad" distance to the nearest point in the transparent outline from the line segment start at Y and running for distance Height below it. All distances are in logical units. ----------------- | | | * | | ***** | |||||| *** | | | ** | |---------------| | | | |

This case would give a -ve distance. The input yTop is in logical units as measured from the top of the image. If y is above the image it should be negative. The returned value is in logical units.

References d, GenerateOutline(), getDisplayWidth(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), hasAlpha(), isOutLinePresent(), GR_Image_Point::m_iX, GR_Image_Point::m_iY, m_vecOutLine, GR_Graphics::tdu(), and GR_Graphics::tlu().

Referenced by fp_FrameContainer::getLeftPad(), and fp_FrameContainer::overlapsRect().

UT_sint32 GR_Image::GetOffsetFromRight ( GR_Graphics pG,
UT_sint32  pad,
UT_sint32  yTop,
UT_sint32  height 
)

Return the distance from the right side of the image that is "pad" distance to the nearest point in the transparent outline from the line segment start at Y and running for distance Height below it. All distances are in logical units. ----------------- | | | * | | ***** | | *** |||||||| | ** | | |------------|--| | | | | This distance is negative The input yTop is in logical units as measured from the top of the image. If y is above the image it should be negative. The returned value is in logical units.

References d, GenerateOutline(), getDisplayWidth(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), hasAlpha(), isOutLinePresent(), GR_Image_Point::m_iX, GR_Image_Point::m_iY, m_vecOutLine, GR_Graphics::tdu(), GR_Graphics::tlu(), and xxx_UT_DEBUGMSG.

Referenced by fp_FrameContainer::getRightPad(), and fp_FrameContainer::overlapsRect().

GR_Image::GRType GR_Image::getType ( void   )  const [virtual]
virtual bool GR_Image::hasAlpha ( void   )  const [pure virtual]
bool GR_Image::isOutLinePresent ( void   )  const [inline]
virtual bool GR_Image::isTransparentAt ( UT_sint32  x,
UT_sint32  y 
) [pure virtual]

Returns true if pixel at point (x,y) in device units is transparent.

Implemented in GR_CocoaImage, GR_RSVGVectorImage, GR_UnixImage, GR_RSVGVectorImage, GR_UnixImage, GR_Win32Image, GR_RasterImage, and GR_VectorImage.

Referenced by GenerateOutline().

bool GR_Image::render ( GR_Graphics pGR,
UT_sint32  iDisplayWidth,
UT_sint32  iDisplayHeight 
) [virtual]
void GR_Image::scaleImageTo ( GR_Graphics pG,
const UT_Rect rec 
) [virtual]
void GR_Image::setName ( const UT_String szName  )  [protected]

References UT_String::c_str(), and m_szName.


Member Data Documentation

std::string GR_Image::m_szName [private]

Referenced by getName(), and setName().


The documentation for this class was generated from the following files: