Пример #1
0
        /// <summary>
        /// Return a Raster containing the colors generated for the graphics
        /// operation. </summary>
        /// <param name="x">,y,w,h The area in device space for which colors are
        /// generated. </param>
        public virtual Raster GetRaster(int x, int y, int w, int h)
        {
            double rowrel = (x - X1) * Dx + (y - Y1) * Dy;

            Raster rast = Saved;

            if (rast == null || rast.Width < w || rast.Height < h)
            {
                rast  = GetCachedRaster(Model, w, h);
                Saved = rast;
            }
            IntegerComponentRaster irast = (IntegerComponentRaster)rast;
            int off    = irast.getDataOffset(0);
            int adjust = irast.ScanlineStride - w;

            int[] pixels = irast.DataStorage;

            if (Cyclic)
            {
                CycleFillRaster(pixels, off, adjust, w, h, rowrel, Dx, Dy);
            }
            else
            {
                ClipFillRaster(pixels, off, adjust, w, h, rowrel, Dx, Dy);
            }

            irast.markDirty();

            return(rast);
        }
Пример #2
0
        public virtual Raster GetRaster(int x, int y, int w, int h)
        {
            lock (this)
            {
                WritableRaster t = SavedTile;

                if (t == null || w > t.Width || h > t.Height)
                {
                    t = ColorModel.CreateCompatibleWritableRaster(w, h);
                    IntegerComponentRaster icr = (IntegerComponentRaster)t;
                    Arrays.Fill(icr.DataStorage, Color);
                    // Note - markDirty is probably unnecessary since icr is brand new
                    icr.markDirty();
                    if (w <= 64 && h <= 64)
                    {
                        SavedTile = t;
                    }
                }

                return(t);
            }
        }