NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
IImageGrabber Class Reference

Search Toolkit Book for IImageGrabber

#include <gui/widgets/wx/image_grabber.hpp>

+ Inheritance diagram for IImageGrabber:
+ Collaboration diagram for IImageGrabber:

Public Types

enum  eCaptureResult { eSuccess =0 , eOpenGLError , eFileError , eError }
 
enum  eImageNumberingFormat { eSequentialFormat , eCartesionFormat }
 

Public Member Functions

 IImageGrabber ()
 
virtual ~IImageGrabber ()
 
virtual eCaptureResult GrabImages (int tex_size, IImageGrabberProgress *p=NULL)
 Grab the requested images. More...
 
eCaptureResult GrabImage (int tex_size, CVect2< int > img_idx, IImageGrabberProgress *p=NULL)
 Grab a single image for preview purposes. More...
 
eCaptureResult PreviewImages (int tex_size, int ref_img_width, int ref_img_height, IImageGrabberProgress *p=NULL)
 Grab images to update the on-screen image to approximate final output. More...
 
void SetPartitions (const CVect2< int > &p)
 Set number of desired image partitions. More...
 
void SetOutputInfo (const std::string &dir, const std::string &base_name, const std::string &img_format)
 Set file output information. More...
 
void SetNumberingFormat (eImageNumberingFormat fmt)
 Set the numbering format for sequential image names. More...
 
void SetTileAspectRatio (float ar)
 Set aspect ratio tiles captured. More...
 
void SetImageAspectRatio (float ar)
 Set aspect ratio for image as a whole. More...
 
void SetOutputFormat (const string &f)
 Set output format on which image aspect is based, e.g. A4, US Letter.. More...
 
void SetPrintingGuidesEnabled (bool b)
 Set to true to put cutting/printing guides on output images. More...
 
void DisableGouraudShading (bool b)
 Set to true force all triangles to be printed flat (no shadingtype 4) This makes the file compatible with Adobe Illustrator. More...
 
void SetTitleHeight (TModelUnit h)
 Set size for optional pdf title. More...
 
virtual void SetOutputStream (CNcbiOstream *ostr)
 

Protected Member Functions

void x_RenderGuides (CVect2< size_t > capture_size, const std::string &image_name, std::string image_bottom, std::string image_right, std::string image_top, std::string image_left)
 Render guides around image edge (cut marks + adjacent image names) More...
 
std::string x_GetImageName (int x, int y)
 Return image filename for a tile index based on the numbering scheme. More...
 
virtual void x_BeginCaptures (int)
 Called before first image captured. More...
 
virtual void x_EndCaptures ()
 Called after last image captured. More...
 
virtual eCaptureResult x_CaptureImage (CVect2< int > partitions, CVect2< int > index, CVect2< size_t > &capture_size)
 Must be subclassed to capture an individual image. More...
 

Protected Attributes

CVect2< intm_ImagePartitions
 Number of partitions (tilings) in x and 1. More...
 
std::string m_Directory
 Target directory for saved images. More...
 
std::string m_BaseImageName
 Image name without its appended number (e.g. img for img1, img2...) More...
 
std::string m_ImageFormat
 Image output format (e.g. jpeg, png...) More...
 
eImageNumberingFormat m_NumberingFormat
 Numbering format, such as sequential or tiled (x and y) More...
 
bool m_GuidesEnabled
 If true, printing guides (like where to cut paper) will be added to image edges. More...
 
int m_GuideWidthX
 If we are making space for printing guides (margins) on the sides, those margins may have different sizes (in x and y) if we are forcing a proportional output size. More...
 
int m_GuideWidthY
 
float m_TileAspectRatio
 Ratio of width to height (w/h) in captured images. More...
 
string m_OutputFormat
 Name of output format, e.g. A4, US Letter.. More...
 
float m_ImageAspectRatio
 Aspect ratio of image from which we are generating tiles. More...
 
bool m_DisableGouraudShaded
 If true, disable gouraud-shaded polys (shadingtype 4) More...
 
TModelUnit m_TitleHeight = TModelUnit(0)
 Allow space at the top for a title. More...
 
CIRef< IRenderm_SavedRender
 

Static Protected Attributes

static const int m_GuideWidth = 24
 Width of printing guides, if enabled. More...
 

Detailed Description

Definition at line 97 of file image_grabber.hpp.

Member Enumeration Documentation

◆ eCaptureResult

Enumerator
eSuccess 
eOpenGLError 
eFileError 
eError 

Definition at line 100 of file image_grabber.hpp.

◆ eImageNumberingFormat

Enumerator
eSequentialFormat 
eCartesionFormat 

Definition at line 102 of file image_grabber.hpp.

Constructor & Destructor Documentation

◆ IImageGrabber()

IImageGrabber::IImageGrabber ( )

◆ ~IImageGrabber()

IImageGrabber::~IImageGrabber ( )
virtual

Member Function Documentation

◆ DisableGouraudShading()

void IImageGrabber::DisableGouraudShading ( bool  b)
inline

