<?php
/** +----------------------------------------------------------+
* | BY CONVENTION THE DEFINING POINT ($x,$y) MUST AT |
* | THE END OF THE ATTRIBUTES TO ALLOW DELETING |
* | IN THE EDITOR AND TO PREVENT IT FROM BEING DELETED |
* | BY THE EDITOR. IT IS ALSO BEST NOT TO USE NON-SCALABLE |
* | GD FUNCTIONS LIKE "LINE", BUT USE A "RECT" INSTEAD. |
* +----------------------------------------------------------+
*/
//
// ** Text Editor ** 3D
// Circular Roof Around a Tower
//
function circleroof($image,$lowerheight,$lowerradius,$upperheight,$upperradius,$scale,$x,$y) {
}
function povobject($image,$object,$direction,$scale,$x,$y) {}
//
// ** Text Editor ** 3D
// direction, l,r,u,d, height in feet,
// on = on,off either light on or light off
// pole = will make a lamp post with light up.
//
function light($image,$direction,$height,$on,$pole,$scale,$x,$y) {
$zcolor = ImageColorAllocate($image,0,0,0);
$x=$x*$scale;
$y=$y*$scale;
$radius=.5*$scale;
for($i=0; $i<=$radius; ++$i) {
ImageArc($image,$x,$y,$i,$i,0,360,$zcolor);
}
}
// ** Text Editor ** 3D
// Draws a 3-D palm tree in povray at location x,y
//
function DDDpalms($image,$scale,$x,$y){}
//
// ** Text Editor ** 2D, 3D
// Requires Beizer.inc and Grasspatch.inc
// maxbladeheight = height of blade
// minblade height = minimum height of blade
// x,y lower right, u,v, upper left.
//
function DDDgrasspatch($image, $maxbladeheight, $minbladeheight, $u, $v, $scale, $x, $y)
{
$green = ImageColorAllocate($image,0,255,0);
$x = $x * $scale;
$y = $y * $scale;
$u = ($u) * $scale;
$v = ($v) * $scale;
ImageFilledRectangle($image,$x,$y,$u,$v,$green);
}
//
// ** texteditor ** 2D
// Used to make a curved Arc
// sangle = start angle (right 0, down 90, left 180, up 270)
// eangle = end angle
// radius
//
function arc($image, $radius, $sangle, $eangle, $color, $scale, $x, $y)
{
$red = hexdec(substr($color,0,2));
$grn = hexdec(substr($color,2,2));
$blu = hexdec(substr($color,4,2));
$zcolor = ImageColorAllocate($image,$red,$grn,$blu);
$x=$x*$scale;
$y=$y*$scale;
$radius=$radius*$scale*2;
for($i=0; $i<=$radius; ++$i) {
ImageArc($image,$x,$y,$i,$i,$sangle,$eangle,$zcolor);
}
}
//
// Draws a roof in pov-ray, puts ticks down in 2D.
// Direction is necessary when I make pitched roof function
// in pov-ray.
//
// $direction = <u>"R"</u> for right,
// x,y is lower left if going right.
// $direction = <u>"D"</u> for down,
// x,y is or upper left going down.
//
function flatroof($image, $direction, $u, $v, $scale, $x, $y)
{
$roofline=ImageColorAllocate($image,210,210,0);
if ($direction == "R") {
imagesetpixel ($image,$x*$scale,$y*$scale+$scale-2,$roofline);
imagesetpixel ($image,$x*$scale,$y*$scale+$scale-1,$roofline);
imagesetpixel ($image,$x*$scale,$y*$scale+$scale,$roofline);
imagesetpixel ($image,$x*$scale+1,$y*$scale+$scale,$roofline);
imagesetpixel ($image,$x*$scale+2,$y*$scale+$scale,$roofline);
imagesetpixel ($image,$x*$scale+3,$y*$scale+$scale,$roofline);
imagesetpixel ($image,$u*$scale+$scale,$v*$scale+2,$roofline);
imagesetpixel ($image,$u*$scale+$scale,$v*$scale+1,$roofline);
imagesetpixel ($image,$u*$scale+$scale,$v*$scale,$roofline);
imagesetpixel ($image,$u*$scale+($scale-1),$v*$scale,$roofline);
imagesetpixel ($image,$u*$scale+($scale-2),$v*$scale,$roofline);
}
if ($direction == "D") {
imagesetpixel ($image,$x*$scale,$y*$scale+3,$roofline);
imagesetpixel ($image,$x*$scale,$y*$scale+2,$roofline);
imagesetpixel ($image,$x*$scale,$y*$scale+1,$roofline);
imagesetpixel ($image,$x*$scale,$y*$scale,$roofline);
imagesetpixel ($image,$x*$scale+1,$y*$scale,$roofline);
imagesetpixel ($image,$x*$scale+2,$y*$scale,$roofline);
imagesetpixel ($image,$u*$scale+$scale,$v*$scale+$scale-2,$roofline);
imagesetpixel ($image,$u*$scale+$scale,$v*$scale+$scale-1,$roofline);
imagesetpixel ($image,$u*$scale+$scale,$v*$scale+$scale,$roofline);
imagesetpixel ($image,$u*$scale+($scale-1),$v*$scale+$scale,$roofline);
imagesetpixel ($image,$u*$scale+($scale-2),$v*$scale+$scale,$roofline);
}
}
//
// Draws a simple pixel, click point and submit.
// Color option may be added later.
//
function pixel($image, $scale, $x, $y)
{
$edge = ImageColorAllocate($image,160,160,150);
$padobe = ImageColorAllocate($image,100,100,100);
$x = $x * $scale;
$y = $y * $scale;
ImageFilledRectangle($image,$x,$y,$x+$scale,$y+$scale,$padobe);
ImageRectangle($image,$x,$y,$x+$scale,$y+$scale,$edge);
}
//
// Draws up to 4 horizontal lines.
//
//
function hlines($image,$u,$v,$alc,$blc,$clc,$dlc,$scale,$x,$y) {
$red = hexdec(substr($alc,0,2));
$grn = hexdec(substr($alc,2,2));
$blu = hexdec(substr($alc,4,2));
$a = ImageColorAllocate($image,$red,$grn,$blu);
if ($blc != "") {
$red = hexdec(substr($blc,0,2));
$grn = hexdec(substr($blc,2,2));
$blu = hexdec(substr($blc,4,2));
$b = ImageColorAllocate($image,$red,$grn,$blu);
}
if ($clc != "") {
$red = hexdec(substr($clc,0,2));
$grn = hexdec(substr($clc,2,2));
$blu = hexdec(substr($clc,4,2));
$c = ImageColorAllocate($image,$red,$grn,$blu);
}
if ($dlc != "") {
$red = hexdec(substr($dlc,0,2));
$grn = hexdec(substr($dlc,2,2));
$blu = hexdec(substr($dlc,4,2));
$d = ImageColorAllocate($image,$red,$grn,$blu);
}
$x=$x*$scale;
$y=$y*$scale;
$u=$u*$scale-1;
$v=$v*$scale;
$s=$scale/4;
ImageFilledRectangle($image, $x, $y+0*$s, $u, $v+1*$s, $a);
ImageFilledRectangle($image, $x, $y+1*$s, $u, $v+2*$s, $b);
ImageFilledRectangle($image, $x, $y+2*$s, $u, $v+3*$s, $c);
ImageFilledRectangle($image, $x, $y+3*$s, $u, $v+4*$s-1, $d);
}
//
// Draws a checker pattern.
//
// $u,$v = <u>lower right corner</u>, $x,$y upper left corner.
// In the textbox enter, "acolor&bcolor&edgecolor" in hexadecimal
// For example <u>"123aef&112233&121111"</u> If leave off
// one color parameter it will draw checker without the edge.
// If you use only one parameter, it will draw a solid
// rectangle.
//
function checker($image,$gridsize,$u,$v,$acolor,$bcolor,$edge,$scale,$x,$y)
{
if ($gridsize=='10') $gridsize=.5;
if ($gridsize=='11') $gridsize=.33333333;
if ($gridsize=='12') $gridsize=.25;
$scale=$scale/$gridsize;
$x=$x*$gridsize;
$y=$y*$gridsize;
$u=$u*$gridsize;
$v=$v*$gridsize;
$red = hexdec(substr($acolor,0,2));
$grn = hexdec(substr($acolor,2,2));
$blu = hexdec(substr($acolor,4,2));
$a = ImageColorAllocate($image,$red,$grn,$blu);
if ($bcolor != "") {
$red = hexdec(substr($bcolor,0,2));
$grn = hexdec(substr($bcolor,2,2));
$blu = hexdec(substr($bcolor,4,2));
}
$b = ImageColorAllocate($image,$red,$grn,$blu);
if ($edge != "") {
$red = hexdec(substr($edge,0,2));
$grn = hexdec(substr($edge,2,2));
$blu = hexdec(substr($edge,4,2));
$c= ImageColorAllocate($image,$red,$grn,$blu);
}
for($i=$x; $i<$u; ++$i) {
for($j=$y; $j<$v; ++$j) {
$color=$i+$j;
if ($color % 2) {
$color = $a;
} else {
$color = $b;
}
$xx=$i*$scale;
$yy=$j*$scale;
ImageFilledRectangle($image,$xx,$yy,$xx+$scale-1,$yy+$scale-1,$color);
If ($edge != "") ImageRectangle($image,$xx,$yy,$xx+$scale,$yy+$scale,$c);
}
}
}
//
// Draws a line from x,y to u,v. Function should be changed
// with a rectangle instead of line to allow proper scaling
// on line thickness.
//
function line($image, $u, $v, $scale, $x, $y)
{
$edge=ImageColorAllocate($image,160,160,150);
$x=$x*$scale;
$u=$u*$scale;
$y=$y*$scale;
$v=$v*$scale;
Imageline($image,$x,$y,$u,$v,$edge);
Imageline($image,$x+1,$y,$u+1,$v,$edge);
Imageline($image,$x,$y+1,$u,$v+1,$edge);
}
//
// Draws a straight padobe wall 1 foot thick.
// Padobe is a specialized material made out of paper.
// Can be used for cobbed walls of any material.
// 4' width is standard plywood form size.
//
// $direction = <u>"R"</u> for right, <u>"D"</u> for down
// $length = <u>"1-12"</u> in 4' sections.
//
function wall($image, $length, $direction, $scale, $x, $y)
{
$edge=ImageColorAllocate($image,160,160,150);
$padobe=ImageColorAllocate($image,100,100,100);
$x=$x*$scale;
$y=$y*$scale;
for($i=0; $i<$length; ++$i) {
if ($direction == "R") {
ImageFilledRectangle($image,$x+($i*4*$scale),$y,
$x+(4*$scale)+($i*4*$scale),$y+$scale,$padobe);
ImageRectangle($image,$x+($i*4*$scale),$y,
$x+(4*$scale)+($i*4*$scale),$y+$scale,$edge);
} else {
ImageFilledrectangle($image,$x,$y+($i*4*$scale),
$x+$scale,$y+(4*$scale)+($i*4*$scale),$padobe);
ImageRectangle($image,$x,$y+($i*4*$scale),
$x+$scale,$y+(4*$scale)+($i*4*$scale),$edge);
}
}
}
//
// Draw a stylish 90 degree curved wall.
// $direction = <u>"LU"</u>,<u>"LD"</u>,<u>"RU"</u>,<u>"RD"</u>
// - Left Right Up Down. $radius = <u>"1-12"</u> curvature
//
function curve($image, $radius, $direction, $scale, $x, $y)
{
$padobe=ImageColorAllocate($image,100,100,100);
$edge=ImageColorAllocate($image,160,160,151);
$x=$x*$scale;
$y=$y*$scale;
$radius=$radius*$scale+1;
if ($direction == "RU") {
$y=$y-$radius+$scale+1;
ImageArc($image,$x,$y,$radius*2,$radius*2,0,90,$edge);
ImageArc($image,$x,$y,($radius-$scale)*2,($radius-$scale)*2,0,90,$edge);
ImageLine($image,$x,$y+$radius,$x,$y+$radius-$scale,$edge);
ImageLine($image,$x+$radius,$y,$x+$radius-$scale,$y,$edge);
ImageFilltoBorder($image,$x+1,$y+$radius-($scale/2),$edge,$padobe);
}
if ($direction == "RD") {
$y=$y+$radius-1;
ImageArc($image,$x,$y,$radius*2,$radius*2,270,360,$edge);
ImageArc($image,$x,$y,($radius-$scale)*2,($radius-$scale)*2,270,360,$edge);
ImageLine($image,$x,$y-$radius+$scale,$x,$y-$radius,$edge);
ImageLine($image,$x+$radius,$y,$x+$radius-$scale,$y,$edge);
ImageFilltoBorder($image,$x+1,$y-$radius+($scale/2),$edge,$padobe);
}
if ($direction == "LU") {
$y=$y-$radius+$scale+1;
$x=$x+$scale;
ImageArc($image,$x,$y,$radius*2,$radius*2,90,180,$edge);
ImageArc($image,$x,$y,($radius-$scale)*2,($radius-$scale)*2,90,180,$edge);
ImageLine($image,$x,$y+$radius,$x,$y+$radius-$scale,$edge);
ImageLine($image,$x-$radius,$y,$x-$radius+$scale,$y,$edge);
ImageFilltoBorder($image,$x-1,$y+$radius-$scale,$edge,$padobe);
}
if ($direction == "LD") {
$y=$y+$radius-1;
$x=$x+$scale;
ImageArc($image,$x,$y,$radius*2,$radius*2,180,270,$edge);
ImageArc($image,$x,$y,($radius-$scale)*2,($radius-$scale)*2,180,270,$edge);
ImageLine($image,$x,$y-$radius+$scale,$x,$y-$radius,$edge);
ImageLine($image,$x-$radius,$y,$x-$radius+$scale,$y,$edge);
ImageFilltoBorder($image,$x-1,$y-$radius+($scale/2),$edge,$padobe);
}
}
// Draws a window. Don't overlap for .pov to work correctly.
// $direction = <u>"R"</u>, <u>"D"</u> - Right or Down.
// $length = <u>"1-12"</u>
//
function window ($image, $length, $direction, $scale, $x, $y)
{
$padobe=ImageColorAllocate($image,100,100,100);
$glass=ImageColorAllocate($image,77,251,126);
$edge=ImageColorAllocate($image,160,160,150);
$x=$x*$scale;
$y=$y*$scale;
if ($direction == "R") {
ImageFilledRectangle($image,$x,$y,$x+($scale*$length),$y+$scale,$padobe);
ImageRectangle($image,$x,$y,$x+($scale*$length),$y+$scale,$edge);
ImageLine($image,$x+1,$y,$x+1,$y+$scale,$glass);
ImageLine($image,$x+($length*$scale)-1,$y,
$x+($length*$scale)-1,$y+$scale,$glass);
ImageLine($image,$x,$y+($scale/2-1),
$x+($length*$scale),$y+($scale/2-1),$glass);
ImageLine($image,$x,$y+($scale/2+1),
$x+($length*$scale),$y+($scale/2+1),$glass);
} else {
ImageFilledRectangle($image,$x,$y,
$x+$scale,$y+($scale*$length),$padobe);
ImageRectangle($image,$x,$y,
$x+$scale,$y+($scale*$length),$edge);
ImageLine($image,$x,$y+1,$x+$scale,$y+1,$glass);
ImageLine($image,$x,$y+($length*$scale)-1,
$x+$scale,$y+($length*$scale)-1,$glass);
ImageLine($image,$x+($scale/2-1),$y,
$x+($scale/2-1),$y+($length*$scale),$glass);
ImageLine($image,$x+($scale/2+1),$y,
$x+($scale/2+1),$y+($length*$scale),$glass);
}
}
//
// Draws a door. Don't overlap for .pov to look right.
// $direction = <u>"R"</u>, <u>"D"</u> right or down.
// $length = <u>"1-12"</u> pixel spaces.
//
function door($image, $length, $direction, $scale, $x, $y)
{
$edge=ImageColorAllocate($image,160,160,150);
$x=$x*$scale;
$y=$y*$scale;
if ($direction == "R") {
ImageFilledRectangle($image, $x, $y,
$x+($scale*$length), $y+$scale, $edge);
} else {
ImageFilledrectangle($image, $x, $y,
$x+$scale, $y+($scale*$length), $edge);
}
}
//
// Use by hand. Fonts relative to scale 10.
// Puts truetype font on screen.
//
// $dir = direction
// $color = color
// $ttfont = truetype font name, example 'arial.ttf'
// $ttext = text to print, example 'Hello World'
// $fontsize = relative to scale = 10.
//
function tttext($image,$dir,$acolor,$ttfont,$ttext,$fontsize,$scale,$x,$y)
{
$red = hexdec(substr($acolor,0,2));
$grn = hexdec(substr($acolor,2,2));
$blu = hexdec(substr($acolor,4,2));
$zz = ImageColorAllocate($image,$red,$grn,$blu);
$ttfont=getcwd() . "/ttf/$ttfont";
$fontsize=$fontsize*$scale/10;
Imagettftext($image,$fontsize,$dir,$x*$scale+1,$y*$scale+1,$zz,$ttfont,$ttext);
// ImageColorDeAllocate($image,$zz-1);
// ImageColorDeAllocate($image,$zz-2);
}
//
// Used for movies, works.
//
function scrolltext($ttime,$ttfont,$ttext,$fontsize,$scale,$x,$y)
{
global $time;
global $image;
$ntime=$time-$ttime;
if ($ntime>10 and $ntime<234) {
$red = floor(($ntime-10)*1);
$grn = floor(($ntime-10)*1);
$blu = floor(($ntime-10)*1);
$ttfont=getcwd() . "/ttf/$ttfont";
$a = ImageColorAllocate($image,$red,$grn,$blu);
$fontsize=$fontsize*$scale/10;
Imagettftext($image,$fontsize,$dir,5*$scale+1,5*$scale+$ntime-10,$a,$ttfont,$ttext);
}
}
//
// Put polygon shape in array and call it. Thing <u>object name like star</u>
// <u>object scale is objects size</u>. <u>acolor</u> is color, <u>bcolor</u>
// is edgecolor.
//
function movies_icondraw($ttime,$totaltime,$icon,$ratio,$imagescale,$scale,$x,$y)
{
global $time;
global $image;
$ntime=$time-$ttime;
if ($ntime>0 and $ntime<$totaltime) {
$handscale = $scale/$imagescale*$ratio;
$icon = getcwd() . "/pictures/$icon";
$icon = ImageCreateFromJPEG($icon);
$width = ImageSX($icon);
$height = ImageSY($icon);
ImageCopyResampled($image, $icon, $x*$scale, $y*$scale, 0, 0,
$width*$handscale, $height*$handscale, $width, $height);
}
}
function polygon($image,$thing,$objectscale,$acolor,$bcolor,$scale,$x,$y)
{
if ($thing=="sar") $points = array(0,-1,2,0,-2,0);
if ($thing=="tar") $points = array(0,-1,1,0,2,0,1,1,2,2,-2,2,-1,1,-2,0,-1,0);
if ($thing=="star") $points = array(0,0,1,3,3,1,3,4,6,7,3,9,3,12,1,9,
0,13,-1,9,-3,12,-3,9,-6,7,-3,4,-3,1,-1,3);
if ($thing=="uparrow") $points = array(0,0, 1,1, .25,1, .5,2 , -.5,2
,-.25,1, -1,1);
if ($thing=="downarrow") $points = array(0,0, 1,-1, .25,-1, .5,-2 , -.5,-2
,-.25,-1, -1,-1);
$numpoints=count($points)/2;
for ($i=0; $i<=$numpoints; $i++) {
$points[$i*2]=$scale*(($points[$i*2]*$objectscale)+$x);
$points[$i*2+1]=$scale*(($points[$i*2+1]*$objectscale)+$y);
}
$red = hexdec(substr($acolor,0,2));
$grn = hexdec(substr($acolor,2,2));
$blu = hexdec(substr($acolor,4,2));
$a = ImageColorAllocate($image,$red,$grn,$blu);
if ($bcolor != "") {
$red = hexdec(substr($bcolor,0,2));
$grn = hexdec(substr($bcolor,2,2));
$blu = hexdec(substr($bcolor,4,2));
$b = ImageColorAllocate($image,$red,$grn,$blu);
}
Imagefilledpolygon($image,$points,$numpoints,$a);
if ($bcolor != "") {
Imagepolygon($image,$points,$numpoints,$b);
}
}
//
// GD text is not scalable but works.
// $size=<u>"1-5"</u> standard GD text sizes
// Enter <u>any text</u> in the textfeild.
//
function gdtext($image,$size,$txt,$scale,$x,$y) {
$white=ImageColorAllocate($image,250,251,254);
$x=$x*$scale;
$y=$y*$scale;
Imagestring($image,$size,$x,$y,$txt,$white);
}
//
// Use by hand.
// draws a frame for 640, 480 pictures
// delete point is 0,0.
// textbox entry title, author "Camelot Castle&William Jones"
//
// $title - string for title, "Camelot"
// $author - string for author, "William Jones"
//
function ptitle($image, $title, $author, $scale, $x, $y)
{
$white=ImageColorAllocate($image,250,251,254);
$black=ImageColorAllocate($image,0,0,0);
$fontsize=100/$scale;
ImageFilledrectangle($image,0,450,639,479,$black);
// Top Edge Line
Imageline($image,0,0,638,0,$white);
Imageline($image,0,1,639,1,$white);
// Left Edge Line
Imageline($image,0,0,0,479,$white);
Imageline($image,1,0,1,479,$white);
// Right Edge Line
Imageline($image,638,0,638,479,$white);
Imageline($image,639,0,639,479,$white);
// Bottom Line
Imageline($image,0,479,639,479,$white);
Imageline($image,0,478,639,478,$white);
// Top Box Line
Imageline($image,0,450,639,450,$white);
Imageline($image,0,449,639,449,$white);
// Left Box Line
Imageline($image,0,450,0,479,$white);
Imageline($image,1,450,1,479,$white);
// Mid-Left Box Line
Imageline($image,180,450,180,479,$white);
Imageline($image,181,450,181,479,$white);
// Mid Box Line
Imageline($image,350,450,350,479,$white);
Imageline($image,351,450,351,479,$white);
// Mid-Right Box Line
Imageline($image,530,450,530,479,$white);
Imageline($image,531,450,531,479,$white);
// Right Box Line
Imageline($image,638,450,638,479,$white);
Imageline($image,639,450,639,479,$white);
$author = "DRAWN BY: " . $author;
$subject = "TITLE: " . $title;
$dscale = "SCALE: 1 SQ is 1 SQ FT";
$date_str = getdate();
$mon = $date_str["mon"];
$year = $date_str["year"];
Imagestring($image,2,10,460,$subject,$white);
Imagestring($image,2,190,460,$dscale,$white);
Imagestring($image,2,360,460,$author,$white);
Imagestring($image,2,540,460,"DATE: $mon-$year",$white);
}
//
// Draw a gradient rectangle. Must use by hand.
// Function will use all 256 colors so not used.
//
// $startcol = the start color for the fade.
// $endcolor = the end color, colors will be averaged in between.
//
function grad($image, $height, $width, $startcol, $endcol,$scale,$x,$y)
{
$scale = 10;
$x = $x*$scale;
$y = $y*$scale;
$height = $height*$scale;
$width = $width*$scale;
$colstr = "";
$ct = 0;
$sr = hexdec(substr($startcol, 0, 2));
$sg = hexdec(substr($startcol, 2, 2));
$sb = hexdec(substr($startcol, 4, 2));
$er = hexdec(substr($endcol, 0, 2));
$eg = hexdec(substr($endcol, 2, 2));
$eb = hexdec(substr($endcol, 4, 2));
@$rstep = ($er - $sr)/255;
@$gstep = ($eg - $sg)/255;
@$bstep = ($eb - $sb)/255;
$rotate = 0;
$place=0;
while($rotate < $height) {
$space= $height/255;
$thiscolr = abs(($sr+($rstep*$rotate)));
$thiscolg = abs(($sg+($gstep*$rotate)));
$thiscolb = abs(($sb+($bstep*$rotate)));
$col[$rotate] = imagecolorallocate ($image, $thiscolr,
$thiscolg, $thiscolb);
$l = imagefilledrectangle ($image, $x, $y+$place+$space,
$x+$width, $y+$place+$space, $col[$rotate]);
$rotate++;
$place=$place+$space;
}
}
//
// Not in editor. Must use by hand for now.
// Author : Fýrat Tiryaki hide@address.com
// Draws a 2-D Leaf
//
function leaf($image, $scale, $x, $y)
{
$white=ImageColorAllocate($image,255,255,255);
$blue=ImageColorAllocate($image,1,18,250);
$red=ImageColorAllocate($image,125,12,89);
$centerx = $x*$scale;
$centery = $y*$scale;
$size = 6;
$size = $size*$scale;
for ($x=-$size;$x<=$size;$x++) {
for ($sub=500;$sub<=10000;$sub+=500){
// $new = ($x*$x)/$sub;
// $new = ($x*$x*$x)/$sub;
// $new = ($x*$x*$x*$x)/($sub*$sub);
$new = (.5*$x*$x*$x*$x*$x)/$sub;
// $new = ($x*$x*$x*$x*$x*$x)/$sub;
imagesetpixel ($image, $centerx+$x, $centery-$new, $blue);
imagesetpixel ($image, $centery-$new, $centerx+$x, $white);
imagesetpixel ($image, $centerx-$x, $centery-$new, $red);
imagesetpixel ($image, $centery+$new, $centerx+$x, $blue);
}
}
}
// this is powerful, to use .tobs as objects (use pictures to make pictures)
// dont let $tob=$image or your system will run out of memory - infinity
// $tob is the .tob you want to paste
// $iconscale
function tobicon($image,$tob,$iconscale,$imagescale,$scale,$x,$y) {
$scalebak=$scale;
$ff = str_replace(".tob",".setup",$tob);
if (file_exists("./files/$ff")) {
include("./files/$ff");
} else {
include("./files/picture.setup");
}
$imagebak=$image;
$scale = $iconscale/$imagescale*$scalebak;
$image = ImageCreate($a*$scale,$b*$scale);
$padobeorange=ImageColorAllocate($image,150,91,14);
include ("./files/$tob");
if ($imageformat=="png") Header("Content-type: image/png");
if (!$imageformat) Header("Content-type: image/png");
if ($imageformat=="jpg" AND $time=="") Header("Content-type: image/jpeg");
$w = ImageSX($image);
$h = ImageSY($image);
$icon=$image;
$image=$imagebak;
ImageCopy($image,$icon,$x*$scalebak,$y*$scalebak, 0, 0, $w, $h);
}
// $icon is the name of the picture like "bluegill.jpg"
// $ratio is the size of the picture in relation to the image scale say .5
// $imagescale is the $scale at which picture is developed, usually 10
// thus, if $imagescale is 10 and $ratio is .5, the picture would be
// reduced 50 pecent at scale 10.
//
function icondraw($image,$icon,$ratio,$imagescale,$scale,$x,$y)
{
$handscale = $scale/$imagescale*$ratio;
//$handscale=1;
$icon = getcwd() . "/pictures/$icon";
$icon = ImageCreateFromJPEG($icon);
$width = ImageSX($icon);
$height = ImageSY($icon);
ImageCopyResampled($image, $icon, $x*$scale, $y*$scale, 0, 0,
$width*$handscale, $height*$handscale, $width, $height);
}
function icondrawpng($image,$icon,$ratio,$imagescale,$scale,$x,$y)
{
$handscale = $scale/$imagescale*$ratio;
//$handscale=1;
$icon = getcwd() . "/pictures/$icon";
$icon = ImageCreateFromPNG($icon);
$width = ImageSX($icon);
$height = ImageSY($icon);
ImageCopyResampled($image, $icon, $x*$scale, $y*$scale, 0, 0,
$width*$handscale, $height*$handscale, $width, $height);
}
// to set a color transparent
//
function transparent($image,$scale,$x,$y)
{
$x = $x * $scale;
$y = $y * $scale;
$black = ImageColorAt($image, $x, $y);
ImageColorTransparent($image,$black);
}
?>