2008-02-01 08:43:30 +08:00
|
|
|
// Copyright 2006 Google Inc. All Rights Reserved.
|
|
|
|
// Author: <rays@google.com> (Ray Smith)
|
|
|
|
//
|
|
|
|
|
2008-04-22 08:44:56 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config_auto.h"
|
|
|
|
#endif
|
2011-08-30 14:34:41 +08:00
|
|
|
|
2008-02-01 08:43:30 +08:00
|
|
|
#include "allheaders.h"
|
2011-08-30 14:34:41 +08:00
|
|
|
|
2010-05-26 15:54:34 +08:00
|
|
|
#include "svshowim.h"
|
|
|
|
#include "scrollview.h"
|
2008-02-01 08:43:30 +08:00
|
|
|
|
|
|
|
// Override of a tesseract function to display an image in a window.
|
|
|
|
// This function redirects the display to ScrollView instead of the
|
|
|
|
// stubbed-out functions in tesseract.
|
|
|
|
|
|
|
|
void sv_show_sub_image(IMAGE* source, // Image to show.
|
2008-04-22 08:44:56 +08:00
|
|
|
inT32 xstart, // Start image coords.
|
|
|
|
inT32 ystart,
|
|
|
|
inT32 xext, // Size of rectangle to show.
|
|
|
|
inT32 yext,
|
2008-02-01 08:43:30 +08:00
|
|
|
ScrollView* window, // Window to draw in.
|
2008-04-22 08:44:56 +08:00
|
|
|
inT32 xpos, // Place to show bottom-left.
|
|
|
|
inT32 ypos) { // Y position.
|
2008-02-01 08:43:30 +08:00
|
|
|
Pix* pix;
|
|
|
|
if (xstart != 0 || ystart != 0 ||
|
2008-04-22 08:44:56 +08:00
|
|
|
xext != source->get_xsize() || yext != source->get_ysize()) {
|
2008-02-01 08:43:30 +08:00
|
|
|
IMAGE sub_im;
|
|
|
|
sub_im.create(xext, yext, source->get_bpp());
|
|
|
|
copy_sub_image(source, xstart, ystart, xext, yext, &sub_im, 0, 0, false);
|
|
|
|
pix = sub_im.ToPix();
|
|
|
|
} else {
|
|
|
|
pix = source->ToPix();
|
|
|
|
}
|
|
|
|
window->Image(pix, xpos, window->TranslateYCoordinate(yext) + ypos);
|
|
|
|
pixDestroy(&pix);
|
|
|
|
}
|