public function drawFromPicture($PicType, $FileName, $X, $Y)
    {
        if (file_exists($FileName)) {
            list($Width, $Height) = $this->getPicInfo($FileName);

            if ($PicType == 1) {
                $Raster = imagecreatefrompng($FileName);
            } elseif ($PicType == 2) {
                $Raster = imagecreatefromgif($FileName);
            } elseif ($PicType == 3) {
                $Raster = imagecreatefromjpeg($FileName);
            } else {
                return 0;
            }

            $RestoreShadow = $this->Shadow;
            if ($this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0) {
                $this->Shadow = false;
                if ($PicType == 3) {
                    $this->drawFilledRectangle(
                        $X + $this->ShadowX,
                        $Y + $this->ShadowY,
                        $X + $Width + $this->ShadowX,
                        $Y + $Height + $this->ShadowY,
                        [
                            "R" => $this->ShadowR,
                            "G" => $this->ShadowG,
                            "B" => $this->ShadowB,
                            "Alpha" => $this->Shadowa
                        ]
                    );
                } else {
                    $TranparentID = imagecolortransparent($Raster);
                    for ($Xc = 0; $Xc <= $Width - 1; $Xc++) {
                        for ($Yc = 0; $Yc <= $Height - 1; $Yc++) {
                            $RGBa = imagecolorat($Raster, $Xc, $Yc);
                            $Values = imagecolorsforindex($Raster, $RGBa);
                            if ($Values["alpha"] < 120) {
                                $AlphaFactor = floor(
                                    ($this->Shadowa / 100) * ((100 / 127) * (127 - $Values["alpha"]))
                                );
                                $this->drawAlphaPixel(
                                    $X + $Xc + $this->ShadowX,
                                    $Y + $Yc + $this->ShadowY,
                                    $AlphaFactor,
                                    $this->ShadowR,
                                    $this->ShadowG,
                                    $this->ShadowB
                                );
                            }
                        }
                    }
                }
            }
            $this->Shadow = $RestoreShadow;

            imagecopy($this->Picture, $Raster, $X, $Y, 0, 0, $Width, $Height);
            imagedestroy($Raster);
        }
    }