#include <gr_Image.h>
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_ConstByteBufPtr &ppBB) const =0 |
virtual bool | convertFromBuffer (const UT_ConstByteBufPtr &pBB, const std::string &mimetype, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight)=0 |
virtual GR_Image * | createImageSegment (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 ©) 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_ConstByteBufPtr &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 |
enum GR_Image::GRType |
GR_Image::GR_Image | ( | ) |
GR_Image::~GR_Image | ( | ) | [virtual] |
References DestroyOutline().
virtual bool GR_Image::convertFromBuffer | ( | const UT_ConstByteBufPtr & | pBB, | |
const std::string & | mimetype, | |||
UT_sint32 | iDisplayWidth, | |||
UT_sint32 | iDisplayHeight | |||
) | [pure virtual] |
Implemented in GR_CocoaImage, GR_RSVGVectorImage, GR_UnixImage, and GR_VectorImage.
Referenced by GR_UnixCairoGraphicsBase::createNewImage().
virtual bool GR_Image::convertToBuffer | ( | UT_ConstByteBufPtr & | ppBB | ) | const [pure virtual] |
Implemented in GR_CocoaImage, GR_RSVGVectorImage, GR_UnixImage, and GR_VectorImage.
Referenced by ODe_ThumbnailsWriter::writeThumbnails().
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_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_ConstByteBufPtr & | pBB | ) | [static] |
References UT_SVG_recognizeContent().
Referenced by GR_Graphics::createNewImage().
UT_sint32 GR_Image::getDisplayHeight | ( | void | ) | const [virtual] |
Returns the height of the image. Values in in device units.
References m_iDisplayHeight.
Referenced by fp_ImageRun::_lookupProperties(), GR_UnixImage::cairoSetSource(), GR_UnixCroppedImage::cairoSetSource(), GR_CocoaImage::cairoSetSource(), GR_Win32Image::createImageSegment(), GR_CairoRasterImage::createImageSegment(), GR_RSVGVectorImage::createImageSurface(), GR_RSVGVectorImage::createSurface(), GR_Win32Graphics::drawImage(), Presentation::drawNthPage(), FG_GraphicVector::generateImage(), GenerateOutline(), GR_UnixImage::makeSubimage(), GR_RSVGVectorImage::renderToSurface(), and XAP_Win32Dialog_About::s_dlgProc().
UT_sint32 GR_Image::getDisplayWidth | ( | void | ) | const [virtual] |
Returns the width of the image. Values in in device units.
References m_iDisplayWidth.
Referenced by fp_ImageRun::_lookupProperties(), GR_UnixImage::cairoSetSource(), GR_UnixCroppedImage::cairoSetSource(), GR_CocoaImage::cairoSetSource(), GR_Win32Image::createImageSegment(), GR_CairoRasterImage::createImageSegment(), GR_RSVGVectorImage::createImageSurface(), GR_RSVGVectorImage::createSurface(), GR_Win32Graphics::drawImage(), Presentation::drawNthPage(), FG_GraphicVector::generateImage(), GenerateOutline(), GetOffsetFromLeft(), GetOffsetFromRight(), GR_UnixImage::makeSubimage(), GR_RSVGVectorImage::renderToSurface(), and XAP_Win32Dialog_About::s_dlgProc().
void GR_Image::getName | ( | std::string & | name | ) | const |
References m_szName.
void GR_Image::getName | ( | char * | szName | ) | const |
References m_szName, and UT_ASSERT.
Referenced by GR_Win32Image::createImageSegment(), GR_CairoRasterImage::createImageSegment(), and GR_RSVGVectorImage::renderToSurface().
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] |
Reimplemented in GR_CocoaImage, GR_UnixImage, GR_RasterImage, and GR_VectorImage.
Referenced by GR_Win32Graphics::drawImage(), and GR_CairoGraphics::drawImage().
virtual bool GR_Image::hasAlpha | ( | void | ) | const [pure virtual] |
Returns true if the image has any alpha in it.
Implemented in GR_CocoaImage, GR_RSVGVectorImage, GR_UnixImage, GR_Win32Image, GR_RasterImage, and GR_VectorImage.
Referenced by fp_ImageRun::_draw(), GetOffsetFromLeft(), and GetOffsetFromRight().
bool GR_Image::isOutLinePresent | ( | void | ) | const [inline] |
Referenced by GetOffsetFromLeft(), and GetOffsetFromRight().
Returns true if pixel at point (x,y) in device units is transparent.
Implemented in GR_CocoaImage, 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] |
Reimplemented in GR_CocoaImage, and GR_VectorImage.
References UT_ASSERT_NOT_REACHED.
Referenced by GR_Win32Graphics::drawImage(), and GR_Graphics::drawImage().
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_RSVGVectorImage, and GR_UnixImage.
References UT_Rect::height, setDisplaySize(), GR_Graphics::tdu(), and UT_Rect::width.
Referenced by fl_DocSectionLayout::addOwnedPage(), fl_SectionLayout::checkGraphicTick(), FG_GraphicVector::generateImage(), fl_CellLayout::setCellContainerProperties(), and fl_FrameLayout::setContainerProperties().
Sets the display dimentions of the image. This does not perform any scaling on the image, it just stores the values. Values in device units.
References m_iDisplayHeight, m_iDisplayWidth, and xxx_UT_DEBUGMSG.
Referenced by GR_Win32Image::_convertFromJPEG(), GR_Win32Image::_convertFromPNG(), GR_VectorImage::convertFromBuffer(), GR_UnixImage::convertFromBuffer(), GR_CocoaImage::convertFromBuffer(), GR_Win32Image::createImageSegment(), GR_CairoRasterImage::createImageSegment(), GR_UnixCairoGraphics::genImageFromRectangle(), GR_UnixImage::GR_UnixImage(), GR_UnixImage::makeSubimage(), GR_UnixImage::scale(), scaleImageTo(), GR_Win32Image::setDIB(), and GR_RSVGVectorImage::setupScale().
void GR_Image::setName | ( | const UT_String & | szName | ) | [protected] |
References UT_String::c_str(), and m_szName.
void GR_Image::setName | ( | const char * | szName | ) | [protected] |
UT_sint32 GR_Image::m_iDisplayHeight [private] |
Referenced by getDisplayHeight(), and setDisplaySize().
UT_sint32 GR_Image::m_iDisplayWidth [private] |
Referenced by getDisplayWidth(), and setDisplaySize().
std::string GR_Image::m_szName [private] |
UT_GenericVector<GR_Image_Point *> GR_Image::m_vecOutLine [private] |
Referenced by DestroyOutline(), GenerateOutline(), GetOffsetFromLeft(), and GetOffsetFromRight().