File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -72,8 +72,27 @@ typedef struct tag_vertex_type {
7272 * Structure to store coordinates and an associated ARGB color
7373 */
7474typedef struct tag_pixel_type {
75- vertex_type vertex; // vertex
75+ vertex_type vertex;
7676 std::uint32_t color; // ARGB 8-8-8-8 color
77+
78+ // operators
79+ inline bool operator ==(const tag_pixel_type& rhs) const {
80+ return vertex == rhs.vertex ;
81+ }
82+ inline bool operator !=(const tag_pixel_type& rhs) const {
83+ return vertex != rhs.vertex ;
84+ }
85+ inline tag_pixel_type operator +(const tag_vertex_type& rhs) const {
86+ return {{ static_cast <std::int16_t >(vertex.x + rhs.x ), static_cast <std::int16_t >(vertex.y + rhs.y ) }, color };
87+ }
88+ inline tag_pixel_type operator -(const tag_vertex_type& rhs) const {
89+ return {{ static_cast <std::int16_t >(vertex.x - rhs.x ), static_cast <std::int16_t >(vertex.y - rhs.y ) }, color };
90+ }
91+ inline tag_pixel_type& operator +=(const tag_vertex_type& rhs) {
92+ vertex.x = static_cast <std::int16_t >(vertex.x + rhs.x );
93+ vertex.y = static_cast <std::int16_t >(vertex.y + rhs.y );
94+ return *this ;
95+ }
7796} pixel_type;
7897
7998
You can’t perform that action at this time.
0 commit comments