imageaffinematrixget()函数是PHP中的一个内置函数,用于获取仿射变换矩阵。仿射是涉及矩阵的几何变换运算,通常用于线性代数和计算机图形学中。
用法:
array imageaffinematrixget( int $type, mixed $options )
参数:该函数接受上述和以下描述的两个参数:
- $type:它指定一个对应于IMG_AFFINE常数之一的整数。所有IMG_AFFINE常数的列表如下:- IMG_AFFINE_TRANSLATE(0)
- IMG_AFFINE_SCALE(1)
- IMG_AFFINE_ROTATE(2)
- IMG_AFFINE_SHEAR_HORIZONTAL(3)
- IMG_AFFINE_SHEAR_VERTICAL(4)
 
- $options:它指定要转换为array的选项,可以是array或float。
返回值:该函数将在失败时重新运行仿射变换矩阵(具有键0到5和浮点值的数组)或FALSE。
下面给出的程序说明了PHP中的imageaffinematrixget()函数:程序1(从数组创建):
<?php 
// Create an array 
$arr = array('x' => 5, 'y' => 8); 
  
// Get the image affine matrix 
$matrix = imageaffinematrixget(IMG_AFFINE_TRANSLATE, $arr); 
  
// Output the matrix 
print("<pre>".print_r($matrix, true)."</pre>"); 
?>输出:
Array
(
    [0] => 1
    [1] => 0
    [2] => 0
    [3] => 1
    [4] => 5
    [5] => 8
)
程序2(从一个角度创建):
<?php 
// Create an angle 
$angle = 300; 
  
// Get the image affine matrix 
$matrix = imageaffinematrixget(IMG_AFFINE_SHEAR_HORIZONTAL, $angle); 
  
// Output the matrix 
print("<pre>".print_r($matrix, true)."</pre>"); 
?>输出:
Array
(
    [0] => 1
    [1] => 0
    [2] => -1.7320508075689
    [3] => 1
    [4] => 0
    [5] => 0
)
参考: https://www.php.net/manual/en/function.imageaffinematrixget.php
相关用法
- PHP pi( )用法及代码示例
- PHP Ds\Map get()用法及代码示例
- PHP Ds\Map put()用法及代码示例
- d3.js d3.set.has()用法及代码示例
- d3.js d3.max()用法及代码示例
- p5.js nfp()用法及代码示例
- p5.js str()用法及代码示例
- PHP Ds\Map xor()用法及代码示例
- p5.js hex()用法及代码示例
- p5.js hue()用法及代码示例
- p5.js nfs()用法及代码示例
- p5.js value()用法及代码示例
注:本文由纯净天空筛选整理自gurrrung大神的英文原创作品 PHP | imageaffinematrixget() function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
