本文整理汇总了C++中CImage::CopyFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ CImage::CopyFrom方法的具体用法?C++ CImage::CopyFrom怎么用?C++ CImage::CopyFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImage
的用法示例。
在下文中一共展示了CImage::CopyFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pageChanged
void PDFwin::pageChanged()
{
int ww=w()-2;
int hh=h()-2;
if(!mModel) return;
if(!mModel->cacheValid(ww, hh, mCurrPage))
{
mState="load";
redraw();
Fl::check();
mState="none";
}
CImage* bmp_orig=mModel->getPage(ww, hh, mCurrPage);
if(mLayout->findCheckButton("Use automatic segmentation")->value())
{
CImage temp;
temp.CopyFrom(*bmp_orig);
#ifdef DEBUG_FONT_DETECTION
CImage* bmp=bmp_orig;
#else
CImage* bmp=&temp;
#endif
{
intmatrixn& textCache=*mModel->_textCache[mCurrPage];
#ifdef USE_FONT_DETECTION
const bool drawLetterBoundingBox=true;
const bool drawDetectedSpace=true;
#else
const bool drawLetterBoundingBox=false;
const bool drawDetectedSpace=false;
#endif
if(drawLetterBoundingBox)
{
CImagePixel ip(bmp);
for(int i=0; i<textCache.rows()-1; i++)
{
int* info=textCache[i];
int c=info[TC_c];
int x=info[TC_x];
int y=info[TC_y];
int w=info[TC_w];
int h=info[TC_h];
int fx=info[TC_fx];
int fy=info[TC_fy];
if (std::abs(y-textCache[i+1][TC_y])<=3) // draw excluding trailing space
{
#ifdef DEBUG_FONT_DETECTION
ip.DrawLineBox(TRect(x-fx,y-fy, x-fx+w, y-fy+h), CPixelRGB8(0,0,0));
#else
ip.DrawBox(TRect(x-fx,y-fy, x-fx+w, y-fy+h), CPixelRGB8(0,0,0));
#endif
ip.DrawHorizLine(x, y, w, CPixelRGB8(255,0,0));
}
// else printf("%d %d %d %d\n", x,y, textCache[i+1][TC_x], textCache[i+1][TC_y]);
}
}
FlLayout* layout=mLayout->findLayout("Automatic segmentation");
double min_text_gap=layout->findSlider("MIN text-gap")->value();
if(drawDetectedSpace)
{
CImagePixel ip(bmp);
for(int i=1; i<textCache.rows(); i++)
{
int* pinfo=textCache[i-1];
int* info=textCache[i];
if(pinfo[TC_y]==info[TC_y])
{
int prevEnd=pinfo[TC_x]-pinfo[TC_fx]+pinfo[TC_w]-1;
int curStart=info[TC_x]-info[TC_fx];
int bottom=MIN(pinfo[TC_y]-pinfo[TC_fy], info[TC_y]-info[TC_fy]);
int top=MAX(pinfo[TC_y]-pinfo[TC_fy]+pinfo[TC_h], info[TC_y]-info[TC_fy]+info[TC_h]);
int space_thr=MAX(pinfo[TC_h], pinfo[TC_w]);
space_thr=MAX(space_thr, info[TC_h]);
space_thr=MAX(space_thr, info[TC_w]);
space_thr*=min_text_gap;
if(curStart-prevEnd<=space_thr && curStart>prevEnd)
{
// mark as space.
ip.DrawBox(TRect(prevEnd, bottom, curStart, top), CPixelRGB8(0,0,0));
}
}
}
}
//.........这里部分代码省略.........