GR_Image Class Reference

#include <gr_Image.h>

Inheritance diagram for GR_Image:

GR_RasterImage GR_VectorImage GR_CairoImage GR_CocoaImage GR_UnixImage GR_Win32Image GR_UnixCairoImage

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
virtual bool convertFromBuffer (const UT_ByteBuf *pBB, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight)
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 (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

UT_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

UT_sint32 GR_Image::getDisplayWidth ( void   )  const [virtual]

UT_sint32 GR_Image::getDisplayHeight ( void   )  const [virtual]

bool GR_Image::convertToBuffer ( UT_ByteBuf **  ppBB  )  const [virtual]

bool GR_Image::convertFromBuffer ( const UT_ByteBuf pBB,
UT_sint32  iDisplayWidth,
UT_sint32  iDisplayHeight 
) [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_CocoaImage, GR_UnixImage, GR_Win32Image, and GR_VectorImage.

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

void GR_Image::scaleImageTo ( GR_Graphics pG,
const UT_Rect rec 
) [virtual]

Scale our image to rectangle given by rec. The dimensions of rec are calculated in logical units. Overriden by platform implementation if needed. Default is to set display size.

Reimplemented in GR_UnixImage.

References UT_Rect::height, setDisplaySize(), GR_Graphics::tdu(), and UT_Rect::width.

Referenced by fg_FillType::_regenerateImage(), fl_DocSectionLayout::addOwnedPage(), fl_SectionLayout::checkGraphicTick(), GOComponentView::render(), GOChartView::render(), fl_CellLayout::setCellContainerProperties(), fl_FrameLayout::setContainerProperties(), fg_FillType::setHeight(), fg_FillType::setWidth(), and fg_FillType::setWidthHeight().

void GR_Image::getName ( char *  szName  )  const

void GR_Image::getName ( UT_String copy  )  const

References m_szName.

virtual bool GR_Image::hasAlpha ( void   )  const [pure virtual]

Returns true if the image has any alpha in it.

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

Referenced by GetOffsetFromLeft(), and GetOffsetFromRight().

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_CairoImage, GR_UnixImage, GR_Win32Image, GR_RasterImage, and GR_VectorImage.

Referenced by GenerateOutline().

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().

void GR_Image::DestroyOutline ( void   ) 

Destroy the outline

References m_vecOutLine, and UT_VECTOR_PURGEALL.

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

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().

bool GR_Image::isOutLinePresent ( void   )  const [inline]

GR_Image::GRType GR_Image::getBufferType ( const UT_ByteBuf pBB  )  [static]

GR_Image::GRType GR_Image::getType ( void   )  const [virtual]

bool GR_Image::render ( GR_Graphics pGR,
UT_sint32  iDisplayWidth,
UT_sint32  iDisplayHeight 
) [virtual]

void GR_Image::setDisplaySize ( UT_sint32  iDisplayWidth,
UT_sint32  iDisplayHeight 
)

void GR_Image::setName ( const char *  szName  )  [protected]

void GR_Image::setName ( const UT_String szName  )  [protected]

References m_szName.


Member Data Documentation

Referenced by getName(), and setName().

Referenced by getDisplayWidth(), and setDisplaySize().

Referenced by getDisplayHeight(), and setDisplaySize().


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

Generated on Fri Nov 21 00:07:05 2008 for AbiWord by  doxygen 1.5.5