Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
svshowim.cpp
Go to the documentation of this file.
1 // Copyright 2006 Google Inc. All Rights Reserved.
2 // Author: <rays@google.com> (Ray Smith)
3 //
4 
5 #ifdef HAVE_CONFIG_H
6 #include "config_auto.h"
7 #endif
8 
9 #ifndef GRAPHICS_DISABLED
10 #include "allheaders.h"
11 
12 #include "svshowim.h"
13 #include "scrollview.h"
14 
15 // Override of a tesseract function to display an image in a window.
16 // This function redirects the display to ScrollView instead of the
17 // stubbed-out functions in tesseract.
18 
19 void sv_show_sub_image(IMAGE* source, // Image to show.
20  inT32 xstart, // Start image coords.
21  inT32 ystart,
22  inT32 xext, // Size of rectangle to show.
23  inT32 yext,
24  ScrollView* window, // Window to draw in.
25  inT32 xpos, // Place to show bottom-left.
26  inT32 ypos) { // Y position.
27  Pix* pix;
28  if (xstart != 0 || ystart != 0 ||
29  xext != source->get_xsize() || yext != source->get_ysize()) {
30  IMAGE sub_im;
31  sub_im.create(xext, yext, source->get_bpp());
32  copy_sub_image(source, xstart, ystart, xext, yext, &sub_im, 0, 0, false);
33  pix = sub_im.ToPix();
34  } else {
35  pix = source->ToPix();
36  }
37  window->Image(pix, xpos, window->TranslateYCoordinate(yext) + ypos);
38  pixDestroy(&pix);
39 }
40 
41 #endif // GRAPHICS_DISABLED
42 
int inT32
Definition: host.h:102
void sv_show_sub_image(IMAGE *source, inT32 xstart, inT32 ystart, inT32 xext, inT32 yext, ScrollView *window, inT32 xpos, inT32 ypos)
Definition: svshowim.cpp:19
DLLSYM void copy_sub_image(IMAGE *source, inT32 xstart, inT32 ystart, inT32 xext, inT32 yext, IMAGE *dest, inT32 xdest, inT32 ydest, BOOL8 adjust_grey)
Definition: imgs.cpp:270
inT32 get_ysize()
Definition: img.h:99
int TranslateYCoordinate(int y)
Definition: scrollview.cpp:863
void Image(struct Pix *image, int x_pos, int y_pos)
Definition: scrollview.cpp:768
inT8 get_bpp()
Definition: img.h:106
inT32 get_xsize()
Definition: img.h:92
Definition: img.h:51
inT8 create(inT32 x, inT32 y, inT8 bits_per_pixel)
Definition: imgs.cpp:121
Pix * ToPix()
Definition: imgs.cpp:1501