This file is indexed.

/usr/share/doc/libafterimage-dev/html/asgrad.html is in libafterimage-dev 2.2.11-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>AFTERImage example 5: Gradient rendering</title>
<style type="text/css">
	<!--

	body {
        	margin-top: 5px;
		background-repeat: repeat;
	}

	.copy {
		margin-top: 10px;
        	margin-left: 4%;
        	margin-right: 4%;
	}

	.copy a:link, .copy a:visited {
        	color:#0FF;
        	text-decoration:none
	}

	.copy a:active, .copy a:hover {
        	color:#FC3;
        	text-decoration:underline
	}

	.copy2 {
		margin-top: 10px;
        	margin-left: 0;
        	margin-right: 0;
	}

	.copy2 a:link, .copy a:visited {
        	color:#0FF;
        	text-decoration:none
	}

	.copy2 a:active, .copy a:hover {
        	color:#FC3;
        	text-decoration:underline
	}

	p.codeBlock {
		background: #444444;
		padding: 1em;
		margin-left: 4em;
		font-family:Tahoma, Arial, Verdana, Helvetica;
		font-size:14px;
	}
	.container {
		padding: -1em;
		margin-left: 0em;
		margin-right: 1em;
		width: 100%;
		background: #ccc;
		border: 1px solid #000;
		font-size:13px;
	}
	p.dense {
		text-align: justify;
		margin-top: 0em;
		padding: 0em;
		line-height: 110%;
	}			       
	p.sect_header
	{
    		background-color: #dddddd;
    		color: #000000;
    		text-align: right;
    		font-size: 11pt;
	}
	p.refsect_header
	{
    		text-align: left;
    		font-size: 14px;
		line-height: 90%;
	}
	dl.dense {
		padding: 0;
		margin: 0;
		font-size:14px;
	}
	ul.dense {
	}
	li.dense {
		line-height: 110%;
	}
	dt.dense {
		line-height: 110%;
		text-align: bottom;
	}
	dd.dense {
		font-size:14px;
	}
	-->
</style>

</head>
<body>
<A name="page_top"></A>
<A href="../../afterstep/html/preface.html">Preface</A>&nbsp;&nbsp;<A href="../../afterstep/html/visualselect.html">Introduction</A>&nbsp;&nbsp;<A href="../../afterstep/html/index.html">Main index</A>&nbsp;&nbsp;<A href="index.html">API Topic index</A>&nbsp;&nbsp;<A href="Glossary.html">API Glossary</A><p>
<h1>AFTERImage example 5: Gradient rendering</h1><font size=4>demonstrates rendering of multi point linear gradients</font><hr>

<A NAME="libAfterImage/tutorials/ASGrad"><UL><p class="sect_header"><B>libAfterImage/tutorials/ASGrad</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="ASGrad"></A><B>ASGrad</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE><A href="afterimage.html#libAfterImage">libAfterImage</A> application for drawing multipoint linear gradients.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>New steps described in this tutorial are :
<A href="asgrad.html#ASGrad">ASGrad</A>.1. Building <A href="asimagexml.html#gradient">gradient</A> specs.
<A href="asgrad.html#ASGrad">ASGrad</A>.2. Actual rendering <A href="asimagexml.html#gradient">gradient</A>.
</PRE></LI><LI><p class="refsect_header"><B>SEE ALSO</B></p><PRE>Tutorial 1: <A href="asview.html#ASView">ASView</A>  - explanation of basic steps needed to use
                      <A href="afterimage.html#libAfterImage">libAfterImage</A> and some other simple things.
Tutorial 2: <A href="asscale.html#ASScale">ASScale</A> - image scaling basics.
Tutorial 3: <A href="astile.html#ASTile">ASTile</A>  - image tiling and tinting.
Tutorial 4: <A href="asmerge.html#ASMerge">ASMerge</A> - scaling and blending of arbitrary number of
                      images.
</PRE></LI><LI><p class="refsect_header"><B>SOURCE</B></p><P class="dense"><div class="container"><PRE>

#include &quot;../afterbase.h&quot;
#include &quot;../afterimage.h&quot;
#include &quot;common.h&quot;

