Changeset 1007 for trunk/lib


Ignore:
Timestamp:
Jan 3, 2010, 7:09:43 PM (12 years ago)
Author:
Peter Johansson
Message:

refs #405

Support for png images, which is now default. Using alhpa channel in
plstream for png did not work well in any straghtforward way so made
PNGs opaque.

Location:
trunk/lib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Directory.cc

    r1005 r1007  
    2424
    2525#include "Alias.h"
     26#include "Configuration.h"
    2627#include "File.h"
    2728#include "html_utility.h"
     
    187188    ss << "../../../";
    188189    if (user=="all")
    189       ss << stats.plot(imagedir+"/index.svg", line_type);
     190      ss << stats.plot(imagedir+"/index", line_type);
    190191    else
    191       ss << imagedir << "/index.svg";
     192      ss << imagedir << "/index";
    192193    os << "<p class=\"plot\">\n";
    193     os << image("svg", ss.str());
     194    os << image(Configuration::instance().image_format(), ss.str());
    194195    os << "</p>\n";
    195196
  • trunk/lib/File.cc

    r1005 r1007  
    368368      lpath = "index";
    369369    std::string outpath = stats_type+"/"+user+"/"+line_type+"/"+lpath;
    370     std::string imagefile = stats_type+"/"+"images/"+line_type+"/"+
    371       lpath+".svg";
     370    std::string imagefile = stats_type+"/"+"images/"+line_type+"/"+lpath;
    372371    std::string html_name(outpath + ".html");
    373372    std::ofstream os(html_name.c_str());
     
    385384      ss << imagefile;
    386385    os << "<p class=\"plot\">\n";
    387     os << image("svg", ss.str());
     386    os << image(Configuration::instance().image_format(), ss.str());
    388387    os << "</p>\n";
    389388
  • trunk/lib/Graph.cc

    r951 r1007  
    3333  std::vector<std::string> Graph::xticks_;
    3434
    35   Graph::Graph(const std::string& filename)
     35  Graph::Graph(const std::string& filename, const std::string& format)
    3636#ifdef HAVE_PLPLOT
    37     : plots_(0), pls_(1,1,"svg",filename.c_str()), timeformat_("%y-%b"),
     37    : plots_(0), pls_(1,1,format.c_str(),filename.c_str()), timeformat_("%y-%b"),
    3838      title_(filename), xmin_(0.0), xmax_(0.0), ymin_(0.0), ymax_(0.0)
    3939  {
     
    4242    legend_.reserve(10);
    4343    // we use color map 0 position 0 for background color
    44     pls_.scolbga(255,255,255,0);
     44    if (format=="png")
     45      pls_.scolbg(255,255,255);
     46    else
     47      pls_.scolbga(255,255,255,0);
    4548    pls_.init();
    4649    pls_.adv(0);
  • trunk/lib/Graph.h

    r946 r1007  
    6464       the graph object is destroyed.
    6565    */
    66     explicit Graph(const std::string& filename);
     66    Graph(const std::string& filename, const std::string& format);
    6767
    6868    /**
  • trunk/lib/Stats.cc

    r1004 r1007  
    2525
    2626#include "Colors.h"
     27#include "Configuration.h"
    2728#include "Functor.h"
    2829#include "Graph.h"
     
    364365  {
    365366    assert(total_stats().size());
    366     Graph gp(filename);
     367    Graph gp(filename+"."+Configuration::instance().image_format(),
     368             Configuration::instance().image_format());
    367369    const Author2Vector* stat=NULL;
    368370    if (linetype=="total")
     
    431433  void Stats::plot_summary(const std::string& filename) const
    432434  {
    433     Graph gp(filename);
     435    Graph gp(filename+"."+Configuration::instance().image_format(),
     436             Configuration::instance().image_format());
    434437    std::vector<unsigned int> total = get_vector(total_stats(), "all");
    435438    double yrange_max=1.03*total.back()+1;
  • trunk/lib/first_page.cc

    r1005 r1007  
    230230  void print_summary_plot(std::ostream& os, const Stats& stats)
    231231  {
    232     std::string name("summary_plot.svg");
     232    std::string name("summary_plot");
    233233    stats.plot_summary(name);
    234234    os << "<div class=\"main\">\n";
    235     os << image("svg", name);
     235    os << image(Configuration::instance().image_format(), name);
    236236    os << "</div>";
    237237
  • trunk/lib/html_utility.cc

    r1006 r1007  
    6666    std::ostringstream os;
    6767    if (format=="svg")
    68       os << "<object data='" << name << "' type='image/svg+xml' width='600'>\n"
    69          << "<embed src='" << name << "' type='image/svg+xml' width='600' />\n"
     68      os << "<object data='" << name << ".svg' type='image/svg+xml'"
     69         << " width='600'>\n"
     70         << "<embed src='" << name << ".svg' type='image/svg+xml'"
     71         << " width='600' />\n"
    7072         << "</object>\n";
     73    else if (format=="png")
     74      os << "<img src='" << name << ".png' alt='[plot]'/>";
    7175    else {
    7276      assert(false);
Note: See TracChangeset for help on using the changeset viewer.