Exemplo 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()
                                          ));
     }
 }
Exemplo 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);
            }
Exemplo n.º 3
0
 public virtual void setTransform(com.codename1.ui.Transform transform)
 {
     this.transform.setTransform(transform);
     if (!transform.isIdentity())
     {
         graphics.Transform = SilverlightImplementation.clamp(((SilverlightImplementation.NativeTransform)transform.getNativeTransform()).m);
     }
     else
     {
         graphics.Transform = Matrix3x2.Identity;
     }
 }
Exemplo n.º 4
0
 public com.codename1.ui.geom.Shape getClipProjection()
 {
     com.codename1.ui.Transform  t = destination.getTransform();
     com.codename1.ui.geom.Shape s = actualClip;
     if (clipTransform != null && !clipTransform.isIdentity())
     {
         com.codename1.ui.geom.GeneralPath gp = new com.codename1.ui.geom.GeneralPath();
         gp.setShape(s, clipTransform.getInverse());
         s = gp;
     }
     if (t != null && !t.isIdentity())
     {
         com.codename1.ui.geom.GeneralPath gp = new com.codename1.ui.geom.GeneralPath();
         gp.setShape(s, t);
         s = gp;
     }
     return(s);
 }