Trait pdfium_render::transform::Transformable
source · pub trait Transformable {
Show 13 methods
fn transform(
&mut self,
a: PdfMatrixValue,
b: PdfMatrixValue,
c: PdfMatrixValue,
d: PdfMatrixValue,
e: PdfMatrixValue,
f: PdfMatrixValue
) -> Result<(), PdfiumError>;
fn set_matrix(&mut self, matrix: PdfMatrix) -> Result<(), PdfiumError> { ... }
fn translate(
&mut self,
delta_x: PdfPoints,
delta_y: PdfPoints
) -> Result<(), PdfiumError> { ... }
fn scale(
&mut self,
horizontal_scale_factor: PdfMatrixValue,
vertical_scale_factor: PdfMatrixValue
) -> Result<(), PdfiumError> { ... }
fn flip_horizontally(&mut self) -> Result<(), PdfiumError> { ... }
fn flip_vertically(&mut self) -> Result<(), PdfiumError> { ... }
fn reflect(&mut self) -> Result<(), PdfiumError> { ... }
fn rotate_counter_clockwise_degrees(
&mut self,
degrees: PdfMatrixValue
) -> Result<(), PdfiumError> { ... }
fn rotate_clockwise_degrees(
&mut self,
degrees: PdfMatrixValue
) -> Result<(), PdfiumError> { ... }
fn rotate_counter_clockwise_radians(
&mut self,
radians: PdfMatrixValue
) -> Result<(), PdfiumError> { ... }
fn rotate_clockwise_radians(
&mut self,
radians: PdfMatrixValue
) -> Result<(), PdfiumError> { ... }
fn skew_degrees(
&mut self,
x_axis_skew: PdfMatrixValue,
y_axis_skew: PdfMatrixValue
) -> Result<(), PdfiumError> { ... }
fn skew_radians(
&mut self,
x_axis_skew: PdfMatrixValue,
y_axis_skew: PdfMatrixValue
) -> Result<(), PdfiumError> { ... }
}Expand description
Common transformation setter operations that can be applied to a variety of PDF objects, including pages, individual page objects, and groups of page objects.
Required Methods§
sourcefn transform(
&mut self,
a: PdfMatrixValue,
b: PdfMatrixValue,
c: PdfMatrixValue,
d: PdfMatrixValue,
e: PdfMatrixValue,
f: PdfMatrixValue
) -> Result<(), PdfiumError>
fn transform(
&mut self,
a: PdfMatrixValue,
b: PdfMatrixValue,
c: PdfMatrixValue,
d: PdfMatrixValue,
e: PdfMatrixValue,
f: PdfMatrixValue
) -> Result<(), PdfiumError>
Applies the given transformation, expressed as six values representing the six configurable elements of a nine-element 3x3 PDF transformation matrix, to this page or page object.
To move, scale, rotate, or skew this object, consider using one or more of the following functions. Internally they all use Transformable::transform(), but are probably easier to use (and certainly clearer in their intent) in most situations.
- Transformable::translate(): changes the position of this object.
- Transformable::scale(): changes the size of this object.
- Transformable::rotate_clockwise_degrees(), Transformable::rotate_counter_clockwise_degrees(), Transformable::rotate_clockwise_radians(), Transformable::rotate_counter_clockwise_radians(): rotates this object around its origin.
- Transformable::skew_degrees(), Transformable::skew_radians(): skews this object relative to its axes.
The order in which transformations are applied is significant. For example, the result of rotating then translating an object may be vastly different from translating then rotating the same object.
An overview of PDF transformation matrices can be found in the PDF Reference Manual version 1.7 on page 204; a detailed description can be founded in section 4.2.3 on page 207.
Provided Methods§
sourcefn set_matrix(&mut self, matrix: PdfMatrix) -> Result<(), PdfiumError>
fn set_matrix(&mut self, matrix: PdfMatrix) -> Result<(), PdfiumError>
Applies the values in the given PdfMatrix to this transformable object.
sourcefn translate(
&mut self,
delta_x: PdfPoints,
delta_y: PdfPoints
) -> Result<(), PdfiumError>
fn translate(
&mut self,
delta_x: PdfPoints,
delta_y: PdfPoints
) -> Result<(), PdfiumError>
Moves the origin of this object by the given horizontal and vertical delta distances.
sourcefn scale(
&mut self,
horizontal_scale_factor: PdfMatrixValue,
vertical_scale_factor: PdfMatrixValue
) -> Result<(), PdfiumError>
fn scale(
&mut self,
horizontal_scale_factor: PdfMatrixValue,
vertical_scale_factor: PdfMatrixValue
) -> Result<(), PdfiumError>
Changes the size of this object, scaling it by the given horizontal and vertical scale factors.
sourcefn flip_horizontally(&mut self) -> Result<(), PdfiumError>
fn flip_horizontally(&mut self) -> Result<(), PdfiumError>
Flips this object horizontally around its origin by applying a horizontal scale factor of -1.
sourcefn flip_vertically(&mut self) -> Result<(), PdfiumError>
fn flip_vertically(&mut self) -> Result<(), PdfiumError>
Flips this object vertically around its origin by applying a vertical scale factor of -1.
sourcefn reflect(&mut self) -> Result<(), PdfiumError>
fn reflect(&mut self) -> Result<(), PdfiumError>
Reflects this object by flipping it both horizontally and vertically around its origin.
sourcefn rotate_counter_clockwise_degrees(
&mut self,
degrees: PdfMatrixValue
) -> Result<(), PdfiumError>
fn rotate_counter_clockwise_degrees(
&mut self,
degrees: PdfMatrixValue
) -> Result<(), PdfiumError>
Rotates this object counter-clockwise by the given number of degrees.
sourcefn rotate_clockwise_degrees(
&mut self,
degrees: PdfMatrixValue
) -> Result<(), PdfiumError>
fn rotate_clockwise_degrees(
&mut self,
degrees: PdfMatrixValue
) -> Result<(), PdfiumError>
Rotates this object clockwise by the given number of degrees.
sourcefn rotate_counter_clockwise_radians(
&mut self,
radians: PdfMatrixValue
) -> Result<(), PdfiumError>
fn rotate_counter_clockwise_radians(
&mut self,
radians: PdfMatrixValue
) -> Result<(), PdfiumError>
Rotates this object counter-clockwise by the given number of radians.
sourcefn rotate_clockwise_radians(
&mut self,
radians: PdfMatrixValue
) -> Result<(), PdfiumError>
fn rotate_clockwise_radians(
&mut self,
radians: PdfMatrixValue
) -> Result<(), PdfiumError>
Rotates this object clockwise by the given number of radians.
sourcefn skew_degrees(
&mut self,
x_axis_skew: PdfMatrixValue,
y_axis_skew: PdfMatrixValue
) -> Result<(), PdfiumError>
fn skew_degrees(
&mut self,
x_axis_skew: PdfMatrixValue,
y_axis_skew: PdfMatrixValue
) -> Result<(), PdfiumError>
Skews the axes of this object by the given angles in degrees.
sourcefn skew_radians(
&mut self,
x_axis_skew: PdfMatrixValue,
y_axis_skew: PdfMatrixValue
) -> Result<(), PdfiumError>
fn skew_radians(
&mut self,
x_axis_skew: PdfMatrixValue,
y_axis_skew: PdfMatrixValue
) -> Result<(), PdfiumError>
Skews the axes of this object by the given angles in radians.