�������� ������ ����� � ��������� ��� � ������� �������.
��������� :
int imageColorAllocate(int im, int red, int green, int blue)
������� ���������� ������������� �����, ���������� � ��������������� ������� RGB. ������ ����������
������� ������� ������������� �����������, ������������ � ������ ��� ���������� �� �����.
��������� red, green � blue ������ �������, ������� � ����� ���������� ����� ��������������. �������� ���� ���������� ������ ������ � �������� �� 0 �� 255, ��� �� 0x00 �� 0xFF.
����������� ������ ����, ������� ����������� � ���������� ������������, ������ ���� ������� (���������) ��� ������ ������ ���� �������.
������:
������ ������������� ������� imageColorAllocate():
<?php . . . // ����� $white = imagecolorallocate($im, 255, 255, 255); $white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF); // ������ $black = imagecolorallocate($im, 0, 0, 0); $black = imagecolorallocate($im, 0x00, 0x00, 0x00); . . . ?>
���������� ����� �� ������� �������.
��������� :
int imageColorDeAllocate(int im, int color)
��� ������� ������� �� ������� ������� im ���� color, ������� ��� �������������� ������� � ������� �������� imageColorAllocate().
������:
������ ������������� ������� imageColorDeAllocate():
<?php . . . $white = imageColorAllocate ($im, 255, 255, 255); imageColorDeAllocate ($im, $white); . . . ?>
������ ����� ������������� �������� �������.
��������� :
bool imageColorSet(int im, int index, int red, int green, int blue)
������ ������� ������������� ��� �������� ������� index ������� im �������� ��������� �����: red (�������), green (�������), blue (�����). ��� ���� ��� ����� �������, ����������� ������ ������, ����� ������� ���� �������.
��������� ����� �������, �������� �������� � ����������.
��������� :
int imageColorClosest(int im, int red, int green, int blue)
������ ����, ����� �������� �������� ��������� ����� � ������� ������, ��� ������� ������ ���������� ������������� �����, ��� ������������� � ������� � ������������ ����� ����� � ��������������. ����� �������, ������ ����� � ������� �� �����������. ���� ������� �� ������, �� ������� ����� ������� �� ������ ��� ����, ������� �� ��������. ��������, � ������� �� ���� ������ "�������-�������-�����" �� ������ ������� ����� �����, ������ �����, ��������� ������������� �������� - �� ����� ����� � ����� ������ GD ������������� ������� "�������".
����������� ����� ������������.
��������� :
int imageColorTransparent(int im [,int color])
��� ������� ��������� GD, ��� ��������������� ���� color (�������� ����� ��������������� ��� ������ ������� imageColorAllocate()) � ����������� im (im - ������������� �����������, �������� �������� imageCreate()) ������ ������������ ��� ����������. ���������� ������������� ��������������
�� ����� ����������� �����, ���� false, ���� ������� �� ��� ��������� �����.
���� ��������, ��� �� ��� ������� ������������ ������� ����������� ����� - ��������, JPEG �� ����� ��� ���������.
��������� RGB-������������ �������� �������.
��������� :
array imageColorsForIndex(int im, int index)
������� ���������� ������������� ������ � ������� red, green, blue (������ � ����� �������), ������� ������������� ��������, ������ ��������� ��������� RGB � �������������� ����� index. �� �� ����� � �� �������� ������� �������� �� ����� � ������������� ������������ �������� ��� ������:
<?php . . . $color=imageColorAt($im,0,0); list($r,$g,$b)=array_values(imageColorsForIndex($im,$color)); echo "R=$r, g=$g, b=$b"; . . . ?>
���������� ������ ����� �����.
��������� :
int imageColorAt(int im, int x, int y)
��� ������� ���������� ���� �����, ������������� �� ����������� (x, y).
���� PHP ������������� � GD library 2.0 ��� ����, � �������� - truecolor, �� ��� ������� ��������� ������������� �����, � �� ��� RGB-�������������.
<?php $im = imageCreateFromPng("file.png"); $rgb = ImageColorAt($im, 100, 100); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; ?>
��������� ���������� ������ � �������.
��������� :
int imageColorsTotal(int im)
������� ���������� ����� ������ � ������� ���������� �����������.
��������� ������� ����� �������.
��������� :
int imageColorExact(int im, int red, int green, int blue)
������� ���������� ������ ���������� ����� (red, green, blue) � ������� ����������� im.
������� ��������� -1, ���� ���������� ����� ��� � ������� �����������.
���������� ��� �������� ���������� �����.
��������� :
int imageColorResolve(int im, int red, int green, int blue)
������� ���������� ������ ���������� ����� (red, green, blue) � ������� ����������� im.
� ������, ���� ����� ���� � ������� �����������, �� �� ���������.
���������� �����-��������� �������.
��������� :
int imageGammaCorrect(int im, double inputgamma, double outputgamma)
��� ������� ���������� ����������� ����� � �����������, ��������� ������������ im.
�������� inputgamma ������ ������� �����, � outputgamma - ����� ������.