FastUIDraw
painter_attribute_data.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter_attribute_data.hpp
3  * \brief file painter_attribute_data.hpp
4  *
5  * Copyright 2016 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16  *
17  */
18 
19 
20 #ifndef FASTUIDRAW_PAINTER_ATTRIBUTE_DATA_HPP
21 #define FASTUIDRAW_PAINTER_ATTRIBUTE_DATA_HPP
22 
23 #include <fastuidraw/util/util.hpp>
26 
27 namespace fastuidraw
28 {
29 /*!\addtogroup PainterAttribute
30  * @{
31  */
32 
33  /*!
34  * \brief
35  * PainterAttributeData represents the attribute and index
36  * data ready to be consumed by a Painter. Data is organized
37  * into individual chuncks that can be drawn seperately.
38  */
40  {
41  public:
42  /*!
43  * Ctor.
44  */
46 
48 
49  /*!
50  * Set the index, attribute, z-increment and chunk
51  * data of this PainterAttributeData using a
52  * PainterAttributeDataFiller.
53  * \param filler object that fills the data.
54  */
55  void
56  set_data(const PainterAttributeDataFiller &filler);
57 
58  /*!
59  * Returns the attribute data chunks. Usually, for each
60  * attribute data chunk, there is a matching index data
61  * chunk. Usually, one uses index_data_chunks()[i]
62  * to draw the contents of attribute_data_chunks()[i].
63  */
65  attribute_data_chunks(void) const;
66 
67  /*!
68  * Provided as an API conveniance to fetch
69  * the named chunk of attribute_data_chunks()
70  * or an empty chunk if the index is larger then
71  * attribute_data_chunks().size().
72  * \param i index of attribute_data_chunks() to fetch
73  */
75  attribute_data_chunk(unsigned int i) const;
76 
77  /*!
78  * Returns the size of the largest attribute chunk.
79  */
80  unsigned int
81  largest_attribute_chunk(void) const;
82 
83  /*!
84  * Returns the index data chunks. Usually, for each
85  * attribute data chunk, there is a matching index data
86  * chunk. Usually, one uses index_data_chunks()[i]
87  * to draw the contents of attribute_data_chunks()[i].
88  */
90  index_data_chunks(void) const;
91 
92  /*!
93  * Returns the size of the largest index chunk.
94  */
95  unsigned int
96  largest_index_chunk(void) const;
97 
98  /*!
99  * Returns the index adjust value for all chunks.
100  * The index adjust value is by how much to adjust
101  * the indices of an index chunk.
102  */
104  index_adjust_chunks(void) const;
105 
106  /*!
107  * Provided as an API conveniance to fetch
108  * the named chunk of index_data_chunks()
109  * or an empty chunk if the index is larger then
110  * index_data_chunks().size().
111  * \param i index of index_data_chunks() to fetch
112  */
114  index_data_chunk(unsigned int i) const;
115 
116  /*!
117  * Provided as an API conveniance to fetch
118  * the index adjust for the named chunk.
119  * \param i index of index_adjust_chunks() to fetch
120  */
121  int
122  index_adjust_chunk(unsigned int i) const;
123 
124  /*!
125  * Returns an array that holds those value i
126  * for which index_data_chunk(i) is non-empty.
127  */
129  non_empty_index_data_chunks(void) const;
130 
131  /*!
132  * Returns the z-range of the data in an chunk.
133  * Recall that the z-value is used by Painter
134  * to perform occluding. When an item is to
135  * self occlude, z_ranges()[C] holds the
136  * relative z-ranges of the z-value emitted
137  * by the item's vertex shader.
138  */
140  z_ranges(void) const;
141 
142  /*!
143  * Provided as an API conveniance to fetch
144  * the named z-range value of z_ranges() or
145  * range_type(0, 0) if the index is
146  * larger then z_ranges().size().
147  * \param i index into z_ranges() to fetch
148  */
150  z_range(unsigned int i) const;
151 
152  private:
153  void *m_d;
154  };
155 /*! @} */
156 }
157 
158 #endif
unsigned int largest_index_chunk(void) const
int index_adjust_chunk(unsigned int i) const
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
c_array< const PainterAttribute > attribute_data_chunk(unsigned int i) const
range_type< int > z_range(unsigned int i) const
PainterAttributeData represents the attribute and index data ready to be consumed by a Painter...
A PainterAttributeDataFiller is the interfaceto fill the data held by a PainterAttributeData.
file painter_attribute_data_filler.hpp
c_array< const c_array< const PainterAttribute > > attribute_data_chunks(void) const
c_array< const PainterIndex > index_data_chunk(unsigned int i) const
file util.hpp
unsigned int largest_attribute_chunk(void) const
A c_array is a wrapper over a C pointer with a size parameter to facilitate bounds checking and provi...
Definition: c_array.hpp:43
c_array< const int > index_adjust_chunks(void) const
c_array< const range_type< int > > z_ranges(void) const
file painter_attribute.hpp
c_array< const c_array< const PainterIndex > > index_data_chunks(void) const
void set_data(const PainterAttributeDataFiller &filler)
Class for which copy ctor and assignment operator are private functions.
Definition: util.hpp:505
c_array< const unsigned int > non_empty_index_data_chunks(void) const