Examples of IRectangle


Examples of net.sf.latexdraw.glib.models.interfaces.shape.IRectangle

  }


  @Test
  public void testGetGradColEnd() {
    IRectangle rec1 = ShapeFactory.createRectangle();
    IRectangle rec2 = ShapeFactory.createRectangle();

    // The test is useful only if the shape is stylable.
    assertTrue(rec1.isInteriorStylable());

    shape.addShape(rec1);
    shape.addShape(rec2);

    rec1.setGradColEnd(Color.ORANGE);
    rec2.setGradColEnd(Color.PINK);

    assertNotNull(shape.getGradColEnd());
    assertNotEquals(Color.PINK, shape.getGradColEnd());
    assertNotEquals(Color.ORANGE, shape.getGradColEnd());

    rec1.setFillingStyle(FillingStyle.GRAD);
    rec2.setFillingStyle(FillingStyle.GRAD);

    assertEquals(Color.ORANGE, shape.getGradColEnd());
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IRectangle

  }


  @Test
  public void test2CoordinatesFloat2() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(.5,.5)(35.5,50.5)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(.5*IShape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(.5*-IShape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(35.*IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(50.*IShape.PPC, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IRectangle

  }


  @Test
  public void test2CoordinatesFloat() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(10.5,20.5)(35.5,50.5)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(10.5*IShape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(20.5*-IShape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(25.*IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(30.*IShape.PPC, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IRectangle

  }


  @Test
  public void test2CoordinatesTwoFirstMissing() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(,)(35,50)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(IShape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(-IShape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(34.*IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(49.*IShape.PPC, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IRectangle

  }


  @Test
  public void test2CoordinatesTwoLastMissing() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(0,0)(,)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0., rec.getPosition().getX(), 0.001);
    assertEquals(0., rec.getPosition().getY(), 0.001);
    assertEquals(IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(IShape.PPC, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

Examples of pythagoras.f.IRectangle

            _viewHeight = height;
            maybeScrollToBottom();
        }

        @Override public void setPosition (float x, float y) {
            IRectangle bounds = bounds(new Rectangle());
            if (_viewHeight > bounds.height()) {
                // nail the group to the bottom of the scroll area.
                layer.setTranslation(x, _viewHeight - bounds.height());
                _atBottom = true;
            } else {
                layer.setTranslation(x, (float)Math.floor(y));
                _atBottom = -y == bounds.height() - _viewHeight;
            }
            schedule();
        }
View Full Code Here

Examples of pythagoras.f.IRectangle

        @Override public void render (Canvas canvas, TextLayout text, int textColor,
            boolean underlined, float x, float y) {
            canvas.save();
            if (underlined) {
                IRectangle bounds = text.bounds();
                float sx = x + bounds.x() + 1, sy = y + bounds.y() + bounds.height() + 2;
                canvas.setFillColor(outlineColor).fillRect(sx-1, sy-1, bounds.width()+3, 3);
                canvas.setFillColor(textColor).fillRect(sx, sy, bounds.width(), 1);
            }
            canvas.setFillColor(outlineColor);
            canvas.fillText(text, x+0, y+0);
            canvas.fillText(text, x+0, y+1);
            canvas.fillText(text, x+0, y+2);
View Full Code Here

Examples of pythagoras.f.IRectangle

            canvas.setLineJoin(outlineJoin);
            canvas.strokeText(text, x+outlineWidth, y+outlineWidth);
            canvas.setFillColor(textColor);
            canvas.fillText(text, x+outlineWidth, y+outlineWidth);
            if (underlined) {
                IRectangle bounds = text.bounds();
                float sx = x + bounds.x() + outlineWidth;
                float sy = y + bounds.y() + bounds.height() + outlineWidth + 1;
                canvas.fillRect(sx, sy, bounds.width(), 1);
            }
            canvas.restore();
        }
View Full Code Here

Examples of pythagoras.f.IRectangle

            boolean underlined, float x, float y) {
            float tx = (shadowX < 0) ? -shadowX : 0, ty = (shadowY < 0) ? -shadowY : 0;
            float sx = (shadowX < 0) ? 0 : shadowX, sy = (shadowY < 0) ? 0 : shadowY;
            canvas.save();
            if (underlined) {
                IRectangle bounds = text.bounds();
                canvas.setFillColor(shadowColor).fillRect(
                    sx+bounds.x()+x, sy+bounds.y()+bounds.height()+1, bounds.width()+1, 1);
                canvas.setFillColor(textColor).fillRect(
                    tx+bounds.x()+x, ty+bounds.y()+bounds.height()+1, bounds.width()+1, 1);
            }
            canvas.setFillColor(shadowColor);
            canvas.fillText(text, x+sx, y+sy);
            canvas.setFillColor(textColor);
            canvas.fillText(text, x+tx, y+ty);
View Full Code Here

Examples of pythagoras.f.IRectangle

            canvas.setFillGradient(
                PlayN.graphics().createLinearGradient(0, 0, 0, text.height(), colors, positions));
            canvas.fillText(text, x, y);

            if (underlined) {
                IRectangle bounds = text.bounds();
                float sx = x + bounds.x(), sy = y + bounds.y() + bounds.height() + 1;
                canvas.fillRect(sx, sy, bounds.width(), 1);
            }

            canvas.restore();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.