Ejemplo n.º 1
0
 internal virtual void setClip(ui.geom.Rectangle clip)
 {
     removeClip();
     if (clip == null)
     {
         return;
     }
     if (clip.getWidth() <= 0)
     {
         // System.Diagnostics.Debug.WriteLine("aaaaaaaaaaaaaaaaaaaa width");
         clip.setWidth(1);
     }
     if (clip.getHeight() <= 0)
     {
         // System.Diagnostics.Debug.WriteLine("aaaaaaaaaaaaaaaaaaaa height");
         clip.setHeight(1);
     }
     if (transform != null && !transform.isIdentity())
     {
         GeneralPath gp = new GeneralPath();
         gp.setShape(clip, transform);
         layer = graphics.CreateLayer(1f, CanvasGeometry.CreatePath(SilverlightImplementation.instance.cn1ShapeToAndroidPath(gp)));
     }
     else
     {
         layer = graphics.CreateLayer(1f, new Rect(
                                          clip.getX(),
                                          clip.getY(),
                                          clip.getWidth(),
                                          clip.getHeight()
                                          ));
     }
 }
Ejemplo n.º 2
0
            private Shape getProjectedClip()
            {
                if (projectedClip == null)
                {
                    if (clip == null)
                    {
                        return(null);
                    }
                    Shape s = new Rectangle(clip.getX(), clip.getY(), clip.getWidth(), clip.getHeight());
                    if (clipTransform != null && !clipTransform.isIdentity())
                    {
                        GeneralPath p = new GeneralPath();
                        p.setShape(s, clipTransform.getInverse());
                        s = p;
                    }
                    if (transform != null && !transform.isIdentity())
                    {
                        GeneralPath p = new GeneralPath();
                        p.setShape(s, transform);
                        s = p;
                    }
                    projectedClip = s;
                }


                return(projectedClip);
            }