Commit 9bfbb4ab authored by Paul Asmuth's avatar Paul Asmuth
Browse files

rename RenderTarget -> Layer

parent 8dbb2142
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -12,11 +12,11 @@
#include <cairo.h>
#include <vector>
#include <string>
#include "rendertarget.h"
#include "layer.h"

namespace signaltk {

class CairoBackend : public chart::RenderTarget {
class CairoBackend : public chart::Layer {
public:

  CairoBackend();
+58 −0
Original line number Diff line number Diff line
/**
 * This file is part of the "signaltk" project
 *   Copyright (c) 2018 Paul Asmuth
 *   Copyright (c) 2014 Paul Asmuth, Google Inc.
 *
 * libstx is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License v3.0. You should have received a
 * copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
#ifndef _libstx_Image_H
#define _libstx_Image_H
#include <stdlib.h>
#include <vector>
#include <string>
#include "colour.h"
#include "path.h"
#include "brush.h"

namespace signaltk {
namespace chart {

class Image {
public:
  virtual ~Image() {}

  virtual void drawText(
      const std::string& text,
      double x,
      double y,
      const std::string& halign,
      const std::string& valign,
      const std::string& class_name,
      double rotate = 0.0f) = 0;

  virtual void strokePath(
      const PathData* point_data,
      size_t point_count,
      const StrokeStyle& style) = 0;

  void strokeLine(
      double x1,
      double y1,
      double x2,
      double y2,
      const StrokeStyle& style) {
    Path p;
    p.moveTo(x1, y1);
    p.lineTo(x2, y2);
    strokePath(p.data(), p.size(), style);
  }

};


}
}
#endif
+2 −2
Original line number Diff line number Diff line
@@ -20,9 +20,9 @@
namespace signaltk {
namespace chart {

class RenderTarget {
class Layer {
public:
  virtual ~RenderTarget() {}
  virtual ~Layer() {}

  virtual void drawText(
      const std::string& text,
+5 −5
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
 * <http://www.gnu.org/licenses/>.
 */
#include <stdlib.h>
#include "../core/rendertarget.h"
#include "../core/layer.h"
#include "../graphics/svgtarget.h"
#include "canvas.h"
#include "domain.h"
@@ -21,7 +21,7 @@ Legend::Legend() :
    height_(320) {}

void Legend::renderOutsideLegends(
    RenderTarget* target,
    Layer* target,
    Viewport* viewport) const {
  for (const auto& legend : legends_) {
    if (legend->placement() != LegendDefinition::LEGEND_OUTSIDE) {
@@ -92,7 +92,7 @@ void Legend::renderOutsideLegends(
}

void Legend::renderInsideLegends(
    RenderTarget* target,
    Layer* target,
    Viewport* viewport) const {
  auto orig_padding = viewport->padding();

@@ -135,7 +135,7 @@ void Legend::renderInsideLegends(
}

void Legend::renderRightLegend(
    RenderTarget* target,
    Layer* target,
    Viewport* viewport,
    LegendDefinition* legend,
    double horiz_padding,
@@ -212,7 +212,7 @@ void Legend::renderRightLegend(
}

void Legend::renderLeftLegend(
    RenderTarget* target,
    Layer* target,
    Viewport* viewport,
    LegendDefinition* legend,
    double horiz_padding,
+7 −7
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@

namespace signaltk {
namespace chart {
class RenderTarget;
class Layer;

class Legend {
public:
@@ -56,24 +56,24 @@ public:
  /**
   * Render the contents of this canvas to the provided render target
   *
   * @param target a RenderTarget subclass instance. Does not transfer ownership
   * @param target a Layer subclass instance. Does not transfer ownership
   */
  void render(RenderTarget* target) const;
  void render(Layer* target) const;

protected:

  /**
   * Render the legends
   */
  void renderOutsideLegends(RenderTarget* target, Viewport* viewport) const;
  void renderOutsideLegends(Layer* target, Viewport* viewport) const;

  /**
   * Render the legends
   */
  void renderInsideLegends(RenderTarget* target, Viewport* viewport) const;
  void renderInsideLegends(Layer* target, Viewport* viewport) const;

  void renderRightLegend(
      RenderTarget* target,
      Layer* target,
      Viewport* viewport,
      LegendDefinition* legend,
      double horiz_padding,
@@ -81,7 +81,7 @@ protected:
      bool outside) const;

  void renderLeftLegend(
      RenderTarget* target,
      Layer* target,
      Viewport* viewport,
      LegendDefinition* legend,
      double horiz_padding,
Loading