Leptonica 1.68
C Image Processing Library
|
00001 /*====================================================================* 00002 - Copyright (C) 2001 Leptonica. All rights reserved. 00003 - This software is distributed in the hope that it will be 00004 - useful, but with NO WARRANTY OF ANY KIND. 00005 - No author or distributor accepts responsibility to anyone for the 00006 - consequences of using this software, or for whether it serves any 00007 - particular purpose or works at all, unless he or she says so in 00008 - writing. Everyone is granted permission to copy, modify and 00009 - redistribute this source code, for commercial or non-commercial 00010 - purposes, with the following restrictions: (1) the origin of this 00011 - source code must not be misrepresented; (2) modified versions must 00012 - be plainly marked as such; and (3) this notice may not be removed 00013 - or altered from any source or modified source distribution. 00014 *====================================================================*/ 00015 00016 /* 00017 * livre_orient.c 00018 * 00019 * This generates an image of the set of 4 HMT Sels that are 00020 * used for counting ascenders and descenders to detect 00021 * text orientation. 00022 */ 00023 00024 #include <stdio.h> 00025 #include <stdlib.h> 00026 #include "allheaders.h" 00027 00028 static const char *textsel1 = "x oo " 00029 "x oOo " 00030 "x o " 00031 "x " 00032 "xxxxxx"; 00033 00034 static const char *textsel2 = " oo x" 00035 " oOo x" 00036 " o x" 00037 " x" 00038 "xxxxxx"; 00039 00040 static const char *textsel3 = "xxxxxx" 00041 "x " 00042 "x o " 00043 "x oOo " 00044 "x oo "; 00045 00046 static const char *textsel4 = "xxxxxx" 00047 " x" 00048 " o x" 00049 " oOo x" 00050 " oo x"; 00051 00052 main(int argc, 00053 char **argv) 00054 { 00055 PIX *pixd; 00056 SEL *sel1, *sel2, *sel3, *sel4; 00057 SELA *sela; 00058 static char mainName[] = "livre_orient"; 00059 00060 sel1 = selCreateFromString(textsel1, 5, 6, NULL); 00061 sel2 = selCreateFromString(textsel2, 5, 6, NULL); 00062 sel3 = selCreateFromString(textsel3, 5, 6, NULL); 00063 sel4 = selCreateFromString(textsel4, 5, 6, NULL); 00064 00065 sela = selaCreate(4); 00066 selaAddSel(sela, sel1, "textsel1", L_INSERT); 00067 selaAddSel(sela, sel2, "textsel2", L_INSERT); 00068 selaAddSel(sela, sel3, "textsel3", L_INSERT); 00069 selaAddSel(sela, sel4, "textsel4", L_INSERT); 00070 00071 pixd = selaDisplayInPix(sela, 28, 3, 30, 4); 00072 pixWrite("/tmp/orient.png", pixd, IFF_PNG); 00073 pixDisplay(pixd, 100, 100); 00074 00075 pixDestroy(&pixd); 00076 selaDestroy(&sela); 00077 return 0; 00078 } 00079