douqiang6448 2012-01-10 14:03
浏览 37
已采纳

坐标系中的起点

I have the following php code:

<?php

$image = imagecreatefrompng("captcha_background.png");

$imgcolor = imagecolorallocate($image, 0, 0, 0);

imagesetthickness($image, 2);

imageline($image, 0, 25, 40, 90, $imgcolor);

?>

The method "imageline" draws a straight line on my image from the coordinates 0 (x) 25 (y) to 40 (x) 90 (y).

The result is the following image:

What I'm confused about is the reverse of the bottom and the top when using coordinate systems in php. Normally 0 (The starting point) would be in the lower left corner, but when assigning coordinates in the method "imageline" the 0 (Starting point) is located in the upper left corner?

Expected result:

(The image is 300x100 pixels)

Could someone please explain why this is happening?

  • 写回答

3条回答 默认 最新

  • dongyou2305 2012-01-10 14:12
    关注

    This is not a mathematical graph. The typical coordinate system used in development (as far as I know) is to have the first quadrant at the lower right. That is, 0x0 is at the top left. This applies to all html elements that have widths and heights (the elements drop down, they do not fall up).

    The motivation appears to be the fact that it's hard to tell how much height you have to work with without knowing the absolute height of the image, which you may not know at any given time, and which may change frequently.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了