aboutsummaryrefslogtreecommitdiff
path: root/Perl/Zinc
diff options
context:
space:
mode:
authormertz2003-06-24 15:12:32 +0000
committermertz2003-06-24 15:12:32 +0000
commitb54c2e3875bdf007b1b216e946a34c36b2d57224 (patch)
tree9005f9750c4e54b6d25f97061b6dcf4e21ca5619 /Perl/Zinc
parent8b26b4c2416759094fe34ba80595a5588e706f5f (diff)
downloadtkzinc-b54c2e3875bdf007b1b216e946a34c36b2d57224.zip
tkzinc-b54c2e3875bdf007b1b216e946a34c36b2d57224.tar.gz
tkzinc-b54c2e3875bdf007b1b216e946a34c36b2d57224.tar.bz2
tkzinc-b54c2e3875bdf007b1b216e946a34c36b2d57224.tar.xz
Some slight cleaning of Graphics in function names, export etc....
Diffstat (limited to 'Perl/Zinc')
-rw-r--r--Perl/Zinc/Graphics.pm95
1 files changed, 45 insertions, 50 deletions
diff --git a/Perl/Zinc/Graphics.pm b/Perl/Zinc/Graphics.pm
index bd312c8..22af410 100644
--- a/Perl/Zinc/Graphics.pm
+++ b/Perl/Zinc/Graphics.pm
@@ -5,43 +5,58 @@
# module de fonctions graphiques
#
#-----------------------------------------------------------------------------------
-# Gestion de ressources globales : gradiants zinc (couleurs et dégradés nommés)
+# Gestion de ressources globales : gradients zinc (couleurs et dégradés nommés)
# patterns (fichiers bitmap X11)
# textures (fichiers texture)
# images (fichiers GIF, JPEG, PNG)
#-----------------------------------------------------------------------------------
-# Fonctions Zinc : buildZincItem (réalisation d'un item zinc à partir d'une table de description)
+# Functions to create complexe graphic component :
+# buildZincItem (réalisation d'un item zinc à partir d'une table de description)
#
-# Fonctions géométriques : roundedRectangleCoords
-# HippoCoords
+# Function to compute complexe geometrical forms :
+# roundedRectangleCoords
+# hippodromeCoords
# polygonCoords
# roundedCurveCoords
# polylineCoords
# tabBoxCoords
-# roundedAngle
-# roundedCurve
+# pathLineCoords
+#
+# Geometrical Functions :
# perpendicularPoint
# lineAngle
# vertexAngle
# arc_pts
# rad_point
#
-# Fonctions picturales : setGradiants
+# Pictorial Functions :
+# setGradients
# getPattern
# getTexture
# getImage
# init_pixmaps
+# hexaRGBcolor
+# createGraduate
#-----------------------------------------------------------------------------------
# Authors: Jean-Luc Vinot <vinot@cena.fr>
#
# $Id:
#-----------------------------------------------------------------------------------
-package Graphics;
+package Zinc::Graphics;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(&buildZincItem &setGradiants &getTexture &getPattern &getImage &roundedAngle &roundedCurveCoords
- &polylineCoords &polygonCoords &TabBoxCoords &pathLineCoords &rad_point &arc_pts);
+@EXPORT = qw(&buildZincItem
+
+ &roundedRectangleCoords &hippodromeCoords &polygonCoords
+ &roundedCurveCoords &polylineCoords &tabBoxCoords &pathLineCoords
+
+ &perpendicularPoint &lineAngle &vertexAngle &rad_point &arc_pts
+
+
+
+ &setGradients &getPattern &getTexture &getImage &init_pixmaps &hexaRGBcolor &createGraduate
+ );
use strict;
use Carp;
@@ -51,13 +66,11 @@ use Math::Trig;
# constante facteur point directeur
my $const_ptd_factor = .5523;
-my @Gradiants;
+my @Gradients;
my %textures;
my %images;
my %bitmaps;
-my $font_7 = '-cenapii-bleriot mini-book-r-normal--7-70-75-75-p-*-iso8859-15';
-
#-----------------------------------------------------------------------------------
# Graphics::buildZincItem
@@ -109,7 +122,7 @@ sub buildZincItem {
} elsif ($itemtype eq 'hippodrome') {
$itemtype = 'curve';
$style->{'-params'}->{'-closed'} = 1;
- $coords = &HippoCoords($coords, %{$style});
+ $coords = &hippodromeCoords($coords, %{$style});
} elsif ($itemtype eq 'polygone') {
$itemtype = 'curve';
@@ -253,7 +266,7 @@ sub metaCoords {
$pts = &polygonCoords($coords, %options);
} elsif ($type eq 'hyppodrome') {
- $pts = &hippoCoords($coords, %options);
+ $pts = &hippodromeCoords($coords, %options);
} elsif ($type eq 'polyline') {
$pts = &polylineCoords($coords, %options);
@@ -339,7 +352,7 @@ sub roundedRectangleCoords {
#-----------------------------------------------------------------------------------
-# Graphics::HippoCoords
+# Graphics::hippodromeCoords
# calcul des coords d'un hippodrome
# paramètres :
# coords : coordonnées du rectangle exinscrit
@@ -348,7 +361,7 @@ sub roundedRectangleCoords {
# -corners : liste des raccords de sommets [0|1] par défaut [1,1,1,1]
# -trunc : troncatures [left|right|top|bottom|both]
#-----------------------------------------------------------------------------------
-sub HippoCoords {
+sub hippodromeCoords {
my ($coords, %options) = @_;
my ($x0, $y0, $xn, $yn) = ($coords->[0]->[0], $coords->[0]->[1],
$coords->[1]->[0], $coords->[1]->[1]);
@@ -435,8 +448,11 @@ sub polygonCoords {
}
}
+
+
#-----------------------------------------------------------------------------------
# Graphics::roundedAngle
+# THIS FUNCTION IS NO MORE USED, NEITHER EXPORTED
# curve d'angle avec raccord circulaire
# paramètres :
# zinc : widget
@@ -456,27 +472,6 @@ sub roundedAngle {
$parentgroup = 1 if (!defined $parentgroup);
- # temporaire -> visibilité de l'arc 'conique' correspondant
- $zinc->add('arc', $parentgroup,
- [[$cx0 - $radius, $cy0 - $radius],[$cx0 + $radius, $cy0 + $radius]],
- -priority => 10,
- -linecolor => '#9999ff',
- -filled => 0,
- -visible => 1,
- -linewidth => 2,
- );
-
- # temporaire
- $zinc->add('text', $parentgroup,
- -position => [$cx0 - $radius + 2, $cy0],
- -priority => 20,
- -color => '#0000ff',
- -text => $angle."°",
- -font => $font_7,
- -alignment => 'left',
- -anchor => 'w',
- );
-
$zinc->add('curve', $parentgroup,
[$pt0,@{$corner_pts},$pt2],
-closed => 0,
@@ -877,7 +872,7 @@ sub buidTabBox {
}
#-----------------------------------------------------------------------------------
-# TabBoxCoords
+# tabBoxCoords
# Calcul des shapes de boites à onglets
#
# coords : coordonnées rectangle de la bounding box
@@ -892,7 +887,7 @@ sub buidTabBox {
# -radius <n> : rayon des arrondis d'angle
# -overlap <n> : distance de recouvrement des onglets
#-----------------------------------------------------------------------------------
-sub TabBoxCoords {
+sub tabBoxCoords {
my ($coords, %options) = @_;
my ($x0, $y0, $xn, $yn) = (@{$coords->[0]}, @{$coords->[1]});
my (@shapes, @titles_coords);
@@ -1053,21 +1048,21 @@ sub TabBoxCoords {
#-----------------------------------------------------------------------------------
-# RESOURCES GRAPHIQUES GRADIANTS, PATTERNS, TEXTURES, IMAGES...
+# RESOURCES GRAPHIQUES GRADIENTS, PATTERNS, TEXTURES, IMAGES...
#-----------------------------------------------------------------------------------
#-----------------------------------------------------------------------------------
-# Graphics::setGradiants
-# création de gradiant nommés Zinc
+# Graphics::setGradients
+# création de gradient nommés Zinc
#-----------------------------------------------------------------------------------
-sub setGradiants {
+sub setGradients {
my ($zinc, $grads) = @_;
- # initialise les gradiants de taches
- unless (@Gradiants) {
- while (my ($name, $gradiant) = each( %{$grads})) {
- # création des gradiants nommés
- $zinc->gname($gradiant, $name);
- push(@Gradiants, $name);
+ # initialise les gradients de taches
+ unless (@Gradients) {
+ while (my ($name, $gradient) = each( %{$grads})) {
+ # création des gradients nommés
+ $zinc->gname($gradient, $name);
+ push(@Gradients, $name);
}
}
}