本文整理汇总了C++中TBLOB::Scale方法的典型用法代码示例。如果您正苦于以下问题:C++ TBLOB::Scale方法的具体用法?C++ TBLOB::Scale怎么用?C++ TBLOB::Scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBLOB
的用法示例。
在下文中一共展示了TBLOB::Scale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Normalize
// Normalize in-place and record the normalization in the DENORM.
void TWERD::Normalize(ROW* row, float x_height, bool numeric_mode,
DENORM* denorm) {
TBOX word_box = bounding_box();
DENORM antidote((word_box.left() + word_box.right()) / 2.0,
kBlnXHeight / x_height, row);
if (row == NULL) {
antidote = DENORM(antidote.origin(), antidote.scale(), 0.0,
word_box.bottom(), 0, NULL, false, NULL);
}
int num_segments = 0;
DENORM_SEG *segs = new DENORM_SEG[NumBlobs()];
for (TBLOB* blob = blobs; blob != NULL; blob = blob->next) {
TBOX blob_box = blob->bounding_box();
ICOORD translation(-static_cast<int>(floor(antidote.origin() + 0.5)),
-blob_box.bottom());
float factor = antidote.scale();
if (numeric_mode) {
factor = ClipToRange(kBlnXHeight * 4.0f / (3 * blob_box.height()),
factor, factor * 1.5f);
segs[num_segments].xstart = blob->bounding_box().left();
segs[num_segments].ycoord = blob_box.bottom();
segs[num_segments++].scale_factor = factor;
} else {
float blob_x_center = (blob_box.left() + blob_box.right()) / 2.0;
float y_shift = antidote.yshift_at_orig_x(blob_x_center);
translation.set_y(-static_cast<int>(floor(y_shift + 0.5)));
}
blob->Move(translation);
blob->Scale(factor);
blob->Move(ICOORD(0, kBlnBaselineOffset));
}
if (num_segments > 0) {
antidote.set_segments(segs, num_segments);
}
delete [] segs;
if (denorm != NULL)
*denorm = antidote;
}