Set to true force all triangles to be printed flat (no shadingtype 4) This makes the file compatible with Adobe Illustrator.

Definition at line 143 of file image_grabber.hpp.

References b, and m_DisableGouraudShaded.

◆ GrabImage()

IImageGrabber::eCaptureResult IImageGrabber::GrabImage ( int  tex_size,
CVect2< int img_idx,
IImageGrabberProgress p = NULL 
)

◆ GrabImages()

IImageGrabber::eCaptureResult IImageGrabber::GrabImages ( int  tex_size,
IImageGrabberProgress p = NULL 
)
virtual

◆ PreviewImages()

IImageGrabber::eCaptureResult IImageGrabber::PreviewImages ( int  tex_size,
int  ref_img_width,
int  ref_img_height,
IImageGrabberProgress p = NULL 
)

◆ SetImageAspectRatio()

void IImageGrabber::SetImageAspectRatio ( float  ar)
inline

Set aspect ratio for image as a whole.

Definition at line 136 of file image_grabber.hpp.

References m_ImageAspectRatio.

Referenced by CSaveImagesSetupDlg::OnPreview(), CSaveImagesSetupDlg::OnSave(), and CSaveImagesSetupDlg::OnTilePreview().

◆ SetNumberingFormat()

void IImageGrabber::SetNumberingFormat ( eImageNumberingFormat  fmt)
inline

Set the numbering format for sequential image names.

Definition at line 132 of file image_grabber.hpp.

References m_NumberingFormat.

Referenced by CSaveImagesSetupDlg::OnPreview(), CSaveImagesSetupDlg::OnSave(), and CSaveImagesSetupDlg::OnTilePreview().

◆ SetOutputFormat()

void IImageGrabber::SetOutputFormat ( const string f)
inline

Set output format on which image aspect is based, e.g. A4, US Letter..

Definition at line 138 of file image_grabber.hpp.

References f(), and m_OutputFormat.

◆ SetOutputInfo()

void IImageGrabber::SetOutputInfo ( const std::string dir,
const std::string base_name,
const std::string img_format 
)

◆ SetOutputStream()

virtual void IImageGrabber::SetOutputStream ( CNcbiOstream ostr)
inlinevirtual

Reimplemented in CSVGGrabber, and CPdfGrabber.

Definition at line 148 of file image_grabber.hpp.

◆ SetPartitions()

void IImageGrabber::SetPartitions ( const CVect2< int > &  p)
inline

Set number of desired image partitions.

Definition at line 126 of file image_grabber.hpp.

References m_ImagePartitions.

Referenced by CSaveImagesSetupDlg::OnPreview(), CSaveImagesSetupDlg::OnSave(), and CSaveImagesSetupDlg::OnTilePreview().

◆ SetPrintingGuidesEnabled()

void IImageGrabber::SetPrintingGuidesEnabled ( bool  b)
inline

Set to true to put cutting/printing guides on output images.

Definition at line 140 of file image_grabber.hpp.

References b, and m_GuidesEnabled.

Referenced by CSaveImagesSetupDlg::OnPreview(), CSaveImagesSetupDlg::OnSave(), and CSaveImagesSetupDlg::OnTilePreview().

◆ SetTileAspectRatio()

void IImageGrabber::SetTileAspectRatio ( float  ar)
inline

Set aspect ratio tiles captured.

Definition at line 134 of file image_grabber.hpp.

References m_TileAspectRatio.

Referenced by CSaveImagesSetupDlg::OnPreview(), CSaveImagesSetupDlg::OnSave(), and CSaveImagesSetupDlg::OnTilePreview().

◆ SetTitleHeight()

void IImageGrabber::SetTitleHeight ( TModelUnit  h)
inline

Set size for optional pdf title.

Definition at line 146 of file image_grabber.hpp.

References m_TitleHeight.

Referenced by CAlnMultiWidget::SaveVectorImage().

◆ x_BeginCaptures()

virtual void IImageGrabber::x_BeginCaptures ( int  )
inlineprotectedvirtual

Called before first image captured.

Reimplemented in CSVGGrabber, CPdfGrabber, CPhyloPdfGrabber, and CPhyloImageGrabber.

Definition at line 163 of file image_grabber.hpp.

Referenced by GrabImage(), GrabImages(), and PreviewImages().

◆ x_CaptureImage()

virtual eCaptureResult IImageGrabber::x_CaptureImage ( CVect2< int partitions,
CVect2< int index,
CVect2< size_t > &  capture_size 
)
inlineprotectedvirtual

Must be subclassed to capture an individual image.

Reimplemented in CPhyloImageGrabber.

Definition at line 167 of file image_grabber.hpp.

References eSuccess.

Referenced by GrabImage(), GrabImages(), and PreviewImages().

◆ x_EndCaptures()

virtual void IImageGrabber::x_EndCaptures ( )
inlineprotectedvirtual

Called after last image captured.

Reimplemented in CSVGGrabber, CPdfGrabber, CPhyloPdfGrabber, and CPhyloImageGrabber.

Definition at line 165 of file image_grabber.hpp.

