flipselgen.c.notused 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*====================================================================*
  2. - Copyright (C) 2001 Leptonica. All rights reserved.
  3. -
  4. - Redistribution and use in source and binary forms, with or without
  5. - modification, are permitted provided that the following conditions
  6. - are met:
  7. - 1. Redistributions of source code must retain the above copyright
  8. - notice, this list of conditions and the following disclaimer.
  9. - 2. Redistributions in binary form must reproduce the above
  10. - copyright notice, this list of conditions and the following
  11. - disclaimer in the documentation and/or other materials
  12. - provided with the distribution.
  13. -
  14. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  15. - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  16. - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
  18. - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  19. - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  21. - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  22. - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  23. - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *====================================================================*/
  26. /*
  27. * flipselgen.c.notused
  28. *
  29. * NOTE
  30. * ================================================================
  31. * This code has been retired from the library, along with the code
  32. * in flipdetectdwa.c that it generates. It is no longer compiled.
  33. * ================================================================
  34. *
  35. * Results are two files:
  36. * fmorphgen.3.c
  37. * fmorphgenlow.3.c
  38. * using INDEX = 3.
  39. */
  40. #ifdef HAVE_CONFIG_H
  41. #include <config_auto.h>
  42. #endif /* HAVE_CONFIG_H */
  43. #include "allheaders.h"
  44. #define INDEX 3
  45. #define DFLAG 1
  46. /* Sels for pixPageFlipDetectDWA() */
  47. static const char *textsel1 = "x oo "
  48. "x oOo "
  49. "x o "
  50. "x "
  51. "xxxxxx";
  52. static const char *textsel2 = " oo x"
  53. " oOo x"
  54. " o x"
  55. " x"
  56. "xxxxxx";
  57. static const char *textsel3 = "xxxxxx"
  58. "x "
  59. "x o "
  60. "x oOo "
  61. "x oo ";
  62. static const char *textsel4 = "xxxxxx"
  63. " x"
  64. " o x"
  65. " oOo x"
  66. " oo x";
  67. int main(int argc,
  68. char **argv)
  69. {
  70. SEL *sel1, *sel2, *sel3, *sel4;
  71. SELA *sela;
  72. PIX *pix, *pixd;
  73. PIXA *pixa;
  74. static char mainName[] = "flipselgen";
  75. if (argc != 1)
  76. return ERROR_INT(" Syntax: flipselgen", mainName, 1);
  77. setLeptDebugOK(1);
  78. sela = selaCreate(0);
  79. sel1 = selCreateFromString(textsel1, 5, 6, "flipsel1");
  80. sel2 = selCreateFromString(textsel2, 5, 6, "flipsel2");
  81. sel3 = selCreateFromString(textsel3, 5, 6, "flipsel3");
  82. sel4 = selCreateFromString(textsel4, 5, 6, "flipsel4");
  83. selaAddSel(sela, sel1, NULL, 0);
  84. selaAddSel(sela, sel2, NULL, 0);
  85. selaAddSel(sela, sel3, NULL, 0);
  86. selaAddSel(sela, sel4, NULL, 0);
  87. pixa = pixaCreate(4);
  88. pix = selDisplayInPix(sel1, 23, 2);
  89. pixDisplayWithTitle(pix, 100, 100, "sel1", DFLAG);
  90. pixaAddPix(pixa, pix, L_INSERT);
  91. pix = selDisplayInPix(sel2, 23, 2);
  92. pixDisplayWithTitle(pix, 275, 100, "sel2", DFLAG);
  93. pixaAddPix(pixa, pix, L_INSERT);
  94. pix = selDisplayInPix(sel3, 23, 2);
  95. pixDisplayWithTitle(pix, 450, 100, "sel3", DFLAG);
  96. pixaAddPix(pixa, pix, L_INSERT);
  97. pix = selDisplayInPix(sel4, 23, 2);
  98. pixDisplayWithTitle(pix, 625, 100, "sel4", DFLAG);
  99. pixaAddPix(pixa, pix, L_INSERT);
  100. pixd = pixaDisplayTiled(pixa, 800, 0, 15);
  101. pixDisplayWithTitle(pixd, 100, 300, "allsels", DFLAG);
  102. pixDestroy(&pixd);
  103. pixaDestroy(&pixa);
  104. if (fhmtautogen(sela, INDEX, NULL))
  105. return ERROR_INT(" Generation failed", mainName, 1);
  106. selaDestroy(&sela);
  107. return 0;
  108. }