<A href="asvisual.html#ARGB32">ARGB32</A> default_colors[] = {
    0xFF000000,
    0xFF700070,                                /* violet */
    0xFF0000FF,                                /* blue   */
    0xFF00FFFF,                                /* cyan   */
    0xFF00FF00,
    0XFFFFFF00,
    0XFF700000,
    0XFFFF0000,
    0xFF8080A0,
    0xFFE0E0FF,
    0xFFa0a0FF,
};
double default_offsets[] = { 0, 0.1, 0.15, 0.20, 0.35, 0.45, 0.55, 0.50, 
                             0.65, 0.8, 1.0} ;


void usage()
{
    printf( &quot;  Usage: asgrad -h | &lt;geometry&gt; &lt;gradient_type&gt; &lt;color1&gt; &quot;
            &quot;&lt;offset2&gt; &lt;color2&gt; [ &lt;offset3&gt; &lt;color3&gt; ...]\n&quot;);
    printf( &quot;  Where: geometry - size of the resulting image and window;\n&quot;);
    printf( &quot;         gradient_type - One of the fiollowing values :\n&quot;);
    printf( &quot;            0 - linear   left-to-right <A href="asimagexml.html#gradient">gradient</A>,\n&quot;);
    printf( &quot;            1 - diagonal lefttop-to-rightbottom,\n&quot;);
    printf( &quot;            2 - linear   top-to-bottom <A href="asimagexml.html#gradient">gradient</A>,\n&quot;);
    printf( &quot;            3 - diagonal righttop-to-leftbottom;\n&quot;);
    printf( &quot;         offset   - floating point <A href="blender.html#value_scanlines()">value</A> from 0.0 to 1.0\n&quot;);
}

