source: NonGTP/ImageDebugger/include/imdebug.h @ 856

Revision 856, 5.0 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[856]1/*============================================================================
2 * Image Debugging API
3 *
4 * This API can simplify the debugging of applications that handle 2D data.
5 * It basically allows you to do 'printf' style debugging of images in
6 * C and C++ applications.
7 *
8 * Basic Usage:
9 *  #include <imdebug.h>
10 *  ...
11 *  imdebug(format_string, ...);
12 *
13 *  The format string describes the type of image(s) to dump to the debug
14 *  window. Here are some examples
15 *
16 *  Show an rgb image with width and height 16:
17 *
18 *     imdebug("rgb w=%d h=%d %p", 16, 16, img);
19 *   
20 * VARIABLE SPEC:
21 *  %d  -  int
22 *  %f  -  float
23 *  %s  -  string
24 *  %p  -  picture (pointer to raw image data)
25 * 
26 * INPUT FORMAT SPEC:
27 *  rgb
28 *  bgr
29 *  abgr
30 *  rgba...   - specify input image channel order
31 *  lum       - 1-channel image: lumninance
32 *  luma      - 2-channel image: lumninance + alpha
33 *  #5        - 5-channel data (default is to use 0,1,2 as RGB, no alpha)
34 *  ---> (default is rgb)
35 *
36 *  b=8       - size of all channels is 8 bits
37 *  b=5,6,5   - size of channels is 5bits(R) 6bits(G) 5bits(B)
38 *  b=32f     - size of all channels is 32 bits, float format
39 *  ---> (default is b=8)
40 *
41 * OUTPUT FORMAT SPEC:
42 *  rgba=rg__ - just display the red and green chanels
43 *  rgba=aaa_ - display alpha as grayscale
44 *  lum=g     - display green as grayscale
45 *  rgb=#A1C  - r:=chan 10, g:=chan 1, b:=chan 12 (use HEX digits!)
46 *  ---> (default is 1-1 mapping with no translation or swizzling)
47 *
48 * ATTRIBUTE SPEC:
49 *  w=23      - width  is 23 (default 0)
50 *  h=17      - height is 17 (default 0)
51 *  rs=1      - skip 1 row after every row  (default 0)
52 *  cs=2      - skip 2 columns after every column (default 0)
53 *
54 * SCALE AND BIAS:
55 *  *1.2      - scale RGB by 1.2
56 *  /1.2      - scale RGB by 1/1.2
57 *  +128      - bias  RGB by 128
58 *  -0.5      - bias  RGB by -0.5
59 *  r*1.2     - scale red by 1.2
60 *  rb/1.2    - scale both red and blue by 1/1.2
61 *  a+128     - bias  alpha by 128
62 *  rgba-0.5  - bias  RGB and alpha by -0.5
63 *  *auto     - automatically scale & bias RGB based on max & min values
64 *  ra*auto   - automatically scale & bias red and alpha
65 *  --> Default is scale=1 and bias=0 for all channels
66 *  --> Output value is computed as  (x*scale)+bias,
67 *       the same order as with OpenGL glPixelTransfer functions.
68 *
69 *  Order of specifiers is mostly not important, but channel swizzeling
70 *  should come after input format specifier.
71 *  (i.e. do "rgb bgr=rgb",   not "bgr=rgb  rgb")
72 *
73 *  If no image is specified (with '%p'), then the previous
74 *  image data is used.
75 *
76 * THOUGHTS FOR THE FUTURE
77 *
78 *  handling raw graphic images in compressed form. e.g.:
79 *  %pj = specify raw jpg image buffer
80 *  %pp = specify raw png image buffer
81 *  %pb = specify raw bmp image buffer
82 * 
83 *  A way to perform math on images in the format specifier,
84 *  or perform other arbitrary transformations on the input.
85 *  Like "%p - 0.5*%p"
86 *
87 *  A way to specify that several images should be tiled,
88 *  or opened in separate display windows.
89 *
90 *  More control over padding and alignment specs.
91 *
92 *  Ooops!  Really should allow specification of endianness!
93 *  That would be handy for data not created in the local endian format.
94 *
95 *  Author:        William Baxter (baxter@cs.unc.edu)
96 *  Created:       Sept 2002
97 *  Last Modified: Jan 2003
98 *============================================================================
99 *  Copyright 2002
100 *        William Baxter
101 *        The University of North Carolina at Chapel Hill
102 *
103 *  Permission to use, copy, modify, distribute and sell this software
104 *  and its documentation for any purpose is hereby granted without
105 *  fee, provided that the above copyright notice appear in all copies
106 *  and that both that copyright notice and this permission notice
107 *  appear in supporting documentation.  Binaries may be compiled with
108 *  this software without any royalties or restrictions.
109 *
110 *  The University of North Carolina at Chapel Hill makes no
111 *  representations about the suitability of this software for any
112 *  purpose. It is provided "as is" without express or implied
113 *  warranty.
114 *============================================================================
115 */
116
117
118#ifndef IMDEBUG_H
119#define IMDEBUG_H
120
121#ifdef __cplusplus
122extern "C" {
123#endif
124
125#ifndef WIN32_LEAN_AND_MEAN
126#define WIN32_LEAN_AND_MEAN
127#endif
128#include <windows.h>
129
130#ifndef IMDBG_EXPORT
131#define IMDBG_EXPORT __declspec(dllimport)
132#pragma comment (lib, "imdebug.lib")
133#else
134#endif
135
136/*===========================================================================*/
137/*                                                                           */
138/*  This is it. The one function you need to know about:                     */
139
140IMDBG_EXPORT void CALLBACK imdebug(const char *format, ...);
141
142/*===========================================================================*/
143
144#ifdef __cplusplus
145} /* end extern "C" */
146#endif
147
148#endif /* IMDEBUG_H */
Note: See TracBrowser for help on using the repository browser.