forked from wrcad/xictools
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdsp_image.h
162 lines (142 loc) · 5.54 KB
/
dsp_image.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*========================================================================*
* *
* Distributed by Whiteley Research Inc., Sunnyvale, California, USA *
* http://wrcad.com *
* Copyright (C) 2017 Whiteley Research Inc., all rights reserved. *
* Author: Stephen R. Whiteley, except as indicated. *
* *
* As fully as possible recognizing licensing terms and conditions *
* imposed by earlier work from which this work was derived, if any, *
* this work is released under the Apache License, Version 2.0 (the *
* "License"). You may not use this file except in compliance with *
* the License, and compliance with inherited licenses which are *
* specified in a sub-header below this one if applicable. A copy *
* of the License is provided with this distribution, or you may *
* obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* See the License for the specific language governing permissions *
* and limitations under the License. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- *
* INFRINGEMENT. IN NO EVENT SHALL WHITELEY RESEARCH INCORPORATED *
* OR STEPHEN R. WHITELEY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
*========================================================================*
* XicTools Integrated Circuit Design System *
* *
* Xic Integrated Circuit Layout and Schematic Editor *
* *
*========================================================================*
$Id:$
*========================================================================*/
#ifndef DSP_IMAGE_H
#define DSP_IMAGE_H
#include "fio.h"
#include "fio_chd.h"
#include "fio_chd_flat.h"
#include "fio_cvt_base.h"
#include "ginterf/raster.h"
//
// Definitions for in-memory image creation.
//
namespace ginterf {
struct RGBzimg;
}
// This is a helper class passed to the function which renders
// unexpanded subcells and "tiny" boxes when composing an image from a
// CHD.
//
struct bnd_draw_t
{
bnd_draw_t(WindowDesc *wd, cCHD *c, const BBox *bb)
{
bd_ntab = c->nameTab(wd->Mode());
bd_AOI = bb;
bd_numgeom = 0;
bd_show_text = wd->Attrib()->label_instances(wd->Mode());
bd_show_tiny = wd->Attrib()->show_tiny_bb(wd->Mode());
bd_abort = false;
}
nametab_t *ntab() { return (bd_ntab); }
const BBox *AOI() { return (bd_AOI); }
int numgeom() { return (bd_numgeom); }
SLtype show_text() { return (bd_show_text); }
bool show_tiny() { return (bd_show_tiny); }
bool aborted() { return (bd_abort); }
void new_geom()
{
bd_numgeom++;
if (!(bd_numgeom & 0xff)) {
// check every 256 objects for efficiency
dspPkgIf()->CheckForInterrupt();
if (DSP()->Interrupt()) {
DSP()->SetInterrupt(DSPinterNone);
bd_abort = true;
}
}
}
private:
nametab_t *bd_ntab;
const BBox *bd_AOI;
int bd_numgeom;
SLtype bd_show_text;
bool bd_show_tiny;
bool bd_abort;
};
// Back-end for image generation from CHD, uses RGBzimg.
//
struct zimg_backend : public cv_backend
{
struct zb_layer_t
{
zb_layer_t(const Layer *lyr)
{
lname = lyr ? lstring::copy(lyr->name) : 0;
layer = lyr ? lyr->layer : -1;
datatype = lyr ? lyr->datatype : -1;
pixel = 0;
flags = 0;
fill = 0;
index = -1;
}
~zb_layer_t()
{
delete [] lname;
}
bool isInvisible() { return (flags & CDL_INVIS); }
char *lname;
int layer;
int datatype;
unsigned int pixel;
unsigned int flags;
GRfillType *fill;
int index;
};
zimg_backend(WindowDesc*, RGBzimg*);
~zimg_backend();
bool queue_layer(const Layer*, bool*);
bool write_box(const BBox*);
bool write_poly(const Poly*);
bool write_wire(const Wire*);
bool write_text(const Text*);
int numgeom(int ng)
{
zb_numgeom += ng;
return (zb_numgeom);
}
private:
WindowDesc *zb_wdesc;
RGBzimg *zb_rgbimg;
zb_layer_t *zb_layer;
SymTab *zb_ltab;
int zb_numgeom;
bool zb_allow_layer_mapping;
};
#endif