int main(int argc, char* argv[])
{
    Display *dpy = NULL;
    <A href="asvisual.html#ASVisual">ASVisual</A> *asv ;
    int <A href="blender.html#screen_scanlines()">screen</A> = 0, depth = 0;
    int dummy, geom_flags = 0;
    unsigned int to_width, to_height ;
    <A href="asimage.html#ASGradient">ASGradient</A> grad ;
    <A href="asimage.html#ASGradient">ASGradient</A> default_grad = { 1, 11, &amp;(default_colors[0]), 
                                       &amp;(default_offsets[0])} ;
    <A href="asimage.html#ASImage">ASImage</A> *grad_im = NULL;

    /* see <A href="asview.html#ASView">ASView</A>.1 : */
    set_application_name( argv[0] );
#<A href="asimagexml.html#if">if</A> (HAVE_AFTERBASE_FLAG==1)
    set_output_threshold(OUTPUT_LEVEL_DEBUG);
#endif

    if( argc &gt; 1 )
    {
        if( strcmp( argv[1], &quot;-h&quot;) == 0 )
        {
            usage();
            return 0;
        }
        /* see <A href="asscale.html#ASScale">ASScale</A>.1 : */
        geom_flags = XParseGeometry( argv[1], &amp;dummy, &amp;dummy,
                                     &amp;to_width, &amp;to_height );
    }else
        usage();
    memset( &amp;grad, 0x00, sizeof(ASGradient));

#ifndef X_DISPLAY_MISSING
    dpy = XOpenDisplay(NULL);
    _XA_WM_DELETE_WINDOW = XInternAtom( dpy, &quot;WM_DELETE_WINDOW&quot;, False);
    <A href="blender.html#screen_scanlines()">screen</A> = DefaultScreen(dpy);
    depth = DefaultDepth( dpy, <A href="blender.html#screen_scanlines()">screen</A> );
#endif

    if( argc &gt;= 5 )
    {
        int i = 2;
        /* see <A href="asgrad.html#ASGrad">ASGrad</A>.1 : */
        grad.type = atoi( argv[2] );
        grad.npoints = 0 ;
        grad.<A href="asimagexml.html#color">color</A> = safemalloc( ((argc-2)/2)*sizeof(ARGB32));
        grad.offset = safemalloc( ((argc-2)/2)*sizeof(double));
        while( ++i &lt; argc )
        {
            if( grad.npoints &gt; 0 )
            {
                if( i == argc-1 )
                    grad.offset[grad.npoints] = 1.0;
                else
                    grad.offset[grad.npoints] = atof( argv[i] );
                ++i ;
            }

            /* see <A href="astile.html#ASTile">ASTile</A>.1 : */
            if( parse_argb_color( argv[i], &amp;(grad.<A href="asimagexml.html#color">color</A>[grad.npoints])) 
                != argv[i] )
                if( grad.offset[grad.npoints] &gt;= 0. &amp;&amp; 
                    grad.offset[grad.npoints]&lt;= 1.0 )
                    grad.npoints++ ;
        }
    }else
    {
        grad = default_grad ;
        if( argc &gt;= 3 )
            grad.type = atoi( argv[2] );
    }

    if( grad.npoints &lt;= 0 )
    {
        show_error( &quot; not enough <A href="asimagexml.html#gradient">gradient</A> points specified.&quot;);
        return 1;
    }

    /* Making sure tiling geometry is sane : */
#ifndef X_DISPLAY_MISSING
    if( !get_flags(geom_flags, WidthValue ) )
        to_width  = DisplayWidth(dpy, screen)*2/3 ;
    if( !get_flags(geom_flags, HeightValue ) )
        to_height = DisplayHeight(dpy, screen)*2/3 ;
#else
    if( !get_flags(geom_flags, WidthValue ) )
        to_width  = 500 ;
    if( !get_flags(geom_flags, HeightValue ) )
        to_height = 500 ;
#endif
    printf( &quot;%s: rendering <A href="asimagexml.html#gradient">gradient</A> of type %d to %dx%d\n&quot;,
            get_application_name(), grad.type&amp;GRADIENT_TYPE_MASK, 
            to_width, to_height );

    /* see <A href="asview.html#ASView">ASView</A>.3 : */
    asv = create_asvisual( dpy, <A href="blender.html#screen_scanlines()">screen</A>, depth, NULL );
    /* see <A href="asgrad.html#ASGrad">ASGrad</A>.2 : */
    grad_im = make_gradient( asv, &amp;grad, to_width, to_height,
                             SCL_DO_ALL,
#ifndef X_DISPLAY_MISSING
                             ASA_XImage,
#else
                             ASA_ASImage,
#endif
                             0, ASIMAGE_QUALITY_DEFAULT );
    if( grad_im )
    {
#ifndef X_DISPLAY_MISSING
        /* see <A href="asview.html#ASView">ASView</A>.4 : */
        Window w = create_top_level_window( asv,
                                            DefaultRootWindow(dpy), 32, 32,
                                            to_width, to_height, 1, 0, NULL,
                                            &quot;<A href="asimage.html#ASGradient">ASGradient</A>&quot;, NULL );
        if( w != None )
        {
            Pixmap p ;

            XMapRaised   (dpy, w);
            /* see <A href="asview.html#ASView">ASView</A>.5 : */
            p = asimage2pixmap( asv, DefaultRootWindow(dpy), grad_im,
                                NULL, True );
            destroy_asimage( &amp;grad_im );
            /* see common.c: set_window_background_and_free() : */
            p = set_window_background_and_free( w, p );
            /* see common.c: wait_closedown() : */
        }
        wait_closedown(w);
        dpy = NULL;
#else
        ASImage2file( grad_im, NULL, &quot;asgrad.jpg&quot;, ASIT_Jpeg, NULL );
        destroy_asimage( &amp;grad_im );
#endif
    }
    return 0 ;
}
</PRE></div><br></p></LI>
<A NAME="libAfterImage/tutorials/ASGrad.1 [5.1]"><UL><p class="sect_header"><B>libAfterImage/tutorials/ASGrad.1 [5.1]</B></p></A><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE>Step 1. Building <A href="asimagexml.html#gradient">gradient</A> specs.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>Multipoint <A href="asimagexml.html#gradient">gradient</A> is defined as <A href="asimagexml.html#set">set</A> of <A href="asimagexml.html#color">color</A> values with offsets
of each point from the beginning of the <A href="asimagexml.html#gradient">gradient</A> on 1.0 <A href="asimagexml.html#scale">scale</A>.
Offsets of the first and last point in <A href="asimagexml.html#gradient">gradient</A> should always be
0. and 1.0 respectively, and other points should go in between.
For example 2 point <A href="asimagexml.html#gradient">gradient</A> will have always offsets 0. and 1.0,
3 points <A href="asimagexml.html#gradient">gradient</A> will have 0. for first <A href="asimagexml.html#color">color</A>, 1.0 for last <A href="asimagexml.html#color">color</A>
and anything in between for middle <A href="asimagexml.html#color">color</A>.
If offset is incorrect - point will be skipped at the time of
rendering.

