Portrety Uliczne Nieznajomych - zobacz wyjątkową galerię portretów z warszawskich ulic
ZALOGUJ SIĘ
login:
hasło:
przypomnij hasło
załóż konto użytkownika
(i zobacz kilka porad gratis)
   
WYSZUKIWARKA I DZIAŁY
całe porady  tytuły
zaznacz działy do przeszukania
(brak wyboru = wszystkie działy)
PHP
MySQL >
PostgreSQL
SQLite
Perl
Java
XML
XSLT
XPath
WML
SVG
RegExp
Wyszukiwarki
Ochrona
VBScript
Google Plus
XHTML/CSS
JavaScript
Grafika
Flash
Photoshop
Windows
Linux
Bash
Apache
Procmail
E-biznes
Explorer
Opera
Firefox
Inne porady
   
KURSY, DOKUMENTACJE
Własne:
XHTML/CSS
JavaScript
ActionScript
WML, RSS, SSI
Pozostałe:
PHP
MySQL
Java API
więcej...
   
użytkowników online: 40
W CZYM MOGĘ POMÓC?


   
OPINIE UŻYTKOWNIKÓW
O wysokich kompetencjach zawodowych Darka nie ma co dyskutować. Wszyscy chyba jesteśmy zgodni co do tego, że Jego wiedza na polu informatycznym jest bogata i zasługuje na uznanie. Swego czasu zwróciłem się z prośbą o pomoc w realizacji małego projektu internetowego. Projekt był niewielki, jednak jego realizacja wymagała pewnego doświadczenia. Darek podjął się tego zlecenia, wykonał je szybko i sprawnie. Podczas realizacji służył doradztwem, jednak w żaden sposób nie narzucał swojego zdania. O prawidłowości Jego koncepcji przekonałem się dopiero po pewnym czasie. To, czego ja nie dostrzegałem, On dostrzegał i zwracał na to moją uwagę. Darek dał się poznać nie tylko, jako dobry fachowiec, co przede wszystkim okazał się być rzetelnym i uczciwym kontrahentem. Tak więc nie dość, że fachowiec, to jeszcze uczciwy. Polecam usługi Darka wszystkim tym, którzy szukają fachowej pomocy przy realizacji nawet najbardziej złożonych projektów.

Dariusz Żwan
Actuarius.pl

   
GALERIA FOTOGRAFII
   
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net

[Spis] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [X] [W] [Z]

imagefill

(PHP 3, PHP 4, PHP 5)

imagefill -- Flood fill

Description

int imagefill ( resource image, int x, int y, int color )

imagefill() performs a flood fill starting at coordinate x, y (top left is 0, 0) with color color in the image image.




User Contributed Notes

gelak
30-Nov-2005 08:27

//A smiley face ;]

<?php

header
('Content-type: image/png');

$smile=imagecreate(400,400);
$kek=imagecolorallocate($smile,0,0,255);
$feher=imagecolorallocate($smile,255,255,255);
$sarga=imagecolorallocate($smile,255,255,0);
$fekete=imagecolorallocate($smile,0,0,0);
imagefill($smile,0,0,$kek);

imagearc($smile,200,200,300,300,0,360,$fekete);
imagearc($smile,200,225,200,150,0,180,$fekete);
imagearc($smile,200,225,200,123,0,180,$fekete);
imagearc($smile,150,150,20,20,0,360,$fekete);
imagearc($smile,250,150,20,20,0,360,$fekete);
imagefill($smile,200,200,$sarga);
imagefill($smile,200,290,$fekete);
imagefill($smile,155,155,$fekete);
imagefill($smile,255,155,$fekete);
imagepng($smile);

?>


pisu at estmail dot hu
29-Nov-2005 10:48

chess board
<?php

$kep
= imagecreate(400,400);
$fekete = imagecolorallocate($kep,0,0,0);
$feher = imagecolorallocate($kep,255,255,255);

//imagefill($kep,50,50,$fekete);
imagefill($kep,50,20,$feher);

for (
$i=1;$i<8;$i++)  {
 
$k = $i*50;
 
imageline($kep,0,$k,400,$k,$fekete);
 
imageline($kep,$k,0,$k,400,$fekete);
  }

for (
$i=0;$i<8;$i++)  {
  for (
$j=0;$j<8;$j++)  {
  
$x = $i*50 + 2;
      
$y = $j*50 + 2;
   if (  ( (
$i % 2) + ($j % 2) )  % 2 == 0 )  {
        
imagefill($kep,$x,$y,$fekete);
         }

   }
  }

// imagecolortransparent($kek,$piros);

header('content-type : image/png');
imagepng($kep);

?>


colin at galaxyinteractive dot net
29-Jul-2005 05:26

Didn't see this documented, although it's outlined in imagefilledrectangle, it wasn't quite so obvious to me at first

imageSetTile($image,$imageBack);
imagefill($image,0,0,IMG_COLOR_TILED);

Will fill an image with a texture (this is great as I'm building a logo/template creator)


glimpse at glimpse-fr dot org
25-Apr-2005 03:42

In response to philip at fcknet dot dk :

It depends on the version of PHP. In some 4.3 releases (but I'm not sure to know the exact version number), you must use the tips given by latortugamorada at yahoo dot com :
"you have to use imagecreate and fill it and then imagecopy that onto the imagecreatetruecolor..."

Thank you very much, latortugamorada at yahoo dot com!


philip at fcknet dot dk
28-Feb-2005 05:31

In response to latortugamorada at yahoo dot com at  21-Jan-2005 07:56.

Imagefill works fine with imagecreatetruecolor. I tested on both Windows XP Home (PHP 5.0.3, Apache 2.x), and FreeBSD v. somethin PHP 5.0.3. Both worked absolutely fine.


latortugamorada at yahoo dot com
21-Jan-2005 07:56

Hey, um, this imagefill stuff doesn't work with imagecreatetruecolor.  you have to use imagecreate and fill it and then imagecopy that onto the imagecreatetruecolor... if that makes any sense.


rev at return to the pit dot com
24-Mar-2004 10:01

since it's not spoke of what int color is...
here's what I finally figured out:

it's a reference to a loaded color.

/start code:
$im = ImageCreateFromJPEG("us_map_regions.jpg");
$red = 225;
$green = 0;
$blue = 255;
$color = ImageColorAllocate( $im, $red, $green, $blue );
$x = 100;
$y = 100;
imagefill($im, $x,$y, $color);
header("Content-type: image/jpeg");
Imagejpeg($im,"",100);
ImageDestroy($im);
/end code
and "bang" there you go.. a nicely lavender filled area.
enjoy.


Igor Garcia
29-Jun-2003 12:18

This function, cannot deal with transparencies.
So you need to use imagecolorallocate instead of imagecolorallocatealpha.
Thus, be careful with color variables that allready set with imageallocatecoloralpha because this can slow-down or hang-up your system.


norxh
05-Jun-2003 05:36

For new images, you must allocate a color before this function will work.


08-Feb-2003 02:49

Actually, it can handle pre-transparent images. To remove it you need to do something like:
   imagecolortransparent($img, 0);
to null out the previous transparency colors. ;)


aqmprod at iname dot com
09-Jan-2000 02:08

This function does not seem to work with images already been transparent. If you fill at x=0, y=0, and there are still transparent parts that you did
not reach with your fill, they change to a different color.

The ImageColorSet function seems to be the solution, but i can't work with transparancy.


 

 
  © 1996-2012 & Reporter.plmiejscao serwisieabonamentwarunki korzystaniaRSSkontakt