@@ -142,7 +142,6 @@ public int GrayscaleHash
142142 set { grayscaleHash = value ; }
143143 }
144144
145-
146145 /// <summary>
147146 /// Gets or sets the color of the image that will be treated as transparent.
148147 /// </summary>
@@ -180,8 +179,6 @@ public float Transparency
180179 }
181180 }
182181
183-
184-
185182 /// <summary>
186183 /// Gets or sets a value indicating that the image should be tiled.
187184 /// </summary>
@@ -193,8 +190,6 @@ public bool Tile
193190 set { tile = value ; }
194191 }
195192
196-
197-
198193 /// <summary>
199194 /// Gets or sets a value indicating that the image stored in the <see cref="Image"/>
200195 /// property should be disposed when this object is disposed.
@@ -211,15 +206,6 @@ public bool ShouldDisposeImage
211206 set { shouldDisposeImage = value ; }
212207 }
213208
214-
215-
216-
217-
218-
219-
220-
221-
222-
223209 /// <summary>
224210 /// Gets or sets a bitmap transparent image
225211 /// </summary>
@@ -314,6 +300,38 @@ private void UpdateTransparentImage()
314300 }
315301 }
316302 }
303+
304+ #if MONO
305+ private GraphicsPath GetRoundRectPath ( RectangleF rectangleF , float radius )
306+ {
307+ GraphicsPath gp = new GraphicsPath ( ) ;
308+ if ( radius < 1 )
309+ radius = 1 ;
310+ gp . AddLine ( rectangleF . X + radius , rectangleF . Y , rectangleF . Width + rectangleF . X - radius , rectangleF . Y ) ;
311+ gp . AddArc ( rectangleF . Width + rectangleF . X - radius - 1 , rectangleF . Y , radius + 1 , radius + 1 , 270 , 90 ) ;
312+ gp . AddLine ( rectangleF . Width + rectangleF . X , rectangleF . Y + radius , rectangleF . Width + rectangleF . X , rectangleF . Height + rectangleF . Y - radius ) ;
313+ gp . AddArc ( rectangleF . Width + rectangleF . X - radius - 1 , rectangleF . Height + rectangleF . Y - radius - 1 , radius + 1 , radius + 1 , 0 , 90 ) ;
314+ gp . AddLine ( rectangleF . Width + rectangleF . X - radius , rectangleF . Height + rectangleF . Y , rectangleF . X + radius , rectangleF . Height + rectangleF . Y ) ;
315+ gp . AddArc ( rectangleF . X , rectangleF . Height + rectangleF . Y - radius - 1 , radius + 1 , radius + 1 , 90 , 90 ) ;
316+ gp . AddLine ( rectangleF . X , rectangleF . Height + rectangleF . Y - radius , rectangleF . X , rectangleF . Y + radius ) ;
317+ gp . AddArc ( rectangleF . X , rectangleF . Y , radius , radius , 180 , 90 ) ;
318+ gp . CloseFigure ( ) ;
319+ return gp ;
320+ }
321+ #else
322+ private GraphicsPath GetRoundRectPath ( RectangleF rectangleF , float radius )
323+ {
324+ GraphicsPath gp = new GraphicsPath ( ) ;
325+ if ( radius < 1 )
326+ radius = 1 ;
327+ gp . AddArc ( rectangleF . Width + rectangleF . X - radius - 1 , rectangleF . Y , radius + 1 , radius + 1 , 270 , 90 ) ;
328+ gp . AddArc ( rectangleF . Width + rectangleF . X - radius - 1 , rectangleF . Height + rectangleF . Y - radius - 1 , radius + 1 , radius + 1 , 0 , 90 ) ;
329+ gp . AddArc ( rectangleF . X , rectangleF . Height + rectangleF . Y - radius - 1 , radius + 1 , radius + 1 , 90 , 90 ) ;
330+ gp . AddArc ( rectangleF . X , rectangleF . Y , radius , radius , 180 , 90 ) ;
331+ gp . CloseFigure ( ) ;
332+ return gp ;
333+ }
334+ #endif
317335 #endregion
318336
319337 #region Protected Methods
@@ -373,12 +391,16 @@ public override void DrawImage(FRPaintEventArgs e)
373391 drawWidth ,
374392 drawHeight ) ;
375393
394+ GraphicsPath path = new GraphicsPath ( ) ;
376395 IGraphicsState state = g . Save ( ) ;
377396 try
378397 {
379398 //if (Config.IsRunningOnMono) // strange behavior of mono - we need to reset clip before we set new one
380- g . ResetClip ( ) ;
381- g . SetClip ( drawRect ) ;
399+ g . ResetClip ( ) ;
400+
401+ EstablishImageForm ( path , drawLeft , drawTop , drawWidth , drawHeight ) ;
402+
403+ g . SetClip ( path , CombineMode . Replace ) ;
382404 Report report = Report ;
383405 if ( report != null && report . SmoothGraphics )
384406 {
@@ -411,6 +433,8 @@ public override void DrawImage(FRPaintEventArgs e)
411433 finally
412434 {
413435 g . Restore ( state ) ;
436+ g . ResetClip ( ) ;
437+ path . Dispose ( ) ;
414438 }
415439
416440 if ( IsPrinting )
@@ -552,17 +576,6 @@ public override void Deserialize(FRReader reader)
552576 }
553577 }
554578
555-
556-
557-
558-
559-
560- //static int number = 0;
561-
562-
563-
564-
565-
566579 /// <summary>
567580 /// Loads image
568581 /// </summary>
@@ -602,9 +615,56 @@ protected override void ResetImageIndex()
602615 {
603616 imageIndex = - 1 ;
604617 }
618+
619+ /// <summary>
620+ /// The shape of the image is set using GraphicsPath
621+ /// </summary>
622+ /// <param name="path"></param>
623+ /// <param name="drawLeft"></param>
624+ /// <param name="drawTop"></param>
625+ /// <param name="drawWidth"></param>
626+ /// <param name="drawHeight"></param>
627+ public void EstablishImageForm ( GraphicsPath path , float drawLeft , float drawTop , float drawWidth , float drawHeight )
628+ {
629+ RectangleF drawRect = new RectangleF (
630+ drawLeft ,
631+ drawTop ,
632+ drawWidth ,
633+ drawHeight ) ;
634+
635+ switch ( Shape )
636+ {
637+ case ShapeKind . Rectangle :
638+ path . AddRectangle ( drawRect ) ;
639+ break ;
640+ case ShapeKind . RoundRectangle :
641+ float min = Math . Min ( drawWidth , drawHeight ) / 4 ;
642+ path . AddPath ( GetRoundRectPath ( drawRect , min ) , false ) ;
643+ break ;
644+ case ShapeKind . Ellipse :
645+ path . AddEllipse ( drawLeft , drawTop , drawWidth , drawHeight ) ;
646+ break ;
647+ case ShapeKind . Triangle :
648+ PointF [ ] triPoints =
649+ {
650+ new PointF ( drawLeft + drawWidth , drawTop + drawHeight ) , new PointF ( drawLeft , drawTop + drawHeight ) ,
651+ new PointF ( drawLeft + drawWidth / 2 , drawTop ) , new PointF ( drawLeft + drawWidth , drawTop + drawHeight )
652+ } ;
653+ path . AddPolygon ( triPoints ) ;
654+ break ;
655+ case ShapeKind . Diamond :
656+ PointF [ ] diaPoints =
657+ {
658+ new PointF ( drawLeft + drawWidth / 2 , drawTop ) , new PointF ( drawLeft + drawWidth , drawTop + drawHeight / 2 ) ,
659+ new PointF ( drawLeft + drawWidth / 2 , drawTop + drawHeight ) , new PointF ( drawLeft , drawTop + drawHeight / 2 )
660+ } ;
661+ path . AddPolygon ( diaPoints ) ;
662+ break ;
663+ }
664+ }
605665#endregion
606666
607- #region Report Engine
667+ #region Report Engine
608668
609669
610670 /// <inheritdoc/>
0 commit comments