Chemical Data Processing Library C++ API - Version 1.2.0
ImageWriter.hpp
Go to the documentation of this file.
1 /*
2  * ImageWriter.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
24 
25 #ifndef CDPL_VIS_IMAGEWRITER_HPP
26 #define CDPL_VIS_IMAGEWRITER_HPP
27 
28 #include <memory>
29 
30 #include "CDPL/Vis/APIPrefix.hpp"
31 
32 
33 typedef struct _cairo_surface cairo_surface_t;
34 
35 
36 namespace CDPL
37 {
38 
39  namespace Base
40  {
41 
42  class DataIOBase;
43  }
44 
45  namespace Chem
46  {
47 
48  class Reaction;
49  class MolecularGraph;
50  } // namespace Chem
51 
52  namespace Vis
53  {
54 
55  class View2D;
56  class ReactionView2D;
57  class StructureView2D;
58  class Rectangle2D;
59 
61  {
62 
63  protected:
64  ImageWriter(const Base::DataIOBase& io_base);
65 
66  ImageWriter(const ImageWriter&) = delete;
67 
68  virtual ~ImageWriter();
69 
70  ImageWriter& operator=(const ImageWriter&) = delete;
71 
74 
75  virtual cairo_surface_t* createCairoSurface(double, double) const = 0;
76  virtual cairo_surface_t* createCairoSurface() const = 0;
77 
78  private:
79  cairo_surface_t* renderImage(View2D&) const;
80 
81  void getImageBounds(View2D&, Rectangle2D&) const;
82 
83  typedef std::unique_ptr<StructureView2D> StructureViewPtr;
84  typedef std::unique_ptr<ReactionView2D> ReactionViewPtr;
85 
86  const Base::DataIOBase& ioBase;
87  StructureViewPtr structureView;
88  ReactionViewPtr reactionView;
89  };
90  } // namespace Vis
91 } // namespace CDPL
92 
93 #endif // CDPL_VIS_IMAGEWRITER_HPP
struct _cairo_surface cairo_surface_t
Definition: CairoPointer.hpp:36
Definition of the preprocessor macro CDPL_VIS_API.
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Provides infrastructure for the registration of I/O callback functions.
Definition: DataIOBase.hpp:59
MolecularGraph.
Definition: MolecularGraph.hpp:52
Reaction.
Definition: Reaction.hpp:52
Definition: ImageWriter.hpp:61
cairo_surface_t * renderMolGraphImage(const Chem::MolecularGraph &)
cairo_surface_t * renderReactionImage(const Chem::Reaction &)
ImageWriter(const ImageWriter &)=delete
virtual cairo_surface_t * createCairoSurface() const =0
ImageWriter(const Base::DataIOBase &io_base)
virtual cairo_surface_t * createCairoSurface(double, double) const =0
ImageWriter & operator=(const ImageWriter &)=delete
Specifies an axis aligned rectangular area in 2D space.
Definition: Rectangle2D.hpp:51
The abstract base of classes implementing the 2D visualization of data objects.
Definition: View2D.hpp:59
The namespace of the Chemical Data Processing Library.