There are 4 types of gradients supported : horizontal, top-left to
bottom-right diagonal, vertical and top-right to bottom-left diagonal.
Any cilindrical <A href="asimagexml.html#gradient">gradient</A> could be drawn as a 3 point <A href="asimagexml.html#gradient">gradient</A> with
border colors being the same.

Each <A href="asimagexml.html#gradient">gradient</A> point has ARGB <A href="asimagexml.html#color">color</A>, which means that it is possible
to <A href="asfont.html#draw_text()">draw</A> gradients in alpha channel as well as RGB. That makes for
semitransparent gradients, fading gradients, etc.
</PRE></LI><LI><p class="refsect_header"><B>EXAMPLE</B></p><PRE>    grad.type = atoi( argv[2] );
        grad.npoints = 0 ;
        grad.<A href="asimagexml.html#color">color</A> = safemalloc( ((argc-2)/2)*sizeof(ARGB32));
        grad.offset = safemalloc( ((argc-2)/2)*sizeof(double));
        while( ++i &lt; argc )
        {
            if( grad.npoints &gt; 0 )
            {
                if( i == argc-1 )
                    grad.offset[grad.npoints] = 1.0;
                else
                    grad.offset[grad.npoints] = atof( argv[i] );
                ++i ;
            }
        if( parse_argb_color( argv[i], &amp;(grad.<A href="asimagexml.html#color">color</A>[grad.npoints]))
             != argv[i] )
                if(grad.offset[grad.npoints] &gt;= 0. &amp;&amp;
                grad.offset[grad.npoints]&lt;= 1.0 )
                    grad.npoints++ ;
        }
</PRE></LI><LI><p class="refsect_header"><B>SEE ALSO</B></p><PRE><A href="asvisual.html#ARGB32">ARGB32</A>, parse_argb_color(), <A href="asimage.html#ASGradient">ASGradient</A>
</PRE></LI></UL>
<A NAME="libAfterImage/tutorials/ASGrad.2 [5.2]"><UL><p class="sect_header"><B>libAfterImage/tutorials/ASGrad.2 [5.2]</B></p></A><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE>Step 2. Actually rendering <A href="asimagexml.html#gradient">gradient</A>.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>All that is needed to <A href="asfont.html#draw_text()">draw</A> <A href="asimagexml.html#gradient">gradient</A> is to call make_gradient(),
passing pointer to <A href="asimage.html#ASGradient">ASGradient</A> structure, that describes <A href="asimagexml.html#gradient">gradient</A>.
Naturally size of the <A href="asimagexml.html#gradient">gradient</A> is needed too. Another parameter is
filter - that is a bit mask that allows one to <A href="asfont.html#draw_text()">draw</A> <A href="asimagexml.html#gradient">gradient</A> using only a
subset of the channels, represented by <A href="asimagexml.html#set">set</A> bits. SCL_DO_ALL means
that all 4 channels must be rendered.
make_gradient() creates <A href="asimage.html#ASImage">ASImage</A> of requested size and fills it with
<A href="asimagexml.html#gradient">gradient</A>. Special techinque based on error diffusion is utilized to
avoid sharp steps between grades of colors when limited range of
colors is used for <A href="asimagexml.html#gradient">gradient</A>.
</PRE></LI><LI><p class="refsect_header"><B>EXAMPLE</B></p><PRE>        grad_im = make_gradient( asv, &amp;grad, to_width, to_height,
                                 SCL_DO_ALL,
                             ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT );
</PRE></LI><LI><p class="refsect_header"><B>NOTES</B></p><PRE>make_gradient(), ASScanline, <A href="asimage.html#ASImage">ASImage</A>.
</PRE></LI></UL></UL>
<p><A href="preface.html">Preface</A>&nbsp;&nbsp;<A href="visualselect.html">Introduction</A>&nbsp;&nbsp;<A href="index.html">Topic index</A>&nbsp;&nbsp;<A href="Glossary.html">Glossary</A>&nbsp;&nbsp;<A href="#page_top">Back to Top</A>
<hr>
<p><FONT face="Verdana, Arial, Helvetica, sans-serif" size="-2">AfterStep version 2.2.11</a></FONT>
</body>
</html>