Symbolism
So I've devised a way to pragmatically draw my sign in code using the GD library in PHP. Copyright Markizano.NET, LLC. All rights reserved.
As long as the dimensions are 2x3, the measurements should evolve appropriately. For example, if you start with an empty transparent 200x300, then it should look appropriate. Devised below:
<?php
header("X-Author: Markizano Draconus");
header("Content-Type: image/png");
# An empty canvas of an image. Just an empty, transparent PNG image.
define("IMG", "Altrish.png");
$png = imagecreatefrompng(IMG);
imagealphablending($png, false);
imagesavealpha($png, true);
$stat = new stdClass;
$leftHyp = new stdClass;
$rightHyp = new stdClass;
$halfPy = new stdClass;
$margin = 10;
# 200, 300
list($stat->canvasWidth, $stat->canvasHeight) = getimagesize(IMG);
$stat->width = $stat->canvasWidth - ($margin*2); # Image area width, adding padding from the edge.
$stat->height = $stat->canvasHeight - ($margin*2); # Image area height, adding padding from the edge.
$stat->bottom = $stat->canvasHeight - $margin; # 290
$stat->right = $stat->canvasWidth - $margin; # 190
$stat->lefty = ($stat->height * 0.6667) + $margin;
$stat->topx = ($stat->width * 0.5) + $margin; # 10
$bleu = imagecolorallocate($png, 0x06, 0x25, 0x58);
#imageline($resource, $x1, $y1, $x2, $y2, $color);
imageline($png, $stat->topx, $margin, $margin, $stat->lefty, $bleu); # Top to left.
imageline($png, $stat->topx, $margin, $stat->right, $stat->lefty, $bleu); # Top to right.
imageline($png, $stat->topx, $stat->bottom, $margin, $stat->lefty, $bleu); # Bottom to left.
imageline($png, $stat->topx, $stat->bottom, $stat->right, $stat->lefty, $bleu); # Bottom to right.
$leftHyp->x1 = ($stat->width * 0.25) + $margin;
$leftHyp->y = ($stat->height / 3) + $margin;
$leftHyp->x2 = ($stat->width * 0.5);
$rightHyp->x1 = ($stat->width * 0.75) + $margin;
$rightHyp->y = ($stat->height / 3) + $margin;
$rightHyp->x2 = ($stat->width * 0.5) + $margin + $margin;
$halfPy->lx1 = $leftHyp->x1 + ( ( $leftHyp->x2 - $leftHyp->x1 ) * 0.5 );
$halfPy->x2 = ( $stat->width * 0.5 ) + $margin;
$halfPy->rx1 = $rightHyp->x1 - ( ( $leftHyp->x2 - $leftHyp->x1 ) * 0.5 );
$halfPy->ltrapx = $stat->topx - ( $margin + ( $stat->width * 0.25 ) );
$halfPy->rtrapx = $stat->topx + ( $margin + ( $stat->width * 0.25 ) );
$halfPy->trapy = $stat->bottom - ( $margin + ( $stat->height / 6 ) );
imageline($png, $leftHyp->x1, $leftHyp->y, $leftHyp->x2, $leftHyp->y, $bleu); # Left Inner Pyramid base. Outer hypotenuse.
imageline($png, $rightHyp->x1, $rightHyp->y, $rightHyp->x2, $rightHyp->y, $bleu); # Right Inner Pyramid base. Outer hypotenuse.
imageline($png, $halfPy->lx1, $leftHyp->y, $stat->topx, $margin +20, $bleu); # Left Inner Pyramid.
imageline($png, $halfPy->rx1, $rightHyp->y, $stat->topx, $margin +20, $bleu); # Right inner pyramid.
imageline($png, $leftHyp->x2, $leftHyp->y, $stat->topx, $stat->bottom, $bleu); # Left resivoir coming down.
imageline($png, $rightHyp->x2, $rightHyp->y, $stat->topx, $stat->bottom, $bleu); # Right resivoir coming down.
imageline($png, $leftHyp->x2, $leftHyp->y, $halfPy->ltrapx, $halfPy->trapy, $bleu); # Left resivoir trap.
imageline($png, $rightHyp->x2, $rightHyp->y, $halfPy->rtrapx, $halfPy->trapy, $bleu); # Right resivoir trap.
imagepng($png);
imagedestroy($png);
Comments
Post a Comment