void PostScriptView::Brush (ostream& out) { PSBrush* brush = (PSBrush*) GetGraphicComp()->GetGraphic()->GetBrush(); if (brush == nil) { out << MARK << " b u\n"; } else if (brush->None()) { out << "none SetB " << MARK << " b n\n"; } else { int p = brush->GetLinePattern(); out << MARK << " b " << p << "\n"; float w = brush->width(); out << w << " " << false << " " << false << " "; const int* dashpat = brush->GetDashPattern(); int dashpatsize = brush->GetDashPatternSize(); int dashoffset = brush->GetDashOffset(); if (dashpatsize <= 0) { out << "[] " << dashoffset << " "; } else { out << "["; int i; for (i = 0; i < dashpatsize - 1; i++) { out << dashpat[i] << " "; } out << dashpat[i] << "] " << dashoffset << " "; } out << "SetB\n"; } }
void ArrowInteractor::Redraw (Coord, Coord, Coord, Coord) { const char* none = "None"; Coord x[3], y[3]; if (canvas != nil) { output->ClearRect(canvas, 0, 0, xmax, ymax); if (_brush->None()) { const Font* f = output->GetFont(); int width = f->Width(none); int height = f->Height(); output->MoveTo((xmax - width + 1)/2, (ymax - height + 1)/2); output->Text(canvas, none); } else { const Color* origfg = output->GetFgColor(); const Color* origbg = output->GetBgColor(); Resource::ref(origfg); Resource::ref(origbg); output->SetBrush(_brush); output->SetColors(_fg, _bg); output->Line(canvas, HPAD, ymax/2, xmax-HPAD, ymax/2); if (_head) { x[2] = x[0] = xmax-ARROWX; y[0] = ymax/2 - ARROWY; x[1] = xmax-HPAD; y[1] = ymax/2; y[2] = ymax/2 + ARROWY; output->MultiLine(canvas, x, y, 3); } if (_tail) { x[2] = x[0] = ARROWX; y[0] = ymax/2 - ARROWY; x[1] = HPAD; y[1] = ymax/2; y[2] = ymax/2 + ARROWY; output->MultiLine(canvas, x, y, 3); } if (_brush->Width() == 0) { CenterText("0", output, xmax, ymax); output->Text(canvas, "0"); } output->SetColors(origfg, origbg); Resource::unref(origfg); Resource::unref(origbg); } } }
void PSArrowLine::Brush (ostream& out) { ArrowLineComp* comp = (ArrowLineComp*) GetSubject(); PSBrush* brush = (PSBrush*) GetGraphicComp()->GetGraphic()->GetBrush(); boolean head, tail; head = comp->GetArrowLine()->Head(); tail = comp->GetArrowLine()->Tail(); if (brush == nil) { out << MARK << " b u\n"; } else if (brush->None()) { out << "none SetB " << MARK << " b n\n"; } else { int p = brush->GetLinePattern(); out << MARK << " b " << p << "\n"; int w = brush->Width(); out << w << " " << head << " " << tail << " "; const int* dashpat = brush->GetDashPattern(); int dashpatsize = brush->GetDashPatternSize(); int dashoffset = brush->GetDashOffset(); if (dashpatsize <= 0) { out << "[] " << dashoffset << " "; } else { out << "["; for (int i = 0; i < dashpatsize - 1; i++) { out << dashpat[i] << " "; } out << dashpat[i] << "] " << dashoffset << " "; } out << "SetB\n"; } }
void ArrowInteractor::Redraw (Coord, Coord, Coord, Coord) { const char* none = "None"; Coord x[3], y[3]; if (canvas != nil) { output->ClearRect(canvas, 0, 0, xmax, ymax); if (_brush->None()) { const Font* f = output->GetFont(); int width = f->Width(none); int height = f->Height(); output->MoveTo((xmax - width + 1)/2, (ymax - height + 1)/2); output->Text(canvas, none); } else { const Color* origfg = output->GetFgColor(); const Color* origbg = output->GetBgColor(); Resource::ref(origfg); Resource::ref(origbg); output->SetBrush(_brush); output->SetColors(_fg, _bg); #if __GNUC__>=2 && __GNUC_MINOR__>=5 || __GNUC__>=3 #undef Line output->Line(canvas, HPAD, ymax/2, xmax-HPAD, ymax/2); #define Line _lib_iv(Line) #else output->Line(canvas, HPAD, ymax/2, xmax-HPAD, ymax/2); #endif /* Line */ /* remove the dashing for the arrowheads */ if (_head || _tail) if (_brush->dashed()) output->SetBrush(new PSBrush(0, _brush->Width())); if (_head) { x[2] = x[0] = xmax-ARROWX; y[0] = ymax/2 - ARROWY; x[1] = xmax-HPAD; y[1] = ymax/2; y[2] = ymax/2 + ARROWY; #if __GNUC__>=2 && __GNUC_MINOR__>=5 || __GNUC__>=3 #undef MultiLine output->MultiLine(canvas, x, y, 3); #define MultiLine _lib_iv(MultiLine) #else output->MultiLine(canvas, x, y, 3); #endif /* MultiLine */ } if (_tail) { x[2] = x[0] = ARROWX; y[0] = ymax/2 - ARROWY; x[1] = HPAD; y[1] = ymax/2; y[2] = ymax/2 + ARROWY; #if __GNUC__>=2 && __GNUC_MINOR__>=5 || __GNUC__>=3 #undef MultiLine output->MultiLine(canvas, x, y, 3); #define MultiLine _lib_iv(MultiLine) #else output->MultiLine(canvas, x, y, 3); #endif /* MultiLine */ } if (_brush->Width() == 0) { CenterText("0", output, xmax, ymax); output->Text(canvas, "0"); } output->SetColors(origfg, origbg); Resource::unref(origfg); Resource::unref(origbg); } } }