![]() |
![]() |
![]() |
adg-1 reference manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
#include <adg-1/adg.h> struct AdgAlignment; struct AdgAlignmentClass; AdgAlignment * adg_alignment_new (const CpmlPair *factor
); AdgAlignment * adg_alignment_new_explicit (gdouble x_factor
,gdouble y_factor
); void adg_alignment_set_factor (AdgAlignment *alignment
,const CpmlPair *factor
); void adg_alignment_set_factor_explicit (AdgAlignment *alignment
,gdouble x_factor
,gdouble y_factor
); const CpmlPair * adg_alignment_get_factor (AdgAlignment *alignment
);
The AdgAlignment is an entity that can contains more sub-entities, much in the same way as the AdgContainer does, but allowing the displacement of its content with an arbitrary fraction dependent on the content itself.
This shift is computed by multiplying the "factor" property with the extents of the bare content, with "bare" meaning the children entities as they are rendered on the global matrix *without* rotation components.
To specify the alignment fraction, use adg_alignment_set_factor()
and
related methods or directly set the "factor" property.
For example, to center the children either in x and y, you can call
adg_alignment_set_factor_explicit(alignment, 0.5, 0.5). To align them
on the right, specify a (0, 1) factor.
struct AdgAlignment;
All fields are private and should not be used directly. Use its public methods instead.
Since 1.0
AdgAlignment * adg_alignment_new (const CpmlPair *factor
);
Creates a new alignment container with the specified factor.
|
the alignment factor |
Returns : |
the newly created alignment or NULL on errors |
Since 1.0
AdgAlignment * adg_alignment_new_explicit (gdouble x_factor
,gdouble y_factor
);
Convenient function that creates a new alignment accepting explicit factor values.
|
x component of the factor |
|
y component of the factor |
Returns : |
the newly created alignment |
Since 1.0
void adg_alignment_set_factor (AdgAlignment *alignment
,const CpmlPair *factor
);
Sets a the "factor" property to factor
on alignment
.
The factor is applied to the alignment
extents to compute the
displacement of the content, providing a way to for instance center
the content either vertically or horizontally. A pair factor of
(0
.5, 0
) means the content will be centered horizontally in
reference to the normal flow without alignment
.
|
an AdgAlignment container |
|
the new factor |
Since 1.0
void adg_alignment_set_factor_explicit (AdgAlignment *alignment
,gdouble x_factor
,gdouble y_factor
);
Convenient wrapper around adg_alignment_set_factor()
that accepts
explicit factors instead of an CpmlPair value.
|
an AdgAlignment container |
|
x component of the factor |
|
y component of the factor |
Since 1.0
const CpmlPair * adg_alignment_get_factor (AdgAlignment *alignment
);
Gets the value of the "factor" property. The returned
pair is owned by alignment
and must not be modified or freed.
|
an AdgAlignment container |
Returns : |
the factor pair |
Since 1.0
"factor"
property"factor" CpmlPair* : Read / Write
Portion of extents, either in x and y, the content will be displaced: a (0.5, 0.5) factor means the origin is the middle point of the extents.