Flatten carver if needed in nrg_preview_get_nrg
[liblqr.git] / man / lqr_carver_bias_add_area.3
blobf8725e02af92ed531543ed661268f8d7e8066888
1 .\"     Title: \fBlqr_carver_bias_add_area\fR
2 .\"    Author: Carlo Baldassi
3 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
4 .\"      Date: 16 Apr 2009
5 .\"    Manual: LqR library API reference
6 .\"    Source: LqR library 0.4.0 API (3:0:3)
7 .\"
8 .TH "\FBLQR_CARVER_BIAS_ADD_AREA\FR" "3" "16 Apr 2009" "LqR library 0.4.0 API (3:0:3)" "LqR library API reference"
9 .\" disable hyphenation
10 .nh
11 .\" disable justification (adjust text to left margin only)
12 .ad l
13 .SH "NAME"
14 lqr_carver_bias_add_area, lqr_carver_bias_add, lqr_carver_bias_add_rgb_area, lqr_carver_bias_add_rgb \- update an LqrCarver bias
15 .SH "SYNOPSIS"
16 .sp
17 .ft B
18 .nf
19 #include <lqr\&.h>
20 .fi
21 .ft
22 .HP 35
23 .BI "LqrRetVal lqr_carver_bias_add_area(LqrCarver*\ " "carver" ", gdouble*\ " "buffer" ", gint\ " "bias_factor" ", gint\ " "width" ", gint\ " "height" ", gint\ " "x_off" ", gint\ " "y_off" ");"
24 .HP 30
25 .BI "LqrRetVal lqr_carver_bias_add(LqrCarver*\ " "carver" ", gdouble*\ " "buffer" ", gint\ " "bias_factor" ");"
26 .HP 39
27 .BI "LqrRetVal lqr_carver_bias_add_rgb_area(LqrCarver*\ " "carver" ", gdouble*\ " "buffer" ", gint\ " "bias_factor" ", gint\ " "channels" ", gint\ " "width" ", gint\ " "height" ", gint\ " "x_off" ", gint\ " "y_off" ");"
28 .HP 34
29 .BI "LqrRetVal lqr_carver_bias_add_rgb(LqrCarver*\ " "carver" ", gdouble*\ " "buffer" ", gint\ " "bias_factor" ", gint\ " "channels" ");"
30 .SH "ADDING A BIAS FROM A BUFFER"
31 .PP
32 The function
33 \fBlqr_carver_bias_add_area\fR
34 adds a bias to an area of the image loaded into the
35 LqrCarver
36 object pointed to by
37 \fIcarver\fR\&. A positive biased area will be more likely to be avoided by seams, and thus be preserved during rescaling, while a negative bias has the opposite effect\&.
38 .PP
39 This function must be called after
40 \fBlqr_carver_init\fR(3)
41 and before
42 \fBlqr_carver_resize\fR(3)\&. If called multiple times, the biases added at each call will sum up\&.
43 .PP
44 The parameter
45 \fIbuffer\fR
46 must point to an array of
47 \fBdoubles\fR
48 of size
49 \fIwidth\fR * \fIheight\fR, ordered first by rows, then by columns\&.
50 .PP
51 The offset of the area relative to the image can be specified through
52 \fIx_off\fR
53 and
54 \fIy_off\fR\&. The bias area can exceed the boundary of the image, and the offsets can be negative\&.
55 .PP
56 The parameter
57 \fIbias_factor\fR
58 is an overall bias scale\&. A typical value when the buffer contents are of the order of
60 would be
61 1000\&.
62 .PP
63 The function
64 \fBlqr_carver_bias_add\fR
65 can be used when the area to add is of the same size of the image loaded in the
66 LqrCarver
67 object and the offsets are
68 0\&.
69 .SH "ADDING A BIAS FROM AN IMAGE"
70 .PP
71 The functions
72 \fBlqr_carver_bias_add_rgb_area\fR
73 and
74 \fBlqr_carver_bias_add_rgb\fR
75 are very similar to
76 \fBlqr_carver_bias_add_area\fR
77 and
78 \fBlqr_carver_bias_add\fR, except that they use 8\-bit multi\-channel images as inputs\&.
79 .PP
80 The number of channels in the image is passed via the parameter
81 \fIchannels\fR\&. The last channel is assumed to be the alpha (opacity) channel if
82 \fIchannels\fR
83 is equal to
85 or greater than
87 (if this is not the case, use the previous functions)\&.
88 .PP
89 The bias is computed from the average of the colour channels, multiplied by the value of the alpha channel if present\&. For example, in RGBA images a white, nontransparent pixel is equivalent to a value of
90 1\&.0
91 when using a buffer in
92 \fBlqr_carver_bias_add_area\fR\&.
93 .SH "RETURN VALUES"
94 .PP
95 The return values follow the Liquid Rescale library signalling system\&.
96 .SH "SEE ALSO"
97 .PP
99 \fBLqrRetVal\fR(3), \fBlqr_carver_init\fR(3), \fBlqr_carver_rigmask_add_area\fR(3)
100 .SH "COPYRIGHT"
101 Copyright \(co 2007-2009 Carlo Baldassi