File: vtkAbstractContextBufferId.h

package info (click to toggle)
paraview 4.0.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 526,572 kB
  • sloc: cpp: 2,284,430; ansic: 816,374; python: 239,936; xml: 70,162; tcl: 48,295; fortran: 39,116; yacc: 5,466; java: 3,518; perl: 3,107; lex: 1,620; sh: 1,555; makefile: 932; asm: 471; pascal: 228
file content (106 lines) | stat: -rw-r--r-- 3,673 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkAbstractContextBufferId.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

// .NAME vtkAbstractContextBufferId - 2D array of ids, used for picking.
//
// .SECTION Description
// An 2D array where each element is the id of an entity drawn at the given
// pixel. The access is not specified in this class.
// The effective/concrete subclass vtkContextBufferId stores the whole buffer
// in RAM. The access to a value is fast and independent of the OpenGL.
// However it requires to first fill the whole buffer by transferring the
// buffer generated by OpenGL from the VRAM to the RAM. It is inefficient if
// the context of the scene changes during interaction.
//
// The effective/concrete subclass vtkOpenGLContextBufferId keeps the buffer id
// on the VRAM in a texture image. The access to a value is slower than a
// simple read access to an array but it does not require a large transfer of
// data from the VRAM to the RAM.
//
// .SECTION See Also
// vtkContextBufferId, vtkOpenGLContextBufferId

#ifndef __vtkAbstractContextBufferId_h
#define __vtkAbstractContextBufferId_h

#include "vtkRenderingContext2DModule.h" // For export macro
#include "vtkObject.h"

class VTKRENDERINGCONTEXT2D_EXPORT vtkAbstractContextBufferId : public vtkObject
{
public:
  vtkTypeMacro(vtkAbstractContextBufferId, vtkObject);
  virtual void PrintSelf(ostream &os, vtkIndent indent);

  // Description:
  // Number of columns. Initial value is 0.
  vtkGetMacro(Width,int);

  // Description:
  // Set the number of columns. Initial value is 0.
  vtkSetMacro(Width,int);

  // Description:
  // Number of rows. Initial value is 0.
  vtkGetMacro(Height,int);

  // Description:
  // Set the number of rows. Initial value is 0.
  vtkSetMacro(Height,int);

  // Description:
  // Allocate the memory for at least Width*Height elements.
  // \pre positive_width: GetWidth()>0
  // \pre positive_height: GetHeight()>0
  virtual void Allocate()=0;

  // Description:
  // Tell if the buffer has been allocated.
  virtual bool IsAllocated() const=0;

  // Description:
  // Copy the contents of the current read buffer to the internal structure
  // starting at lower left corner of the framebuffer (srcXmin,srcYmin).
  // \pre is_allocated: this->IsAllocated()
  virtual void SetValues(int srcXmin,
                         int srcYmin)=0;

  // Description:
  // Return item under abscissa x and ordinate y.
  // Abscissa go from left to right.
  // Ordinate go from bottom to top.
  // The return value is -1 if there is no item.
  // \pre is_allocated: IsAllocated()
  // \post valid_result: result>=-1
  virtual vtkIdType GetPickedItem(int x, int y)=0;

  // Description:
  // Release any graphics resources that are being consumed by this object.
  // Default implementation is empty.
  virtual void ReleaseGraphicsResources();

protected:
  vtkAbstractContextBufferId();
  virtual ~vtkAbstractContextBufferId();

  int Width;
  int Height;

private:
  vtkAbstractContextBufferId(const vtkAbstractContextBufferId &); // Not implemented.
  void operator=(const vtkAbstractContextBufferId &);   // Not implemented.
};

#endif // #ifndef __vtkAbstractContextBufferId_h