Referenced by GrabImage(), GrabImages(), and PreviewImages().

◆ x_GetImageName()

std::string IImageGrabber::x_GetImageName ( int  x,
int  y 
)
protected

Return image filename for a tile index based on the numbering scheme.

Definition at line 434 of file image_grabber.cpp.

References eCartesionFormat, NStr::IntToString(), m_BaseImageName, m_ImageFormat, m_ImagePartitions, m_NumberingFormat, string, CVect2< T >::X(), and CVect2< T >::Y().

Referenced by GrabImage(), GrabImages(), and PreviewImages().

◆ x_RenderGuides()

void IImageGrabber::x_RenderGuides ( CVect2< size_t >  capture_size,
const std::string image_name,
std::string  image_bottom,
std::string  image_right,
std::string  image_top,
std::string  image_left 
)
protected

Member Data Documentation

◆ m_BaseImageName

std::string IImageGrabber::m_BaseImageName
protected

◆ m_Directory

std::string IImageGrabber::m_Directory
protected

◆ m_DisableGouraudShaded

bool IImageGrabber::m_DisableGouraudShaded
protected

If true, disable gouraud-shaded polys (shadingtype 4)

Definition at line 206 of file image_grabber.hpp.

Referenced by DisableGouraudShading(), CPdfGrabber::GrabImages(), and CSVGGrabber::GrabImages().

◆ m_GuidesEnabled

bool IImageGrabber::m_GuidesEnabled
protected

If true, printing guides (like where to cut paper) will be added to image edges.

Definition at line 185 of file image_grabber.hpp.

Referenced by GrabImage(), GrabImages(), PreviewImages(), SetPrintingGuidesEnabled(), and CPhyloImageGrabber::x_BeginCaptures().

◆ m_GuideWidth

const int IImageGrabber::m_GuideWidth = 24
staticprotected

Width of printing guides, if enabled.

Definition at line 187 of file image_grabber.hpp.

Referenced by CPhyloImageGrabber::x_BeginCaptures().

◆ m_GuideWidthX

int IImageGrabber::m_GuideWidthX
protected

If we are making space for printing guides (margins) on the sides, those margins may have different sizes (in x and y) if we are forcing a proportional output size.

These are those sizes (proportional or not)

Definition at line 192 of file image_grabber.hpp.

Referenced by CPhyloImageGrabber::x_BeginCaptures(), CPdfGrabber::x_BeginCaptures(), CSVGGrabber::x_BeginCaptures(), CPhyloImageGrabber::x_CaptureImage(), and x_RenderGuides().

◆ m_GuideWidthY

int IImageGrabber::m_GuideWidthY
protected

◆ m_ImageAspectRatio

float IImageGrabber::m_ImageAspectRatio
protected

Aspect ratio of image from which we are generating tiles.

Definition at line 203 of file image_grabber.hpp.

Referenced by SetImageAspectRatio(), and CPhyloImageGrabber::x_BeginCaptures().

◆ m_ImageFormat

std::string IImageGrabber::m_ImageFormat
protected

◆ m_ImagePartitions

CVect2<int> IImageGrabber::m_ImagePartitions
protected

Number of partitions (tilings) in x and 1.

If x and y are 0, then only a single image is saved.

Definition at line 174 of file image_grabber.hpp.

Referenced by GrabImage(), GrabImages(), PreviewImages(), SetPartitions(), CPhyloImageGrabber::x_BeginCaptures(), and x_GetImageName().

◆ m_NumberingFormat

eImageNumberingFormat IImageGrabber::m_NumberingFormat
protected

Numbering format, such as sequential or tiled (x and y)

Definition at line 182 of file image_grabber.hpp.

Referenced by SetNumberingFormat(), and x_GetImageName().

◆ m_OutputFormat

string IImageGrabber::m_OutputFormat
protected

Name of output format, e.g. A4, US Letter..

Definition at line 200 of file image_grabber.hpp.

Referenced by SetOutputFormat(), and CPhyloPdfGrabber::x_BeginCaptures().

◆ m_SavedRender

CIRef<IRender> IImageGrabber::m_SavedRender
protected

Definition at line 211 of file image_grabber.hpp.

Referenced by IImageGrabber(), and ~IImageGrabber().

◆ m_TileAspectRatio

float IImageGrabber::m_TileAspectRatio
protected

Ratio of width to height (w/h) in captured images.

If the ratio is < 0, then we subdivide the image evenly.

Definition at line 198 of file image_grabber.hpp.

Referenced by SetTileAspectRatio(), and CPhyloImageGrabber::x_BeginCaptures().

◆ m_TitleHeight

TModelUnit IImageGrabber::m_TitleHeight = TModelUnit(0)
protected

Allow space at the top for a title.

Definition at line 209 of file image_grabber.hpp.

Referenced by CPdfGrabber::GrabImages(), CSVGGrabber::GrabImages(), and SetTitleHeight().


The documentation for this class was generated from the following files:
Modified on Wed Sep 04 15:06:10 2024 by modify_doxy.py rev. 669887