No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher une fonction PHP

ImagickPixel::__construct

(PECL imagick 2.0.0)

ImagickPixel::__constructThe ImagickPixel constructor

Description

ImagickPixel::__construct ([ string $color ] )
Warning

This function is currently not documented; only its argument list is available.

Constructs an ImagickPixel object. If a color is specified, the object is constructed and then initialised with that color before being returned.

PHP: ImagickPixel::__construct - Manual Home of Manuel PHP  Contents Haut

Parameters

color

The optional color string to use as the initial value of this object.

PHP: ImagickPixel::__construct - Manual Home of Manuel PHP  Contents Haut

Return Values

Returns an ImagickPixel object on success, throwing ImagickPixelException on failure.

PHP: ImagickPixel::__construct - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 ImagickPixel::construct()

<?php
function construct() {

    
$columns 4;
    
    
$exampleColors = array(
        
"rgba(100%, 0%, 0%, 0.5)",
        
"hsb(33.3333%, 100%,  75%)"// medium green
        
"hsl(120, 255,   191.25)"//medium green
        
"graya(50%, 0.5)"//  semi-transparent mid gray
        
"LightCoral""none"//"cmyk(0.9, 0.48, 0.83, 0.50)",
        
"#f00"//  #rgb
        
"#ff0000"//  #rrggbb
        
"#ff0000ff"//  #rrggbbaa
        
"#ffff00000000"//  #rrrrggggbbbb
        
"#ffff00000000ffff"//  #rrrrggggbbbbaaaa
        
"rgb(255, 0, 0)"//  an integer in the range 0—255 for each component
        
"rgb(100.0%, 0.0%, 0.0%)"//  a float in the range 0—100% for each component
        
"rgb(255, 0, 0)"//  range 0 - 255
        
"rgba(255, 0, 0, 1.0)"//  the same, with an explicit alpha value
        
"rgb(100%, 0%, 0%)"//  range 0.0% - 100.0%
        
"rgba(100%, 0%, 0%, 1.0)"//  the same, with an explicit alpha value
    
);

    
$draw = new \ImagickDraw();
    
$count 0;
    
$black = new \ImagickPixel('rgb(0, 0, 0)');

    foreach (
$exampleColors as $exampleColor) {
        
$color = new \ImagickPixel($exampleColor);

        
$draw->setstrokewidth(1.0);
        
$draw->setStrokeColor($black);
        
$draw->setFillColor($color);
        
$offsetX = ($count $columns) * 50 5;
        
$offsetY intval($count $columns) * 50 5;
        
$draw->rectangle($offsetX$offsetY40 $offsetX40 $offsetY);
        
$count++;
    }

    
$image = new \Imagick();
    
$image->newImage(350350"blue");
    
$image->setImageFormat("png");
    
$image->drawImage($draw);
    
header("Content-Type: image/png");
    echo 
$image->getImageBlob();
}

?>

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-imagickpixel.construct.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut