]>
Dogcows Code - chaz/yoink/blob - src/moof/image.hh
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
8 *****************************************************************************/
10 #ifndef _MOOF_IMAGE_HH_
11 #define _MOOF_IMAGE_HH_
13 #include <boost/noncopyable.hpp>
15 #include <moof/dispatcher.hh>
16 #include <moof/math.hh>
17 #include <moof/resource.hh>
22 * Defines classes for loading and manipulating images.
28 class image
: public boost::noncopyable
32 static const int no_tile
= -1;
34 explicit image(const std::string
& path
);
62 const char* pixels() const
67 void set_as_icon() const;
70 * Calculate texture coordinates for a tile at a certain index. Tiles
71 * are indexed start with zero as the top-left tile and moving across,
73 * \param index The tile index.
74 * \param coords An array of scalars where the texture coordinates
75 * will be stored after this call. The first coordinate (u,v) will be
76 * in the first two places and so on until all four coordinates are
77 * stored, therefore requiring enough room for an array of eight
78 * scalars. The winding of the coordinates is always
79 * counter-clockwise (the GL default).
80 * \return True if index is valid, false otherwise.
82 bool tile_coordinates(int index
, scalar coords
[8]) const;
84 void fix_uv(std::vector
<vector2
>& p
) const;
87 static void reset_binding();
92 void upload_to_gl() const;
93 void unload_from_gl() const;
94 void context_recreated();
95 void set_properties() const;
99 mutable unsigned object_
;
100 static unsigned global_object_
;
108 unsigned min_filter_
;
109 unsigned mag_filter_
;
115 //mutable dispatcher::handle new_context_;
118 typedef resource_handle
<image
> image_handle
;
123 #endif // _MOOF_IMAGE_HH_
This page took 0.054719 seconds and 5 git commands to generate.