Updated graphics output for new java-based display

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@144 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
theraysmith 2008-02-01 00:43:30 +00:00
parent e1e7c97c3e
commit a196c11c9b
4 changed files with 73 additions and 8 deletions

View File

@ -1,10 +1,10 @@
SUBDIRS =
AM_CPPFLAGS = -I$(top_srcdir)/ccutil
AM_CPPFLAGS = -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer
include_HEADERS = \
bitstrm.h imgbmp.h imgerrs.h img.h imgio.h imgs.h \
imgtiff.h imgunpk.h
imgtiff.h imgunpk.h svshowim.h
lib_LIBRARIES = libtesseract_image.a
libtesseract_image_a_SOURCES = \
imgbmp.cpp imgio.cpp imgs.cpp imgtiff.cpp bitstrm.cpp
imgbmp.cpp imgio.cpp imgs.cpp imgtiff.cpp bitstrm.cpp svshowim.cpp

View File

@ -75,13 +75,13 @@ RANLIB = @RANLIB@
VERSION = @VERSION@
SUBDIRS =
AM_CPPFLAGS = -I$(top_srcdir)/ccutil
AM_CPPFLAGS = -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer
include_HEADERS = bitstrm.h imgbmp.h imgerrs.h img.h imgio.h imgs.h imgtiff.h imgunpk.h
include_HEADERS = bitstrm.h imgbmp.h imgerrs.h img.h imgio.h imgs.h imgtiff.h imgunpk.h svshowim.h
lib_LIBRARIES = libtesseract_image.a
libtesseract_image_a_SOURCES = imgbmp.cpp imgio.cpp imgs.cpp imgtiff.cpp bitstrm.cpp
libtesseract_image_a_SOURCES = imgbmp.cpp imgio.cpp imgs.cpp imgtiff.cpp bitstrm.cpp svshowim.cpp
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = ../config_auto.h
@ -95,7 +95,7 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libtesseract_image_a_LIBADD =
libtesseract_image_a_OBJECTS = imgbmp.o imgio.o imgs.o imgtiff.o \
bitstrm.o
bitstrm.o svshowim.o
AR = ar
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
@ -111,7 +111,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/bitstrm.P .deps/imgbmp.P .deps/imgio.P .deps/imgs.P \
.deps/imgtiff.P
.deps/imgtiff.P .deps/svshowim.P
SOURCES = $(libtesseract_image_a_SOURCES)
OBJECTS = $(libtesseract_image_a_OBJECTS)

40
image/svshowim.cpp Normal file
View File

@ -0,0 +1,40 @@
// Copyright 2006 Google Inc. All Rights Reserved.
// Author: <rays@google.com> (Ray Smith)
//
#include "svshowim.h"
#include "scrollview.h"
// The jpeg library still has INT32 as long, which is no good for 64 bit.
#ifdef HAVE_LIBLEPT
#define INT32 WRONGINT32
#include "allheaders.h"
#undef INT32
#endif
// 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.
INT32 xstart, // Start image coords.
INT32 ystart,
INT32 xext, // Size of rectangle to show.
INT32 yext,
ScrollView* window, // Window to draw in.
INT32 xpos, // Place to show bottom-left.
INT32 ypos) { // Y position.
#ifdef HAVE_LIBLEPT
Pix* pix;
if (xstart != 0 || ystart != 0 ||
xext != source->get_xsize() || yext != source->get_ysize()) {
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);
#endif
}

25
image/svshowim.h Normal file
View File

@ -0,0 +1,25 @@
// Copyright 2006 Google Inc. All Rights Reserved.
// Author: <rays@google.com> (Ray Smith)
//
#ifndef OCR_TESSERACT_SVSHOWIM_H__
#define OCR_TESSERACT_SVSHOWIM_H__
#include "host.h"
#include "img.h"
class ScrollView;
// 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.
INT32 xstart, // Bottom-left coords.
INT32 ystart,
INT32 xext, // Size of rectangle to show.
INT32 yext,
ScrollView* win, // Window to draw in.
INT32 xpos, // Place to show bottom-left.
INT32 ypos); // Y position.
#endif // OCR_TESSERACT_SVSHOWIM_H__