page block
More...
#include <pdblock.h>
List of all members.
Detailed Description
page block
Definition at line 35 of file pdblock.h.
Constructor & Destructor Documentation
PDBLK::PDBLK |
( |
| ) |
[inline] |
empty constructor
Definition at line 41 of file pdblock.h.
PDBLK::~PDBLK |
( |
| ) |
[inline] |
Member Function Documentation
void PDBLK::bounding_box |
( |
ICOORD & |
bottom_left, |
|
|
ICOORD & |
top_right |
|
) |
| const [inline] |
const TBOX& PDBLK::bounding_box |
( |
| ) |
const [inline] |
int PDBLK::index |
( |
| ) |
const [inline] |
void PDBLK::move |
( |
const ICOORD |
vec | ) |
|
reposition block
Definition at line 115 of file pdblock.cpp.
{
ICOORDELT_IT it(&leftside);
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
*(it.data ()) += vec;
it.set_to_list (&rightside);
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
*(it.data ()) += vec;
box.move (vec);
}
draw histogram
- Parameters:
-
window | window to draw in |
serial | serial number |
colour | colour to draw in |
Definition at line 181 of file pdblock.cpp.
{
ICOORD startpt;
ICOORD endpt;
ICOORD prevpt;
ICOORDELT_IT it = &leftside;
window->Pen(colour);
window->TextAttributes("Times", BLOCK_LABEL_HEIGHT, false, false, false);
if (hand_poly != NULL) {
hand_poly->plot(window, serial);
} else if (!leftside.empty ()) {
startpt = *(it.data ());
char temp_buff[34];
#ifdef __UNIX__
sprintf(temp_buff, INT32FORMAT, serial);
#else
ultoa (serial, temp_buff, 10);
#endif
window->Text(startpt.x (), startpt.y (), temp_buff);
window->SetCursor(startpt.x (), startpt.y ());
do {
prevpt = *(it.data ());
it.forward ();
window->DrawTo(prevpt.x (), it.data ()->y ());
window->DrawTo(it.data ()->x (), it.data ()->y ());
}
while (!it.at_last ());
endpt = *(it.data ());
window->SetCursor(startpt.x (), startpt.y ());
it.set_to_list (&rightside);
prevpt = startpt;
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
window->DrawTo(prevpt.x (), it.data ()->y ());
window->DrawTo(it.data ()->x (), it.data ()->y ());
prevpt = *(it.data ());
}
window->DrawTo(endpt.x(), endpt.y());
}
}
Pix * PDBLK::render_mask |
( |
const FCOORD & |
rerotation | ) |
|
Definition at line 133 of file pdblock.cpp.
{
TBOX rotated_box(box);
rotated_box.rotate(rerotation);
Pix* pix = pixCreate(rotated_box.width(), rotated_box.height(), 1);
if (hand_poly != NULL) {
ICOORDELT_LIST polygon;
polygon.deep_copy(hand_poly->points(), ICOORDELT::deep_copy);
POLY_BLOCK image_block(&polygon, hand_poly->isA());
image_block.rotate(rerotation);
PB_LINE_IT *lines = new PB_LINE_IT(&image_block);
for (int y = box.bottom(); y < box.top(); ++y) {
ICOORDELT_LIST* segments = lines->get_line(y);
if (!segments->empty()) {
ICOORDELT_IT s_it(segments);
for (s_it.mark_cycle_pt(); !s_it.cycled_list(); s_it.forward()) {
int start = s_it.data()->x();
int xext = s_it.data()->y();
pixRasterop(pix, start - rotated_box.left(),
rotated_box.height() - 1 - (y - rotated_box.bottom()),
xext, 1, PIX_SET, NULL, 0, 0);
}
}
delete segments;
}
delete lines;
} else {
pixRasterop(pix, 0, 0, rotated_box.width(), rotated_box.height(),
PIX_SET, NULL, 0, 0);
}
return pix;
}
void PDBLK::set_index |
( |
int |
value | ) |
[inline] |
void PDBLK::set_poly_block |
( |
POLY_BLOCK * |
blk | ) |
[inline] |
set the poly block
Definition at line 66 of file pdblock.h.
void PDBLK::set_sides |
( |
ICOORDELT_LIST * |
left, |
|
|
ICOORDELT_LIST * |
right |
|
) |
| |
set vertex lists
- Parameters:
-
left | list of left vertices |
right | list of right vertices |
Definition at line 68 of file pdblock.cpp.
{
ICOORDELT_IT left_it = &leftside;
ICOORDELT_IT right_it = &rightside;
leftside.clear ();
left_it.move_to_first ();
left_it.add_list_before (left);
rightside.clear ();
right_it.move_to_first ();
right_it.add_list_before (right);
}
show image
- Parameters:
-
image | image to show |
window | window to show in |
Definition at line 244 of file pdblock.cpp.
Friends And Related Function Documentation
Member Data Documentation
The documentation for this class was generated from the following files: