source: NonGTP/FLTK/include/fltk/PixelType.h @ 773

Revision 773, 2.2 KB checked in by gumbau, 18 years ago (diff)

FLTK imported to SVN repository to be linked agains the GeoTool? application

Line 
1// "$Id: PixelType.h,v 1.1 2005/04/02 03:20:15 spitzak Exp $"
2//
3// Copyright 1998-2005 by Bill Spitzak and others.
4//
5// This library is free software; you can redistribute it and/or
6// modify it under the terms of the GNU Library General Public
7// License as published by the Free Software Foundation; either
8// version 2 of the License, or (at your option) any later version.
9//
10// This library is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13// Library General Public License for more details.
14//
15// You should have received a copy of the GNU Library General Public
16// License along with this library; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18// USA.
19//
20// Please report all bugs and problems to "fltk-bugs@fltk.org".
21
22#ifndef fltk_PixelType_h
23#define fltk_PixelType_h
24
25namespace fltk {
26/*! \addtogroup images
27  \{ */
28
29/**
30  Enumeration describing how colors are stored in an array of bytes
31  that is a pixel. This is used as an argument for fltk::drawimage(),
32  fltk::readimage(), and fltk::Symbol::readimage().
33
34  Notice that the order of the bytes in memory of ARGB32 or RGB32 is
35  a,r,g,b on a little-endian machine and b,g,r,a on a big-endian
36  machine. Due to the use of these types by Windows, this is often
37  the fastest form of data, if you have a choice. To convert an
38  fltk::Color to RGB32, shift it right by 8 (for ARGB32 shift the
39  alpha left 24 and or it in).
40
41  More types may be added in the future. The set is as minimal as
42  possible while still covering the types I have actually encountered.
43*/
44enum PixelType {
45  MASK  = 0,    //!< 1 byte of inverted mask, filled with current color
46  MONO  = 1,    //!< 1 byte of gray scale
47  RGBx  = 2,    //!< bytes in r,g,b,a,r,g,b,a... order, a byte is ignored
48  RGB   = 3,    //!< bytes in r,g,b,r,g,b... order
49  RGBA  = 4,    //!< bytes in r,g,b,a,r,g,b,a... order
50  RGB32 = 5,    //!< 32-bit words containiing 0xaarrggbb (aa is ignored)
51  ARGB32= 6     //!< 32-bit words containing 0xaarrggbb
52};
53
54/**
55   Turn a PixelType into the number of bytes needed to hold a pixel.
56*/
57inline int depth(PixelType t) {return (t<2 ? 1 : t==3 ? 3 : 4);}
58
59/*! \} */
60
61}
62
63#endif
Note: See TracBrowser for help on using the repository browser.