Location: PHPKode > projects > PHP Cad and Drawing Program > phpcad/functions/window.inc
AAAAAAAAAAAAAAAAAAAAAAAAA
//    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);
    }
}
BBBBBBBBBBBBBBBBBBBBBBBBBBBB
if ($PObj=="window") {
    $a=fopen("./files/$pfilez", "a");
    if ($PDir == "D") $PDir = "D";
    if ($PDir == "R") $PDir = "R";
    $xp= "<?php " . $PObj . "($" . "image,";
    $xp .=  $PLen . ',"' . $PDir . '",';
    $xp .= '$scale,';
    $xp .=  $xx . "," . $yy . "); ?>\n";
    fwrite($a, $xp);
    fclose($a);
}
CCCCCCCCCCCCCCCCCCCCCCCC
function window ($image,$length,$direction,$scale,$x,$y)
{
global $floor;
global $twall;
global $tfoundation;
global $zz;
if ($direction == "R") {
    $a = "box{<";
    $a .= $x . "," . ($floor) . ",";
    $a .= $y  . "><";
    $a .= $x+$length;
    $a .= "," . (1+$floor) . ",";
    $a .= $y+1;
    $a .= "> $tfoundation }\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (1+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+$length;
    $a .= "," . (4+$floor) . ",";
    $a .= $y+1;
    $a .= "> $twall}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (8+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+$length;
    $a .= "," . (9+$floor) . ",";
    $a .= $y+1;
    $a .= "> $twall}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (4+$floor) . ",";
    $a .= $y+.8  . "><";
    $a .= $x+$length;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+.9;
    $a .= "> texture {T_Glass2}}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (4+$floor) . ",";
    $a .= $y+.1  . "><";
    $a .= $x+$length;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+.2;
    $a .= "> texture {T_Glass2}}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (4+$floor) . ",";
    $a .= $y+.1  . "><";
    $a .= $x+.15;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+.9;
    $a .= "> texture {Aluminum}}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x+$length-.15 . "," . (4+$floor) . ",";
    $a .= $y+.1  . "><";
    $a .= $x+$length;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+.9;
    $a .= "> texture {Aluminum}}\n\n";
    fwrite($zz,$a);
} else {
    $a = "box{<";
    $a .= $x . "," . ($floor) . ",";
    $a .= $y  . "><";
    $a .= $x+1;
    $a .= "," . (1+$floor) . ",";
    $a .= $y+$length;
    $a .= "> $tfoundation}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (1+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+1;
    $a .= "," . (4+$floor) . ",";
    $a .= $y+$length;
    $a .= "> $twall}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (8+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+1;
    $a .= "," . (9+$floor) . ",";
    $a .= $y+$length;
    $a .= "> $twall}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x+.1 . "," . (4+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+.2;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+$length;
    $a .= "> texture {T_Glass2}}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x+.8 . "," . (4+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+.9;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+$length;
    $a .= "> texture {T_Glass2}}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x+.1 . "," . (4+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+.9;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+.15;
    $a .= "> texture {Aluminum}}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x+.1 . "," . (4+$floor) . ",";
    $a .= $y+$length-.15  . "><";
    $a .= $x+.9;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+$length;
    $a .= "> texture {Aluminum}}\n\n";
    fwrite($zz,$a);
}
}
DDDDDDDDDDDDDDDDDDDDDDDD
$inthemenu = "yes";
$dirlist= array("D","R");
$lenlist= array("1","2","3","4","5","6");
$txtitem="";

EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Return current item: PHP Cad and Drawing Program