Developer documentation
Version 3.0.3-105-gd3941f44
undoentry.h
Go to the documentation of this file.
1/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 *
7 * Covered Software is provided under this License on an "as is"
8 * basis, without warranty of any kind, either expressed, implied, or
9 * statutory, including, without limitation, warranties that the
10 * Covered Software is free of defects, merchantable, fit for a
11 * particular purpose or non-infringing.
12 * See the Mozilla Public License v. 2.0 for more details.
13 *
14 * For more details, see http://www.mrtrix.org/.
15 */
16
17#ifndef __gui_mrview_tool_roi_editor_undoentry_h__
18#define __gui_mrview_tool_roi_editor_undoentry_h__
19
20#include <array>
21#include <atomic>
22
23#include "types.h"
24
25#include "gui/opengl/shader.h"
26#include "gui/opengl/gl.h"
27
28
29namespace MR
30{
31 namespace GUI
32 {
33 namespace MRView
34 {
35 namespace Tool
36 {
37
38
39 class ROI_Item;
40
41
43
44 ROI_UndoEntry (ROI_Item&, int, int);
45 ROI_UndoEntry (const ROI_UndoEntry&) = delete;
48
49 ROI_UndoEntry& operator= (const ROI_UndoEntry&) = delete;
51
52 void draw_line (ROI_Item&, const Eigen::Vector3f&, const Eigen::Vector3f&, const bool);
53 void draw_thick_line (ROI_Item&, const Eigen::Vector3f&, const Eigen::Vector3f&, const bool, const float);
54 void draw_circle (ROI_Item&, const Eigen::Vector3f&, const bool, const float);
55 void draw_rectangle (ROI_Item&, const Eigen::Vector3f&, const Eigen::Vector3f&, const bool);
56 void draw_fill (ROI_Item&, const Eigen::Vector3f&, const bool);
57
58 void undo (ROI_Item& roi);
59 void redo (ROI_Item& roi);
60 void copy (ROI_Item& roi, ROI_UndoEntry& source);
61
62 std::array<GLint,3> from, size;
63 std::array<GLint,2> tex_size, slice_axes;
64 vector<GLubyte> before, after;
65
66 class Shared
68 public:
69 Shared();
70 ~Shared();
71 GL::Shader::Program program;
72 GL::VertexBuffer vertex_buffer;
73 GL::VertexArrayObject vertex_array_object;
74 void operator++ ();
75 bool operator-- ();
76 private:
77 std::atomic<uint32_t> count;
78 };
79 static std::unique_ptr<Shared> shared;
80
81 };
82
83
84
85
86
87 }
88 }
89 }
90}
91
92#endif
93
94
Definition: undoentry.h:67
Definition: base.h:24
Definition: types.h:303
Definition: undoentry.h:42
std::array< GLint, 2 > tex_size
Definition: undoentry.h:63
std::array< GLint, 2 > slice_axes
Definition: undoentry.h:63
void undo(ROI_Item &roi)
void draw_line(ROI_Item &, const Eigen::Vector3f &, const Eigen::Vector3f &, const bool)
void copy(ROI_Item &roi, ROI_UndoEntry &source)
std::array< GLint, 3 > from
Definition: undoentry.h:62
vector< GLubyte > before
Definition: undoentry.h:64
void draw_circle(ROI_Item &, const Eigen::Vector3f &, const bool, const float)
std::array< GLint, 3 > size
Definition: undoentry.h:62
MEMALIGN(ROI_UndoEntry) ROI_UndoEntry(ROI_Item &
void redo(ROI_Item &roi)
void draw_thick_line(ROI_Item &, const Eigen::Vector3f &, const Eigen::Vector3f &, const bool, const float)
vector< GLubyte > after
Definition: undoentry.h:64
void draw_rectangle(ROI_Item &, const Eigen::Vector3f &, const Eigen::Vector3f &, const bool)
void draw_fill(ROI_Item &, const Eigen::Vector3f &, const bool)
static std::unique_ptr< Shared > shared
Definition: undoentry.h:79