1
/**********************************************************************
2
* File: stepblob.h (Formerly cblob.h)
3
* Description: Code for C_BLOB class.
5
* Created: Tue Oct 08 10:41:13 BST 1991
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.
18
**********************************************************************/
26
class C_BLOB:public ELIST_LINK
31
explicit C_BLOB(C_OUTLINE_LIST *outline_list);
33
// Build and return a fake blob containing a single fake outline with no
35
static C_BLOB* FakeBlob(const TBOX& box);
37
C_OUTLINE_LIST *out_list() { //get outline list
41
TBOX bounding_box(); //compute bounding box
42
inT32 area(); //compute area
43
inT32 perimeter(); // Total perimeter of outlines and 1st level children.
44
inT32 outer_area(); //compute area
45
inT32 count_transitions( //count maxima
46
inT32 threshold); //size threshold
48
void move(const ICOORD vec); // repostion blob by vector
49
void rotate(const FCOORD& rotation); // Rotate by given vector.
52
ScrollView* window, //window to draw in
53
ScrollView::Color blob_colour, //for outer bits
54
ScrollView::Color child_colour); //for holes
56
void prep_serialise() { //set ptrs to counts
57
outlines.prep_serialise ();
60
void dump( //write external bits
65
void de_dump( //read external bits
71
make_serialise(C_BLOB)
73
C_BLOB& operator= (const C_BLOB & source) {
74
if (!outlines.empty ())
76
outlines.deep_copy(&source.outlines, &C_OUTLINE::deep_copy);
80
static C_BLOB* deep_copy(const C_BLOB* src) {
81
C_BLOB* blob = new C_BLOB;
87
C_OUTLINE_LIST outlines; //master elements