Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stepblob.h
Go to the documentation of this file.
1 /**********************************************************************
2 * File: stepblob.h (Formerly cblob.h)
3 * Description: Code for C_BLOB class.
4 * Author: Ray Smith
5 * Created: Tue Oct 08 10:41:13 BST 1991
6 *
7 * (C) Copyright 1991, Hewlett-Packard Ltd.
8 ** Licensed under the Apache License, Version 2.0 (the "License");
9 ** you may not use this file except in compliance with the License.
10 ** You may obtain a copy of the License at
11 ** http://www.apache.org/licenses/LICENSE-2.0
12 ** Unless required by applicable law or agreed to in writing, software
13 ** distributed under the License is distributed on an "AS IS" BASIS,
14 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ** See the License for the specific language governing permissions and
16 ** limitations under the License.
17 *
18 **********************************************************************/
19
20 #ifndef STEPBLOB_H
21 #define STEPBLOB_H
22
23 #include "coutln.h"
24 #include "rect.h"
25
26 struct Pix;
27
28 class C_BLOB:public ELIST_LINK
29 {
30 public:
31 C_BLOB() {
32 }
33 explicit C_BLOB(C_OUTLINE_LIST *outline_list);
34 // Simpler constructor to build a blob from a single outline that has
35 // already been fully initialized.
36 explicit C_BLOB(C_OUTLINE* outline);
37
38 // Build and return a fake blob containing a single fake outline with no
39 // steps.
40 static C_BLOB* FakeBlob(const TBOX& box);
41
42 C_OUTLINE_LIST *out_list() { //get outline list
43 return &outlines;
44 }
45
46 TBOX bounding_box(); //compute bounding box
47 inT32 area(); //compute area
48 inT32 perimeter(); // Total perimeter of outlines and 1st level children.
49 inT32 outer_area(); //compute area
50 inT32 count_transitions( //count maxima
51 inT32 threshold); //size threshold
52
53 void move(const ICOORD vec); // repostion blob by vector
54 void rotate(const FCOORD& rotation); // Rotate by given vector.
55
56 // Returns a Pix rendering of the blob. pixDestroy after use.
57 Pix* render();
58 // Returns a Pix rendering of the outline of the blob. (no fill).
59 // pixDestroy after use.
60 Pix* render_outline();
61
62 #ifndef GRAPHICS_DISABLED
63 void plot( //draw one
64 ScrollView* window, //window to draw in
65 ScrollView::Color blob_colour, //for outer bits
66 ScrollView::Color child_colour); //for holes
67 #endif // GRAPHICS_DISABLED
68
69 C_BLOB& operator= (const C_BLOB & source) {
70 if (!outlines.empty ())
71 outlines.clear();
72 outlines.deep_copy(&source.outlines, &C_OUTLINE::deep_copy);
73 return *this;
74 }
75
76 static C_BLOB* deep_copy(const C_BLOB* src) {
77 C_BLOB* blob = new C_BLOB;
78 *blob = *src;
79 return blob;
80 }
81
82 private:
83 C_OUTLINE_LIST outlines; //master elements
84 };
85
86 ELISTIZEH (C_BLOB)
87 #endif