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(); }
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; }
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); }
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); }
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(); }
public RadImageSegment(ImageSegments segment) { this.segment = segment; }