Fresco/Berlin/modules/Drawing/PostScript DrawingKit.cc,1.30,1.31 DrawingKit.hh,1.17,1.18
Tobias Hunger <[email protected]> Mon, 29 Dec 2003 09:04:28 +0100
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Berlin/modules/Drawing/PostScript
In directory purcel:/tmp/cvs-serv30213/modules/Drawing/PostScript
Modified Files:
DrawingKit.cc DrawingKit.hh
Log Message:
* Styleguidify Berlin
* Add namespace Berlin
Both patches are mixed into one since I did not want to commit two such
large and disruptive patches.
Index: DrawingKit.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Drawing/PostScript/DrawingKit.cc,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- DrawingKit.cc 27 May 2003 23:12:44 -0000 1.30
+++ DrawingKit.cc 29 Dec 2003 08:03:22 -0000 1.31
@@ -42,353 +42,389 @@
PostScript::DrawingKit::DrawingKit(const std::string &id,
const Fresco::Kit::PropertySeq &p,
- ServerContextImpl *c)
- : KitImpl(id, p, c),
- _os(new std::filebuf())
+ ServerContextImpl *c) :
+ KitImpl(id, p, c),
+ my_os(new std::filebuf())
{
- _os.precision(5);
- _os.setf(std::ios::fixed);
- _lt.red = 1.0; _lt.green = 1.0; _lt.blue = 1.0; _lt.alpha = 1.0;
- _fg.red = 1.0; _fg.green = 1.0; _fg.blue = 1.0; _fg.alpha = 1.0;
+ my_os.precision(5);
+ my_os.setf(std::ios::fixed);
+ my_lt.red = 1.0; my_lt.green = 1.0; my_lt.blue = 1.0;
+ my_lt.alpha = 1.0;
+ my_fg.red = 1.0; my_fg.green = 1.0; my_fg.blue = 1.0;
+ my_fg.alpha = 1.0;
}
-PostScript::DrawingKit::~DrawingKit()
-{
-}
+PostScript::DrawingKit::~DrawingKit() { }
-KitImpl *PostScript::DrawingKit::clone(const Fresco::Kit::PropertySeq &p,
- ServerContextImpl *c)
+Berlin::KitImpl *
+PostScript::DrawingKit::clone(const Fresco::Kit::PropertySeq &p,
+ ServerContextImpl *c)
{
- DrawingKit *kit = new DrawingKit(repo_id(), p, c);
- kit->init();
- return kit;
+ DrawingKit *kit = new DrawingKit(repo_id(), p, c);
+ kit->init();
+ return kit;
}
void PostScript::DrawingKit::start_traversal(Traversal_ptr traversal)
{
- _os.clear();
- static_cast<std::filebuf *>(_os.rdbuf())->open("berlin-output.eps", std::ios::out);
+ my_os.clear();
+ static_cast<std::filebuf *>(my_os.rdbuf())->open("berlin-output.eps",
+ std::ios::out);
- Region_var allocation = traversal->current_allocation();
- Transform_var transformation = traversal->current_transformation();
- RegionImpl region(allocation, transformation);
+ Region_var allocation = traversal->current_allocation();
+ Transform_var transformation = traversal->current_transformation();
+ RegionImpl region(allocation, transformation);
- _tr->load_identity();
+ my_tr->load_identity();
- Lease_var<RegionImpl> clip(Provider<RegionImpl>::provide());
- _cl = Region_var(clip->_this());
+ Lease_var<RegionImpl> clip(Provider<RegionImpl>::provide());
+ my_cl = Region_var(clip->_this());
- // FIXME: figure out what is wrong with the resolution,
- // the problems seems to be in the coordinate system used,
- // not PS...
- // -stefan
- double xfactor = resolution(xaxis);
- double yfactor = resolution(yaxis);
+ // FIXME: figure out what is wrong with the resolution,
+ // the problems seems to be in the coordinate system used,
+ // not PS...
+ // -stefan
+ double xfactor = resolution(xaxis);
+ double yfactor = resolution(yaxis);
- static Transform::Matrix m =
- {{xfactor*xfactor, 0., 0., 0.},
- {0., 0.-yfactor*yfactor, 0., 0.},
- {0., 0., 1., 0.},
- {0., 0., 0., 1.}};
- TransformImpl *adjust = new TransformImpl(m);
- _tr_adjust = adjust->_this();
+ static Transform::Matrix m =
+ {{xfactor*xfactor, 0., 0., 0.},
+ {0., 0.-yfactor*yfactor, 0., 0.},
+ {0., 0., 1., 0.},
+ {0., 0., 0., 1.}};
+ TransformImpl *adjust = new TransformImpl(m);
+ my_tr_adjust = adjust->_this();
- Vertex lower = region.lower;
- Vertex upper = region.upper;
+ Vertex lower = region.lower;
+ Vertex upper = region.upper;
- _tr_adjust->transform_vertex(lower);
- _tr_adjust->transform_vertex(upper);
+ my_tr_adjust->transform_vertex(lower);
+ my_tr_adjust->transform_vertex(upper);
- Vertex translate; translate.x = 35.; translate.z = 0.;
- translate.y = lower.y - upper.y + 35.;
- _tr_adjust->translate(translate);
+ Vertex translate; translate.x = 35.; translate.z = 0.;
+ translate.y = lower.y - upper.y + 35.;
+ my_tr_adjust->translate(translate);
- _cl_none = new RegionImpl(region);
- _cl = Region_var(_cl_none->_this());
+ my_cl_none = new RegionImpl(region);
+ my_cl = Region_var(my_cl_none->_this());
- _os << "%!PS-Adobe-3.0 EPSF-3.0" << std::endl;
- _os.precision(0);
- _os << "%%BoundingBox: "
- << floor(region.lower.x*resolution(xaxis)*xfactor + 35.) << ' '
- << floor(region.lower.y*resolution(yaxis)*yfactor + 35.) << ' '
- << ceil((region.upper.x - region.lower.x)*resolution(xaxis)*xfactor + 35.) << ' '
- << ceil((region.upper.y - region.lower.y)*resolution(yaxis)*yfactor + 35.) << std::endl;
- _os.precision(5);
- _os << "%%HiResBoundingBox: "
- << region.lower.x*resolution(xaxis)*xfactor + 35. << ' '
- << region.lower.y*resolution(yaxis)*yfactor + 35. << ' '
- << (region.upper.x - region.lower.x)*resolution(xaxis)*xfactor + 35. << ' '
- << (region.upper.y - region.lower.y)*resolution(yaxis)*yfactor + 35. << std::endl;
- _os << "%%LanguageLevel: 2" << std::endl;
- _os << "%%Creator: Fresco" << std::endl;
- _os << "/Times-Roman findfont 112 scalefont setfont" << std::endl;
- _os << "0 0 0 setrgbcolor" << std::endl;
- _os << std::endl;
+ my_os << "%!PS-Adobe-3.0 EPSF-3.0" << std::endl;
+ my_os.precision(0);
+ my_os << "%%BoundingBox: "
+ << floor(region.lower.x*resolution(xaxis)*xfactor + 35.) << ' '
+ << floor(region.lower.y*resolution(yaxis)*yfactor + 35.) << ' '
+ << ceil((region.upper.x - region.lower.x)*
+ resolution(xaxis)*xfactor + 35.)
+ << ' '
+ << ceil((region.upper.y - region.lower.y)*
+ resolution(yaxis)*yfactor + 35.) << std::endl;
+ my_os.precision(5);
+ my_os << "%%HiResBoundingBox: "
+ << region.lower.x*resolution(xaxis)*xfactor + 35. << ' '
+ << region.lower.y*resolution(yaxis)*yfactor + 35. << ' '
+ << (region.upper.x - region.lower.x)*resolution(xaxis)*xfactor +
+ 35. << ' '
+ << (region.upper.y - region.lower.y)*resolution(yaxis)*yfactor +
+ 35. << std::endl
+ << "%%LanguageLevel: 2" << std::endl
+ << "%%Creator: Fresco" << std::endl
+ << "/Times-Roman findfont 112 scalefont setfont" << std::endl
+ << "0 0 0 setrgbcolor" << std::endl
+ << std::endl;
}
void PostScript::DrawingKit::finish_traversal()
{
- _os << "%%EOF" << std::endl;
- static_cast<std::filebuf *>(_os.rdbuf())->close();
+ my_os << "%%EOF" << std::endl;
+ static_cast<std::filebuf *>(my_os.rdbuf())->close();
}
-Fresco::Unistring *PostScript::DrawingKit::font_family() { return new Unistring(Unicode::to_CORBA(Babylon::String("Times Roman")));}
-Fresco::Unistring *PostScript::DrawingKit::font_subfamily() { return new Unistring();}
-Fresco::Unistring *PostScript::DrawingKit::font_fullname() { return new Unistring(Unicode::to_CORBA(Babylon::String("Times Roman")));}
-Fresco::Unistring *PostScript::DrawingKit::font_style() { return new Unistring(Unicode::to_CORBA(Babylon::String("Regular")));}
-Fresco::DrawingKit::FontMetrics PostScript::DrawingKit::font_metrics() { return Fresco::DrawingKit::FontMetrics();}
-Fresco::DrawingKit::GlyphMetrics PostScript::DrawingKit::glyph_metrics(Fresco::Unichar) { return Fresco::DrawingKit::GlyphMetrics();}
-CORBA::Any *PostScript::DrawingKit::get_font_attribute(const Fresco::Unistring &) { return new CORBA::Any();}
+Fresco::Unistring *PostScript::DrawingKit::font_family()
+{
+ return
+ new Unistring(Unicode::to_CORBA(Babylon::String("Times Roman")));
+}
+Fresco::Unistring *PostScript::DrawingKit::font_subfamily()
+{ return new Unistring(); }
+Fresco::Unistring *PostScript::DrawingKit::font_fullname()
+{
+ return
+ new Unistring(Unicode::to_CORBA(Babylon::String("Times Roman")));
+}
+Fresco::Unistring *PostScript::DrawingKit::font_style()
+{ return new Unistring(Unicode::to_CORBA(Babylon::String("Regular"))); }
+Fresco::DrawingKit::FontMetrics PostScript::DrawingKit::font_metrics()
+{ return Fresco::DrawingKit::FontMetrics(); }
+Fresco::DrawingKit::GlyphMetrics
+PostScript::DrawingKit::glyph_metrics(Fresco::Unichar)
+{ return Fresco::DrawingKit::GlyphMetrics(); }
+CORBA::Any *
+PostScript::DrawingKit::get_font_attribute(const Fresco::Unistring &)
+{ return new CORBA::Any(); }
void PostScript::DrawingKit::set_transformation(Transform_ptr t)
{
- if (CORBA::is_nil(t)) _tr->load_identity();
- else _tr = Transform::_duplicate(t);
+ if (CORBA::is_nil(t)) my_tr->load_identity();
+ else my_tr = Transform::_duplicate(t);
}
void PostScript::DrawingKit::set_clipping(Region_ptr r)
{
- _cl = Region::_duplicate(r);
+ my_cl = Region::_duplicate(r);
#if 0
- _os << "%set_clipping" << std::endl;
- Vertex lower, upper;
- if (CORBA::is_nil(_cl))
- {
- _cl_none->bounds(lower, upper);
- _os << "%none" << std::endl;
- } else {
- _cl->bounds(lower, upper);
- _os << "%real" << std::endl;
- }
- _os << "newpath" << std::endl;
- Vertex v;
- v.x = lower.x; v.y = lower.y; v.z = 0;
- vertex(v, " moveto");
- v.x = lower.x; v.y = upper.y; v.z = 0;
- vertex(v, " lineto");
- v.x = upper.x; v.y = upper.y; v.z = 0;
- vertex(v, " lineto");
- v.x = upper.x; v.y = lower.y; v.z = 0;
- vertex(v, " lineto");
- v.x = lower.x; v.y = lower.y; v.z = 0;
- vertex(v, " lineto");
- _os << "closepath clip" << std::endl;
- _os << std::endl;
+ my_os << "%set_clipping" << std::endl;
+ Vertex lower, upper;
+ if (CORBA::is_nil(_cl))
+ {
+ my_cl_none->bounds(lower, upper);
+ my_os << "%none" << std::endl;
+ } else {
+ my_cl->bounds(lower, upper);
+ my_os << "%real" << std::endl;
+ }
+ my_os << "newpath" << std::endl;
+ Vertex v;
+ v.x = lower.x; v.y = lower.y; v.z = 0;
+ vertex(v, " moveto");
+ v.x = lower.x; v.y = upper.y; v.z = 0;
+ vertex(v, " lineto");
+ v.x = upper.x; v.y = upper.y; v.z = 0;
+ vertex(v, " lineto");
+ v.x = upper.x; v.y = lower.y; v.z = 0;
+ vertex(v, " lineto");
+ v.x = lower.x; v.y = lower.y; v.z = 0;
+ vertex(v, " lineto");
+ my_os << "closepath clip" << std::endl;
+ my_os << std::endl;
- // uncomment this to debug clipping
+ // uncomment this to debug clipping
#if 0
- _os << "0 0 0 99999 99999 99999 99999 0 1 0 0 setrgbcolor moveto lineto lineto lineto closepath fill";
- set_foreground(_fg);
+ my_os << "0 0 0 99999 99999 99999 99999 0 1 0 0 setrgbcolor moveto lineto lineto lineto closepath fill";
+ set_foreground(_fg);
#endif
#endif
}
void PostScript::DrawingKit::set_foreground(const Color &c)
{
- _fg = c;
- _os << "%set_foreground" << std::endl;
- _os << (_fg.red*_lt.red) << ' ' << (_fg.green*_lt.green) << ' ' << (_fg.blue*_lt.blue) << " setrgbcolor" << std::endl;
- _os << std::endl;
+ my_fg = c;
+ my_os << "%set_foreground" << std::endl
+ << (my_fg.red*my_lt.red) << ' '
+ << (my_fg.green*my_lt.green) << ' '
+ << (my_fg.blue*my_lt.blue) << " setrgbcolor" << std::endl
+ << std::endl;
}
void PostScript::DrawingKit::set_lighting(const Color &c)
{
- _lt = c;
- _os << "%set_lighting" << std::endl;
- _os << (_fg.red*_lt.red) << ' ' << (_fg.green*_lt.green) << ' ' << (_fg.blue*_lt.blue) << " setrgbcolor" << std::endl;
- _os << std::endl;
+ my_lt = c;
+ my_os << "%set_lighting" << std::endl
+ << (my_fg.red*my_lt.red) << ' '
+ << (my_fg.green*my_lt.green) << ' '
+ << (my_fg.blue*my_lt.blue) << " setrgbcolor" << std::endl
+ << std::endl;
}
void PostScript::DrawingKit::set_point_size(Coord s)
{
- _ps = s;
+ my_ps = s;
}
void PostScript::DrawingKit::set_line_width(Coord w)
{
- _lw = w;
- _os << "%set_line_width" << std::endl;
- _os << _lw*resolution(xaxis) << " setlinewidth" << std::endl;
- _os << std::endl;
+ my_lw = w;
+ my_os << "%set_line_width" << std::endl
+ << my_lw*resolution(xaxis) << " setlinewidth" << std::endl
+ << std::endl;
}
-void PostScript::DrawingKit::set_line_endstyle(Fresco::DrawingKit::Endstyle style)
+void
+PostScript::DrawingKit::set_line_endstyle(Fresco::DrawingKit::Endstyle style)
{
- _es = style;
- switch (_es) {
- case Fresco::DrawingKit::butt: _os << 0; break; //.< Butt
- case Fresco::DrawingKit::round: _os << 1; break; //.< Round
- case Fresco::DrawingKit::cap: _os << 2; break; //.< Square
- }
- _os << " setlinecap" << std::endl;
- _os << std::endl;
+ my_es = style;
+ switch (my_es)
+ {
+ case Fresco::DrawingKit::butt: my_os << 0; break; //.< Butt
+ case Fresco::DrawingKit::round: my_os << 1; break; //.< Round
+ case Fresco::DrawingKit::cap: my_os << 2; break; //.< Square
+ }
+ my_os << " setlinecap" << std::endl << std::endl;
}
void PostScript::DrawingKit::set_surface_fillstyle(Fresco::DrawingKit::Fillstyle style)
{
- _fs = style;
+ my_fs = style;
}
-void PostScript::DrawingKit::set_texture(Raster_ptr t)
-{
-}
+void PostScript::DrawingKit::set_texture(Raster_ptr t) { }
void PostScript::DrawingKit::draw_path(const Fresco::Path &path)
{
- _os << "%draw_path" << std::endl;
- _os << "newpath" << std::endl;
- Vertex v = path.nodes[path.nodes.length()-1];
- vertex(v, " moveto");
- for (unsigned long i = 1; i < path.nodes.length(); i++) {
- v = path.nodes[i];
- vertex(v, " lineto");
- }
- _os << "closepath";
- if (_fs == Fresco::DrawingKit::solid)
- _os << " fill" << std::endl;
- else
- _os << " stroke" << std::endl;
- _os << std::endl;
+ my_os << "%draw_path" << std::endl
+ << "newpath" << std::endl;
+ Vertex v = path.nodes[path.nodes.length()-1];
+ vertex(v, " moveto");
+ for (unsigned long i = 1; i < path.nodes.length(); ++i)
+ {
+ v = path.nodes[i];
+ vertex(v, " lineto");
+ }
+ my_os << "closepath";
+ if (my_fs == Fresco::DrawingKit::solid)
+ my_os << " fill" << std::endl;
+ else
+ my_os << " stroke" << std::endl;
+ my_os << std::endl;
}
void PostScript::DrawingKit::draw_new_path(const Fresco::NewPath &path)
-{
-}
+{ }
-void PostScript::DrawingKit::draw_rectangle(const Vertex &lower, const Vertex &upper)
+void PostScript::DrawingKit::draw_rectangle(const Vertex &lower,
+ const Vertex &upper)
{
- _os << "%draw_rectangle" << std::endl;
- _os << "newpath" << std::endl;
- Vertex v;
- v.x = lower.x; v.y = lower.y; v.z = 0;
- vertex(v, " moveto");
- v.x = lower.x; v.y = upper.y; v.z = 0;
- vertex(v, " lineto");
- v.x = upper.x; v.y = upper.y; v.z = 0;
- vertex(v, " lineto");
- v.x = upper.x; v.y = lower.y; v.z = 0;
- vertex(v, " lineto");
- v.x = lower.x; v.y = lower.y; v.z = 0;
- vertex(v, " lineto");
- _os << "closepath";
- if (_fs == Fresco::DrawingKit::solid)
- _os << " fill" << std::endl;
- else
- _os << " stroke" << std::endl;
-
- _os << std::endl;
-}
+ my_os << "%draw_rectangle" << std::endl
+ << "newpath" << std::endl;
+ Vertex v;
+ v.x = lower.x; v.y = lower.y; v.z = 0;
+ vertex(v, " moveto");
+ v.x = lower.x; v.y = upper.y; v.z = 0;
+ vertex(v, " lineto");
+ v.x = upper.x; v.y = upper.y; v.z = 0;
+ vertex(v, " lineto");
+ v.x = upper.x; v.y = lower.y; v.z = 0;
+ vertex(v, " lineto");
+ v.x = lower.x; v.y = lower.y; v.z = 0;
+ vertex(v, " lineto");
+ my_os << "closepath";
+ if (my_fs == Fresco::DrawingKit::solid)
+ my_os << " fill" << std::endl;
+ else
+ my_os << " stroke" << std::endl;
-inline void PostScript::DrawingKit::vertex(const Vertex &x, const char *c) {
- Vertex v = x;
- _tr->transform_vertex(v);
- _tr_adjust->transform_vertex(v);
- _os << v.x << ' ' << v.y << c << std::endl;
+ my_os << std::endl;
}
-void PostScript::DrawingKit::draw_quadric(const Fresco::DrawingKit::Quadric, Fresco::Coord, Fresco::Coord)
+inline void PostScript::DrawingKit::vertex(const Vertex &x,
+ const char *c)
{
+ Vertex v = x;
+ my_tr->transform_vertex(v);
+ my_tr_adjust->transform_vertex(v);
+ my_os << v.x << ' ' << v.y << c << std::endl;
}
-void PostScript::DrawingKit::draw_ellipse(const Vertex &lower, const Vertex &upper)
-{
-}
+void
+PostScript::DrawingKit::draw_quadric(const Fresco::DrawingKit::Quadric,
+ Fresco::Coord, Fresco::Coord)
+{ }
+
+void PostScript::DrawingKit::draw_ellipse(const Vertex &lower,
+ const Vertex &upper)
+{ }
void PostScript::DrawingKit::draw_image(Raster_ptr raster)
{
- Raster_var r = Raster::_duplicate(raster);
- _os << "%draw_image" << std::endl;
-
- _os << r->header().width << " " << r->header().height << " "
- << r->header().depth << std::endl;
- {
- Vertex o = {0., 0., 0.};
- Vertex i = {1.28354, 0., 0.};
- Vertex j = {0., 1.28354, 0.};
- _tr->transform_vertex(o);
- _tr->transform_vertex(i);
- _tr->transform_vertex(j);
- _os << "[ " << i.x-o.x << " " << i.y-o.y
- << " " << j.x-o.x << " " << -j.y+o.y;
- _tr_adjust->transform_vertex(o);
- _os << " " << -o.x*resolution(xaxis) << " " << o.y*resolution(yaxis) << " ]" << std::endl;
- }
+ Raster_var r = Raster::_duplicate(raster);
+ my_os << "%draw_image" << std::endl
+ << r->header().width << " " << r->header().height << " "
+ << r->header().depth << std::endl;
+ {
+ Vertex o = {0., 0., 0.};
+ Vertex i = {1.28354, 0., 0.};
+ Vertex j = {0., 1.28354, 0.};
+ my_tr->transform_vertex(o);
+ my_tr->transform_vertex(i);
+ my_tr->transform_vertex(j);
+ my_os << "[ " << i.x-o.x << " " << i.y-o.y
+ << " " << j.x-o.x << " " << -j.y+o.y;
+ my_tr_adjust->transform_vertex(o);
+ my_os << " " << -o.x*resolution(xaxis)
+ << " " << o.y*resolution(yaxis) << " ]" << std::endl;
+ }
- _os << "{<" << std::endl;
- Raster::Index i;
- for (i.y = 0; i.y < r->header().height; i.y++) {
- for (i.x = 0; i.x < r->header().width; i.x++) {
- Color c;
- char color[7];
- r->store_pixel(i, c);
- sprintf(color, "%02x%02x%02x", (int)(c.red*255), (int)(c.green*255), (int)(c.blue*255));
- _os << color;
+ my_os << "{<" << std::endl;
+ Raster::Index i;
+ for (i.y = 0; i.y < r->header().height; i.y++) {
+ for (i.x = 0; i.x < r->header().width; i.x++) {
+ Color c;
+ char color[7];
+ r->store_pixel(i, c);
+ sprintf(color, "%02x%02x%02x",
+ (int)(c.red*255),
+ (int)(c.green*255),
+ (int)(c.blue*255));
+ my_os << color;
+ }
+ my_os << std::endl;
}
- _os << std::endl;
- }
- _os << ">}" << std::endl;
- _os << "false 3 colorimage" << std::endl;
- _os << std::endl;
+ my_os << ">}" << std::endl
+ << "false 3 colorimage" << std::endl
+ << std::endl;
}
//FIXME: what units is our font size in?
void PostScript::DrawingKit::set_font_size(CORBA::ULong s)
{
- _os << "%set_font_size" << std::endl;
- _os << s << " scalefont" << std::endl;
- _os << std::endl;
+ my_os << "%set_font_size" << std::endl
+ << s << " scalefont" << std::endl
+ << std::endl;
}
-void PostScript::DrawingKit::set_font_weight(CORBA::ULong w) {}
-void PostScript::DrawingKit::set_font_family(const Unistring &f) {}
-void PostScript::DrawingKit::set_font_subfamily(const Unistring &sf) {}
-void PostScript::DrawingKit::set_font_fullname(const Unistring &fn) {}
-void PostScript::DrawingKit::set_font_style(const Unistring &s) {}
-void PostScript::DrawingKit::set_font_attribute(const NVPair & nvp) {}
-void PostScript::DrawingKit::allocate_text(const Unistring &s, Graphic::Requisition &req) {}
-void PostScript::DrawingKit::draw_text(const Unistring &us) {}
+void PostScript::DrawingKit::set_font_weight(CORBA::ULong w) { }
+void PostScript::DrawingKit::set_font_family(const Unistring &f) { }
+void PostScript::DrawingKit::set_font_subfamily(const Unistring &sf) { }
+void PostScript::DrawingKit::set_font_fullname(const Unistring &fn) { }
+void PostScript::DrawingKit::set_font_style(const Unistring &s) { }
+void PostScript::DrawingKit::set_font_attribute(const NVPair & nvp) { }
+void PostScript::DrawingKit::allocate_text(const Unistring &s,
+ Graphic::Requisition &req) { }
+void PostScript::DrawingKit::draw_text(const Unistring &us) { }
-void PostScript::DrawingKit::allocate_char(Unichar c, Graphic::Requisition &req)
+void PostScript::DrawingKit::allocate_char(Unichar c,
+ Graphic::Requisition &req)
{
- int width = 10;
- int height = 20;
- req.x.natural = req.x.minimum = req.x.maximum = width*10.;
- req.x.defined = true;
- req.x.align = 0.;
- req.y.natural = req.y.minimum = req.y.maximum = height*10.;
- req.y.defined = true;
- req.y.align = 1.;
+ int width = 10;
+ int height = 20;
+ req.x.natural = req.x.minimum = req.x.maximum = width*10.;
+ req.x.defined = true;
+ req.x.align = 0.;
+ req.y.natural = req.y.minimum = req.y.maximum = height*10.;
+ req.y.defined = true;
+ req.y.align = 1.;
}
void PostScript::DrawingKit::draw_char(Unichar c)
{
- _os << "%draw_char" << std::endl;
- _os << "gsave" << std::endl;
- Vertex o = {0., 0., 0.}; vertex(o, " moveto");
- Vertex i = {1., 0., 0.};
- Vertex j = {0., 1., 0.};
- _tr->transform_vertex(o);
- _tr_adjust->transform_vertex(o);
- _tr->transform_vertex(i);
- _tr_adjust->transform_vertex(i);
- _tr->transform_vertex(j);
- _tr_adjust->transform_vertex(j);
- // this is transposed from what makes sense to my brain.
- _os << "[ " << i.x-o.x << " " << j.x-o.x
- << " " << o.y-i.y << " " << o.y-j.y
- << " 0 0 ] concat" << std::endl;
+ my_os << "%draw_char" << std::endl
+ << "gsave" << std::endl;
+ Vertex o = {0., 0., 0.}; vertex(o, " moveto");
+ Vertex i = {1., 0., 0.};
+ Vertex j = {0., 1., 0.};
+ my_tr->transform_vertex(o);
+ my_tr_adjust->transform_vertex(o);
+ my_tr->transform_vertex(i);
+ my_tr_adjust->transform_vertex(i);
+ my_tr->transform_vertex(j);
+ my_tr_adjust->transform_vertex(j);
+ // this is transposed from what makes sense to my brain.
+ my_os << "[ " << i.x-o.x << " " << j.x-o.x
+ << " " << o.y-i.y << " " << o.y-j.y
+ << " 0 0 ] concat" << std::endl;
- char x[2];
- sprintf(x, "%02x", (int)c);
- _os << "<" << x << "> show" << std::endl;
- _os << "grestore" << std::endl;
- _os << std::endl;
+ char x[2];
+ sprintf(x, "%02x", (int)c);
+ my_os << "<" << x << "> show" << std::endl
+ << "grestore" << std::endl
+ << std::endl;
}
-void PostScript::DrawingKit::copy_drawable(Drawable_ptr d, PixelCoord x, PixelCoord y, PixelCoord w, PixelCoord h) {}
+void PostScript::DrawingKit::copy_drawable(Drawable_ptr d,
+ PixelCoord x, PixelCoord y,
+ PixelCoord w, PixelCoord h) { }
-extern "C" KitImpl *load()
+extern "C" Berlin::KitImpl *load()
{
- static std::string properties[] = {"implementation", "PSDrawingKit"};
- return create_prototype<PostScript::DrawingKit>("IDL:fresco.org/Fresco/DrawingKit:1.0", properties, 2);
+ static std::string properties[] = {"implementation", "PSDrawingKit"};
+ return Berlin::create_prototype<PostScript::DrawingKit>("IDL:fresco.org/Fresco/DrawingKit:1.0", properties, 2);
}
Index: DrawingKit.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Drawing/PostScript/DrawingKit.hh,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- DrawingKit.hh 27 May 2003 23:12:44 -0000 1.17
+++ DrawingKit.hh 29 Dec 2003 08:03:22 -0000 1.18
@@ -20,8 +20,8 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _DrawingKit_hh
-#define _DrawingKit_hh
+#ifndef _Postscript_DrawingKit_hh
+#define _Postscript_DrawingKit_hh
#include <Fresco/config.hh>
#include <Fresco/Raster.hh>
@@ -33,97 +33,118 @@
namespace Berlin
{
-namespace DrawingKit
-{
-namespace PostScript
-{
-
-class DrawingKit : public DrawingKitBase, public KitImpl
-{
-public:
- DrawingKit(const std::string &,
- const Fresco::Kit::PropertySeq &,
- ServerContextImpl *);
- virtual ~DrawingKit();
- virtual KitImpl *clone(const Fresco::Kit::PropertySeq &, ServerContextImpl *);
-
- virtual void transformation(Fresco::Transform_ptr t) { DrawingKitBase::transformation(t);}
- virtual Fresco::Transform_ptr transformation() { return Fresco::Transform::_duplicate(_tr);}
- virtual void clipping(Fresco::Region_ptr r) { DrawingKitBase::clipping(r);}
- virtual Fresco::Region_ptr clipping() { return Fresco::Region::_duplicate(_cl);}
-// using DrawingKitBase::foreground;
- virtual Fresco::Color foreground() { return _fg;}
- virtual Fresco::Color lighting() { return _lt;}
- virtual Fresco::Coord point_size() { return _ps;}
- virtual Fresco::Coord line_width() { return _lw;}
- virtual Fresco::DrawingKit::Endstyle line_endstyle() { return _es;}
- virtual Fresco::DrawingKit::Fillstyle surface_fillstyle() { return _fs;}
- virtual Fresco::Raster_ptr texture() { return Fresco::Raster::_nil();}
-
- virtual CORBA::ULong font_size() { return 12;}
- virtual CORBA::ULong font_weight() { return 1;}
- virtual Fresco::Unistring *font_family();
- virtual Fresco::Unistring *font_subfamily();
- virtual Fresco::Unistring *font_fullname();
- virtual Fresco::Unistring *font_style();
- virtual Fresco::DrawingKit::FontMetrics font_metrics();
- virtual Fresco::DrawingKit::GlyphMetrics glyph_metrics(Fresco::Unichar);
- virtual CORBA::Any *get_font_attribute(const Fresco::Unistring &);
+ namespace DrawingKit
+ {
+ namespace PostScript
+ {
- virtual void set_transformation(Fresco::Transform_ptr);
- virtual void set_clipping(Fresco::Region_ptr);
- virtual void set_foreground(const Fresco::Color &);
- virtual void set_lighting(const Fresco::Color &);
- virtual void set_point_size(Fresco::Coord);
- virtual void set_line_width(Fresco::Coord);
- virtual void set_line_endstyle(Fresco::DrawingKit::Endstyle);
- virtual void set_surface_fillstyle(Fresco::DrawingKit::Fillstyle);
- virtual void set_texture(Fresco::Raster_ptr);
+ class DrawingKit : public DrawingKitBase, public KitImpl
+ {
+ public:
+ DrawingKit(const std::string &,
+ const Fresco::Kit::PropertySeq &,
+ ServerContextImpl *);
+ virtual ~DrawingKit();
+ virtual KitImpl *clone(const Fresco::Kit::PropertySeq &,
+ ServerContextImpl *);
+
+ virtual void transformation(Fresco::Transform_ptr t)
+ { DrawingKitBase::transformation(t); }
+ virtual Fresco::Transform_ptr transformation()
+ { return Fresco::Transform::_duplicate(my_tr); }
+ virtual void clipping(Fresco::Region_ptr r)
+ { DrawingKitBase::clipping(r); }
+ virtual Fresco::Region_ptr clipping()
+ { return Fresco::Region::_duplicate(my_cl); }
+ // using DrawingKitBase::foreground;
+ virtual Fresco::Color foreground() { return my_fg; }
+ virtual Fresco::Color lighting() { return my_lt; }
+ virtual Fresco::Coord point_size() { return my_ps; }
+ virtual Fresco::Coord line_width() { return my_lw; }
+ virtual Fresco::DrawingKit::Endstyle line_endstyle()
+ { return my_es; }
+ virtual Fresco::DrawingKit::Fillstyle surface_fillstyle()
+ { return my_fs; }
+ virtual Fresco::Raster_ptr texture()
+ { return Fresco::Raster::_nil(); }
- virtual void set_font_size(CORBA::ULong);
- virtual void set_font_weight(CORBA::ULong);
- virtual void set_font_family(const Fresco::Unistring &);
- virtual void set_font_subfamily(const Fresco::Unistring &);
- virtual void set_font_fullname(const Fresco::Unistring &);
- virtual void set_font_style(const Fresco::Unistring &);
- virtual void set_font_attribute(const Fresco::NVPair &);
+ virtual CORBA::ULong font_size() { return 12; }
+ virtual CORBA::ULong font_weight() { return 1; }
+ virtual Fresco::Unistring *font_family();
+ virtual Fresco::Unistring *font_subfamily();
+ virtual Fresco::Unistring *font_fullname();
+ virtual Fresco::Unistring *font_style();
+ virtual Fresco::DrawingKit::FontMetrics font_metrics();
+ virtual Fresco::DrawingKit::GlyphMetrics
+ glyph_metrics(Fresco::Unichar);
+ virtual CORBA::Any *
+ get_font_attribute(const Fresco::Unistring &);
- virtual Fresco::Coord resolution(Fresco::Axis) { return 0.283464566929;}
- virtual void draw_path(const Fresco::Path &);
- virtual void draw_new_path(const Fresco::NewPath &);
-// virtual void drawPatch(const Fresco::Patch &);
- virtual void draw_rectangle(const Fresco::Vertex &, const Fresco::Vertex &);
- virtual void draw_quadric(const Fresco::DrawingKit::Quadric, Fresco::Coord, Fresco::Coord);
- virtual void draw_ellipse(const Fresco::Vertex &, const Fresco::Vertex &);
- virtual void draw_image(Fresco::Raster_ptr);
- virtual void allocate_char(Fresco::Unichar, Fresco::Graphic::Requisition &);
- virtual void draw_char(Fresco::Unichar);
- virtual void allocate_text(const Fresco::Unistring &, Fresco::Graphic::Requisition &);
- virtual void draw_text(const Fresco::Unistring &);
- virtual void copy_drawable(Fresco::Drawable_ptr, Fresco::PixelCoord, Fresco::PixelCoord, Fresco::PixelCoord, Fresco::PixelCoord);
+ virtual void set_transformation(Fresco::Transform_ptr);
+ virtual void set_clipping(Fresco::Region_ptr);
+ virtual void set_foreground(const Fresco::Color &);
+ virtual void set_lighting(const Fresco::Color &);
+ virtual void set_point_size(Fresco::Coord);
+ virtual void set_line_width(Fresco::Coord);
+ virtual void set_line_endstyle(Fresco::DrawingKit::Endstyle);
+ virtual void
+ set_surface_fillstyle(Fresco::DrawingKit::Fillstyle);
+ virtual void set_texture(Fresco::Raster_ptr);
+
+ virtual void set_font_size(CORBA::ULong);
+ virtual void set_font_weight(CORBA::ULong);
+ virtual void set_font_family(const Fresco::Unistring &);
+ virtual void set_font_subfamily(const Fresco::Unistring &);
+ virtual void set_font_fullname(const Fresco::Unistring &);
+ virtual void set_font_style(const Fresco::Unistring &);
+ virtual void set_font_attribute(const Fresco::NVPair &);
+
+ virtual Fresco::Coord
+ resolution(Fresco::Axis) { return 0.283464566929; }
+ virtual void draw_path(const Fresco::Path &);
+ virtual void draw_new_path(const Fresco::NewPath &);
+ // virtual void drawPatch(const Fresco::Patch &);
+ virtual void draw_rectangle(const Fresco::Vertex &,
+ const Fresco::Vertex &);
+ virtual void draw_quadric(const Fresco::DrawingKit::Quadric,
+ Fresco::Coord, Fresco::Coord);
+ virtual void draw_ellipse(const Fresco::Vertex &,
+ const Fresco::Vertex &);
+ virtual void draw_image(Fresco::Raster_ptr);
+ virtual void allocate_char(Fresco::Unichar,
+ Fresco::Graphic::Requisition &);
+ virtual void draw_char(Fresco::Unichar);
+ virtual void allocate_text(const Fresco::Unistring &,
+ Fresco::Graphic::Requisition &);
+ virtual void draw_text(const Fresco::Unistring &);
+ virtual void copy_drawable(Fresco::Drawable_ptr,
+ Fresco::PixelCoord,
+ Fresco::PixelCoord,
+ Fresco::PixelCoord,
+ Fresco::PixelCoord);
- virtual void start_traversal(Fresco::Traversal_ptr);
- virtual void finish_traversal();
+ virtual void start_traversal(Fresco::Traversal_ptr);
+ virtual void finish_traversal();
- virtual void flush() {}
-private:
- void vertex(const Fresco::Vertex &, const char *);
- Prague::Mutex _mutex;
- Fresco::Transform_var _tr;
- Fresco::Transform_var _tr_adjust;
- Fresco::Region_var _cl;
- RegionImpl *_cl_none;
- Fresco::Color _fg;
- Fresco::Color _lt;
- Fresco::Coord _ps;
- Fresco::Coord _lw;
- Fresco::DrawingKit::Endstyle _es;
- Fresco::DrawingKit::Fillstyle _fs;
- std::ostream _os;
-};
+ virtual void flush() {}
+ private:
+ void vertex(const Fresco::Vertex &, const char *);
+ Prague::Mutex my_mutex;
+ Fresco::Transform_var my_tr;
+ Fresco::Transform_var my_tr_adjust;
+ Fresco::Region_var my_cl;
+ RegionImpl *my_cl_none;
+ Fresco::Color my_fg;
+ Fresco::Color my_lt;
+ Fresco::Coord my_ps;
+ Fresco::Coord my_lw;
+ Fresco::DrawingKit::Endstyle my_es;
+ Fresco::DrawingKit::Fillstyle my_fs;
+ std::ostream my_os;
+ };
-} // namespace
-} // namespace
+ } // namespace
+ } // namespace
} // namespace
#endif