����������
WEB - ������

www.spravkaweb.ru Rambler's Top100
 ï¿½ï¿½ ����������: �������/PHP/������ � ������������� � ���������� GD.������ � ������ � ������� RGBÐàñïå÷àòàòü 
�������
�������
����� ���
HTML
JavaScript
VBScript
CSS
Flash
Perl
PHP
MySQL
SSI
VRML
�������������
������
Download
�����
��������
������
�������� ���
�����:
��������
Subscribe.Ru:

PHP

<--����� | ��������� � ������ | ������-->
������ � ������������� � ���������� GD
������ � ������ � ������� RGB
imageColorAllocate
�������� ������ ����� � ��������� ��� � ������� �������.

��������� :
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);
. . .
?>

imageColorDeAllocate
���������� ����� �� ������� �������.

��������� :
int imageColorDeAllocate(int im, int color)

��� ������� ������� �� ������� ������� im ���� color, ������� ��� �������������� ������� � ������� �������� imageColorAllocate().

������:
������ ������������� ������� imageColorDeAllocate():

<?php
. . .
$white = imageColorAllocate ($im, 255, 255, 255);
imageColorDeAllocate ($im, $white);
. . .
?>

imageColorSet
������ ����� ������������� �������� �������.

��������� :
bool imageColorSet(int im, int index, int red, int green, int blue)

������ ������� ������������� ��� �������� ������� index ������� im �������� ��������� �����: red (�������), green (�������), blue (�����). ��� ���� ��� ����� �������, ����������� ������ ������, ����� ������� ���� �������.


imageColorClosest
��������� ����� �������, �������� �������� � ����������.

��������� :
int imageColorClosest(int im, int red, int green, int blue)

������ ����, ����� �������� �������� ��������� ����� � ������� ������, ��� ������� ������ ���������� ������������� �����, ��� ������������� � ������� � ������������ ����� ����� � ��������������. ����� �������, ������ ����� � ������� �� �����������. ���� ������� �� ������, �� ������� ����� ������� �� ������ ��� ����, ������� �� ��������. ��������, � ������� �� ���� ������ "�������-�������-�����" �� ������ ������� ����� �����, ������ �����, ��������� ������������� �������� - �� ����� ����� � ����� ������ GD ������������� ������� "�������".


imageColorTransparent
����������� ����� ������������.

��������� :
int imageColorTransparent(int im [,int color])

��� ������� ��������� GD, ��� ��������������� ���� color (�������� ����� ��������������� ��� ������ ������� imageColorAllocate()) � ����������� im (im - ������������� �����������, �������� �������� imageCreate()) ������ ������������ ��� ����������. ���������� ������������� �������������� �� ����� ����������� �����, ���� false, ���� ������� �� ��� ��������� �����.
���� ��������, ��� �� ��� ������� ������������ ������� ����������� ����� - ��������, JPEG �� ����� ��� ���������.


imageColorsForIndex
��������� 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";
. . .
?>

imageColorAt
���������� ������ ����� �����.

��������� :
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;
?>

imageColorsTotal
��������� ���������� ������ � �������.

��������� :
int imageColorsTotal(int im)

������� ���������� ����� ������ � ������� ���������� �����������.


imageColorExact
��������� ������� ����� �������.

��������� :
int imageColorExact(int im, int red, int green, int blue)

������� ���������� ������ ���������� ����� (red, green, blue) � ������� ����������� im.
������� ��������� -1, ���� ���������� ����� ��� � ������� �����������.


imageColorResolve
���������� ��� �������� ���������� �����.

��������� :
int imageColorResolve(int im, int red, int green, int blue)

������� ���������� ������ ���������� ����� (red, green, blue) � ������� ����������� im.
� ������, ���� ����� ���� � ������� �����������, �� �� ���������.


imageGammaCorrect
���������� �����-��������� �������.

��������� :
int imageGammaCorrect(int im, double inputgamma, double outputgamma)

��� ������� ���������� ����������� ����� � �����������, ��������� ������������ im.
�������� inputgamma ������ ������� �����, � outputgamma - ����� ������.

�� ���������� ����� ����� ������� "PHP 4. ����������� ����������."
www.piter.com
������ / � ����������
 
Download
Ñêà÷àòü ñïðàâî÷íèê ïî PHP
��� ������:
05.07.2004
  • � ������� PHP ��������� ��������� ������� ��� ������ � ���������� (���������� GD):
    imagetypes(), ...
  • � ������� JavaScript ��������� �������� �� ����� D, E, F, H, I
  • � ������� ������ ��������� ������, �������������� ��� �������� � html-�������� ��������� MS Office (Word, Excel � �.�.)
  • �����������:
    ��� ��� ������ ����� �� �������� � �����������:
    ��� ��������.
    ������ �� ��������.
    ���� ��������.
    �������� �������� �������.
    �� ��� ������� �������.
    � ����������� ���� ������.
    � ��� ��� �����.
    ������.
    ��������:
    Rambler's Top100
    Ñäåëàòü ñòðàíèöó ñòàðòîâîé ������� �������� ���������
    Äîáàâèòü ñòðàíèöó â èçáðàííîå �������� ���� � ���������
    Ñîîáùèòü îá íàéäåííîé îøèáêå �������� �� ������