Пример #1
0
        private void PaintStretchXYTileInner(Graphics g, Rectangle paintRect)
        {
            ImageSegments visibleSegments = this.visibleSegments;

            this.visibleSegments &= ~ImageSegments.Inner;
            this.PaintSegmented(g, paintRect);
            this.visibleSegments = visibleSegments;
            if ((this.visibleSegments & ImageSegments.Inner) == (ImageSegments)0)
            {
                return;
            }
            RadImageSegment segment = this.GetSegment(ImageSegments.Inner);

            if (segment.ImagePart == null)
            {
                return;
            }
            Padding   paintMargins    = this.GetPaintMargins(paintRect);
            Rectangle destinationRect = segment.GetDestinationRect(paintRect, paintMargins);

            if (destinationRect.Width <= 0 || destinationRect.Height <= 0)
            {
                return;
            }
            if (segment.RenderMargins != paintMargins)
            {
                segment.UpdateSourceRect(this.cachedImage.Size, paintMargins);
            }
            TextureBrush textureBrush = new TextureBrush(segment.ImagePart, WrapMode.Tile);

            textureBrush.TranslateTransform((float)destinationRect.X, (float)destinationRect.Y, MatrixOrder.Prepend);
            g.FillRectangle((Brush)textureBrush, destinationRect);
            textureBrush.Dispose();
        }
Пример #2
0
 public RadImageShape()
 {
     this.interpolationMode = InterpolationMode.NearestNeighbor;
     this.paintMode         = ImagePaintMode.Stretch;
     this.rotateFlip        = RotateFlipType.RotateNoneFlipNone;
     this.useSegments       = true;
     this.visibleSegments   = ImageSegments.All;
     this.alpha             = 1f;
     this.imageDirty        = true;
     this.segmentsDirty     = true;
 }
Пример #3
0
 public RadImageSegment GetSegment(ImageSegments segment)
 {
     if (this.segments != null)
     {
         int length = this.segments.Length;
         for (int index = 0; index < length; ++index)
         {
             if (this.segments[index].Segment == segment)
             {
                 return(this.segments[index]);
             }
         }
     }
     return((RadImageSegment)null);
 }
Пример #4
0
        public RadImageSegment GetSegment(ImageSegments segment)
        {
            if (this.segments != null)
            {
                int length = this.segments.Length;
                for (int i = 0; i < length; i++)
                {
                    if (this.segments[i].Segment == segment)
                    {
                        return(this.segments[i]);
                    }
                }
            }

            return(null);
        }
Пример #5
0
        private void PaintStretchXYTileInner(Graphics g, Rectangle paintRect)
        {
            //exclude inner segment from painting to stretch only the borders
            ImageSegments visible = this.visibleSegments;

            this.visibleSegments &= ~ImageSegments.Inner;

            this.PaintSegmented(g, paintRect);

            //restore original segments
            this.visibleSegments = visible;

            if ((this.visibleSegments & ImageSegments.Inner) == 0)
            {
                return;
            }

            RadImageSegment segment = this.GetSegment(ImageSegments.Inner);

            if (segment.ImagePart == null)
            {
                return;
            }

            Padding paintMargins = this.GetPaintMargins(paintRect);

            Rectangle destinationRect = segment.GetDestinationRect(paintRect, paintMargins);

            if (destinationRect.Width <= 0 || destinationRect.Height <= 0)
            {
                return;
            }

            if (segment.RenderMargins != paintMargins)
            {
                segment.UpdateSourceRect(this.cachedImage.Size, paintMargins);
            }

            //tile inner segment
            TextureBrush brush = new TextureBrush(segment.ImagePart, WrapMode.Tile);

            brush.TranslateTransform(destinationRect.X, destinationRect.Y, MatrixOrder.Prepend);
            g.FillRectangle(brush, destinationRect);
            brush.Dispose();
        }
Пример #6
0
 public RadImageSegment(ImageSegments segment)
 {
     this.segment = segment;
 }