The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Quiq::Gd::Component::ColorBar - Rechteck mit einem Farbverlauf

BASE CLASS

Quiq::Gd::Component

ATTRIBUTES

Fett hervorgehobene Attribute sind Pflichtangaben beim Konstruktor-Aufruf.

width => $int (Default: keiner)

Breite der Grafik in Pixeln.

height => $int (Default: keiner)

Höhe der Grafik in Pixeln.

colors => \@colors (Default: [])

Farben des Farbverlaufs.

EXAMPLE

Code:

use Quiq::Gd::Image;
use Quiq::Gd::Component::ColorBar;

# Konfiguration

my $width = 300;
my $height = 25;
my $numColors = 512;

# Grafik-Objekt instantiieren

my $g = Quiq::Gd::Component::ColorBar->new(
    width=>$width,
    height=>$height,
);

# Bild-Objekt instantiieren
my $img = Quiq::Gd::Image->new($width,$height);

# Grafik auf Bild zeichnen

$g->render($img,0,0,
    colors=>[$img->rainbowColors($numColors)],
);

Grafik:

[Nur im Browser sichtbar]

METHODS

Konstruktor

new() - Konstruktor

Synopsis

$g = $class->new(@keyVal);

Description

Instantiiere ein Grafik-Objekt mit den Eigenschaften @keyVal (s. Abschnitt ATTRIBUTES) und liefere eine Referenz auf das Objekt zurück.

Zeichnen

render() - Zeichne Grafik

Synopsis

$g->render($img);
$g->render($img,$x,$y,@keyVal);
$class->render($img,$x,$y,@keyVal);

Description

Zeichne die Grafik in Bild $img an Position ($x,$y). Die Methode liefert keinen Wert zurück.

Objektmethoden

siehe BASE CLASS

VERSION

1.220

AUTHOR

Frank Seitz, http://fseitz.de/

COPYRIGHT

Copyright (C) 2024 Frank Seitz

LICENSE

This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.