php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
gd_matrix.c File Reference
#include "gd.h"
#include <math.h>

Go to the source code of this file.

Macros

#define M_PI   3.14159265358979323846
 

Functions

int gdAffineApplyToPointF (gdPointFPtr dst, const gdPointFPtr src, const double affine[6])
 
int gdAffineInvert (double dst[6], const double src[6])
 
int gdAffineFlip (double dst[6], const double src[6], const int flip_h, const int flip_v)
 
int gdAffineConcat (double dst[6], const double m1[6], const double m2[6])
 
int gdAffineIdentity (double dst[6])
 
int gdAffineScale (double dst[6], const double scale_x, const double scale_y)
 
int gdAffineRotate (double dst[6], const double angle)
 
int gdAffineShearHorizontal (double dst[6], const double angle)
 
int gdAffineShearVertical (double dst[6], const double angle)
 
int gdAffineTranslate (double dst[6], const double offset_x, const double offset_y)
 
double gdAffineExpansion (const double src[6])
 
int gdAffineRectilinear (const double m[6])
 
int gdAffineEqual (const double m1[6], const double m2[6])
 

Macro Definition Documentation

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 5 of file gd_matrix.c.

Function Documentation

◆ gdAffineApplyToPointF()

int gdAffineApplyToPointF ( gdPointFPtr dst,
const gdPointFPtr src,
const double affine[6] )

Title: Matrix Group: Affine Matrix Function: gdAffineApplyToPointF Applies an affine transformation to a point (floating point gdPointF)

Parameters: dst - Where to store the resulting point affine - Source Point flip_horz - affine matrix

Returns: GD_TRUE if the affine is rectilinear or GD_FALSE

Definition at line 27 of file gd_matrix.c.

◆ gdAffineConcat()

int gdAffineConcat ( double dst[6],
const double m1[6],
const double m2[6] )

Function: gdAffineConcat Concat (Multiply) two affine transformation matrices.

Concats two affine transforms together, i.e. the result will be the equivalent of doing first the transformation m1 and then m2. All parameters can be the same matrix (safe to call using the same array for all three arguments).

Parameters: dst - Where to store the resulting affine transform m1 - First affine matrix m2 - Second affine matrix

Returns: GD_SUCCESS on success or GD_FAILURE

Definition at line 121 of file gd_matrix.c.

◆ gdAffineEqual()

int gdAffineEqual ( const double m1[6],
const double m2[6] )

Function: gdAffineEqual Determines whether two affine transformations are equal. A tolerance has been implemented using GD_EPSILON.

Parameters: m1 - The first affine transformation m2 - The first affine transformation

Returns: GD_SUCCESS on success or GD_FAILURE

Definition at line 323 of file gd_matrix.c.

◆ gdAffineExpansion()

double gdAffineExpansion ( const double src[6])

gdAffineexpansion: Find the affine's expansion factor. @src: The affine transformation.

Finds the expansion factor, i.e. the square root of the factor by which the affine transform affects area. In an affine transform composed of scaling, rotation, shearing, and translation, returns the amount of scaling.

GD_SUCCESS on success or GD_FAILURE

Definition at line 289 of file gd_matrix.c.

◆ gdAffineFlip()

int gdAffineFlip ( double dst[6],
const double src[6],
const int flip_h,
const int flip_v )

Function: gdAffineFlip Flip an affine transformation horizontally or vertically.

Flips the affine transform, giving GD_FALSE for <flip_horz> and <flip_vert> will clone the affine matrix. GD_TRUE for both will copy a 180° rotation.

Parameters: dst - Where to store the resulting affine transform src_affine - Original affine matrix flip_h - Whether or not to flip horizontally flip_v - Whether or not to flip vertically

Returns: GD_SUCCESS on success or GD_FAILURE

Definition at line 93 of file gd_matrix.c.

◆ gdAffineIdentity()

int gdAffineIdentity ( double dst[6])

Function: gdAffineIdentity Set up the identity matrix.

Parameters: dst - Where to store the resulting affine transform

Returns: GD_SUCCESS on success or GD_FAILURE

Definition at line 150 of file gd_matrix.c.

◆ gdAffineInvert()

int gdAffineInvert ( double dst[6],
const double src[6] )

Function: gdAffineInvert Find the inverse of an affine transformation.

All non-degenerate affine transforms are invertible. Applying the inverted matrix will restore the original values. Multiplying <src> by <dst> (commutative) will return the identity affine (rounding error possible).

Parameters: dst - Where to store the resulting affine transform src_affine - Original affine matrix flip_horz - Whether or not to flip horizontally flip_vert - Whether or not to flip vertically

See also: <gdAffineIdentity>

Returns: GD_TRUE on success or GD_FALSE on failure

Definition at line 58 of file gd_matrix.c.

◆ gdAffineRectilinear()

int gdAffineRectilinear ( const double m[6])

Function: gdAffineRectilinear Determines whether the affine transformation is axis aligned. A tolerance has been implemented using GD_EPSILON.

Parameters: m - The affine transformation

Returns: GD_TRUE if the affine is rectilinear or GD_FALSE

Definition at line 305 of file gd_matrix.c.

◆ gdAffineRotate()

int gdAffineRotate ( double dst[6],
const double angle )

Function: gdAffineRotate Set up a rotation affine transform.

Like the other angle in libGD, in which increasing y moves downward, this is a counterclockwise rotation.

Parameters: dst - Where to store the resulting affine transform angle - Rotation angle in degrees

Returns: GD_SUCCESS on success or GD_FAILURE

Definition at line 197 of file gd_matrix.c.

◆ gdAffineScale()

int gdAffineScale ( double dst[6],
const double scale_x,
const double scale_y )

Function: gdAffineScale Set up a scaling matrix.

Parameters: scale_x - X scale factor scale_y - Y scale factor

Returns: GD_SUCCESS on success or GD_FAILURE

Definition at line 172 of file gd_matrix.c.

◆ gdAffineShearHorizontal()

int gdAffineShearHorizontal ( double dst[6],
const double angle )

Function: gdAffineShearHorizontal Set up a horizontal shearing matrix || becomes \.

Parameters: dst - Where to store the resulting affine transform angle - Shear angle in degrees

Returns: GD_SUCCESS on success or GD_FAILURE

Definition at line 222 of file gd_matrix.c.

◆ gdAffineShearVertical()

int gdAffineShearVertical ( double dst[6],
const double angle )

Function: gdAffineShearVertical Set up a vertical shearing matrix, columns are untouched.

Parameters: dst - Where to store the resulting affine transform angle - Shear angle in degrees

Returns: GD_SUCCESS on success or GD_FAILURE

Definition at line 244 of file gd_matrix.c.

◆ gdAffineTranslate()

int gdAffineTranslate ( double dst[6],
const double offset_x,
const double offset_y )

Function: gdAffineTranslate Set up a translation matrix.

Parameters: dst - Where to store the resulting affine transform offset_x - Horizontal translation amount offset_y - Vertical translation amount

Returns: GD_SUCCESS on success or GD_FAILURE

Definition at line 267 of file gd_matrix.c.