CSJ2K.j2k.image.Tiler.Tiler C# (CSharp) Метод

Tiler() публичный Метод

Constructs a new tiler with the specified 'BlkImgDataSrc' source, image origin, tiling origin and nominal tile size.
If src is tiled or "canvased", or /// if the arguments do not satisfy the specified constraints. /// ///
public Tiler ( BlkImgDataSrc src, int ax, int ay, int px, int py, int nw, int nh ) : System
src BlkImgDataSrc The 'BlkImgDataSrc' source from where to get the image /// data. It must not be tiled and the image origin must be at '(0,0)' on /// its canvas. /// ///
ax int The horizontal coordinate of the image origin in the canvas /// system, on the reference grid (i.e. the image's top-left corner in the /// reference grid). /// ///
ay int The vertical coordinate of the image origin in the canvas /// system, on the reference grid (i.e. the image's top-left corner in the /// reference grid). /// ///
px int The horizontal tiling origin, in the canvas system, on the /// reference grid. It must satisfy 'px<=ax'. /// ///
py int The vertical tiling origin, in the canvas system, on the /// reference grid. It must satisfy 'py<=ay'. /// ///
nw int The nominal tile width, on the reference grid. If 0 then /// there is no tiling in that direction. /// ///
nh int The nominal tile height, on the reference grid. If 0 then /// there is no tiling in that direction. /// ///
Результат System
        public Tiler(BlkImgDataSrc src, int ax, int ay, int px, int py, int nw, int nh)
            : base(src)
        {
            // Initialize
            this.src = src;
            this.x0siz = ax;
            this.y0siz = ay;
            this.xt0siz = px;
            this.yt0siz = py;
            this.xtsiz = nw;
            this.ytsiz = nh;

            // Verify that input is not tiled
            if (src.getNumTiles() != 1)
            {
                throw new System.ArgumentException("Source is tiled");
            }
            // Verify that source is not "canvased"
            if (src.ImgULX != 0 || src.ImgULY != 0)
            {
                throw new System.ArgumentException("Source is \"canvased\"");
            }
            // Verify that arguments satisfy trivial requirements
            if (x0siz < 0 || y0siz < 0 || xt0siz < 0 || yt0siz < 0 || xtsiz < 0 || ytsiz < 0 || xt0siz > x0siz
                || yt0siz > y0siz)
            {
                throw new System.ArgumentException("Invalid image origin, " + "tiling origin or nominal " + "tile size");
            }

            // If no tiling has been specified, creates a unique tile with maximum
            // dimension.
            if (xtsiz == 0) xtsiz = x0siz + src.ImgWidth - xt0siz;
            if (ytsiz == 0) ytsiz = y0siz + src.ImgHeight - yt0siz;

            // Automatically adjusts xt0siz,yt0siz so that tile (0,0) always
            // overlaps with the image.
            if (x0siz - xt0siz >= xtsiz)
            {
                xt0siz += ((x0siz - xt0siz) / xtsiz) * xtsiz;
            }
            if (y0siz - yt0siz >= ytsiz)
            {
                yt0siz += ((y0siz - yt0siz) / ytsiz) * ytsiz;
            }
            if (x0siz - xt0siz >= xtsiz || y0siz - yt0siz >= ytsiz)
            {
                FacilityManager.getMsgLogger()
                    .printmsg(
                        CSJ2K.j2k.util.MsgLogger_Fields.INFO,
                        "Automatically adjusted tiling " + "origin to equivalent one (" + xt0siz + "," + yt0siz
                        + ") so that " + "first tile overlaps the image");
            }

            // Calculate the number of tiles
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            ntX = (int)System.Math.Ceiling((x0siz + src.ImgWidth) / (double)xtsiz);
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            ntY = (int)System.Math.Ceiling((y0siz + src.ImgHeight) / (double)ytsiz);
        }