Exemple #1
0
 protected virtual awt.PaintContext createContextInternal(image.ColorModel cm,
                                                          awt.Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform,
                                                          awt.RenderingHints hints)
 {
     Matrix.Multiply(xform, _brushTransform.NativeObject, MatrixOrder.Append);
     return(NativeObject.createContext(cm, deviceBounds, userBounds, xform, hints));
 }
Exemple #2
0
        /**
         * Computes a View's vertical field-of-view given a View's horizontal field-of-view and the viewport window
         * dimensions.
         *
         * @param horizontalFieldOfView the angle between the view frustum's left and right clipping planes.
         * @param viewport              the viewport dimensions, in window coordinates (screen pixels).
         *
         * @return the angle between the view frustum's bottom and top clipping planes.
         *
         * @throws ArgumentException if the horitontal-field-of-view is null, or if the viewport rectangle is null.
         */
        public static Angle computeVerticalFieldOfView(Angle horizontalFieldOfView, java.awt.Rectangle viewport)
        {
            if (horizontalFieldOfView == null)
            {
                String message = Logging.getMessage("nullValue.FOVIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (viewport == null)
            {
                String message = Logging.getMessage("nullValue.ViewportIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            // Taken form "Mathematics for 3D Game Programming and Computer Graphics", page 114.

            double aspectRatio                = viewport.getHeight() / viewport.getWidth();
            double distanceToNearPlane        = 1d / horizontalFieldOfView.tanHalfAngle();
            double verticalFieldOfViewRadians = 2d * Math.Atan(aspectRatio / distanceToNearPlane);

            return(Angle.fromRadians(verticalFieldOfViewRadians));
        }
Exemple #3
0
 awt.PaintContext awt.Paint.createContext(image.ColorModel cm,
                                          awt.Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform,
                                          awt.RenderingHints hints)
 {
     return(createContextInternal(cm, deviceBounds, userBounds, xform, hints));
 }
		public LinearGradientBrush (Rectangle rect, Color color1, Color color2, float angle, bool isAngleScaleable):
			this(rect, color1, color2, angle) {
		}
		/// <summary>
		/// Convenience method that calculates the union of two rectangles
		/// without allocating a new rectangle.
		/// </summary>
		public Rectangle computeUnion(int @x, int @y, int @width, int @height, Rectangle @dest)
		{
			return default(Rectangle);
		}
		/// <summary>
		/// Compute and return the location of the icons origin, the
		/// location of origin of the text baseline, and a possibly clipped
		/// version of the compound labels string.
		/// </summary>
		public string layoutCompoundLabel(JComponent @c, FontMetrics @fm, string @text, Icon @icon, int @verticalAlignment, int @horizontalAlignment, int @verticalTextPosition, int @horizontalTextPosition, Rectangle @viewR, Rectangle @iconR, Rectangle @textR, int @textIconGap)
		{
			return default(string);
		}
		/// <summary>
		/// Convenience returning an array of rect representing the regions within
		/// <code>rectA</code> that do not overlap with <code>rectB</code>.
		/// </summary>
		public Rectangle[] computeDifference(Rectangle @rectA, Rectangle @rectB)
		{
			return default(Rectangle[]);
		}
		/// <summary>
		/// Convert the rectangle <code>aRectangle</code> in <code>source</code> coordinate system to
		/// <code>destination</code> coordinate system.
		/// </summary>
		public Rectangle convertRectangle(Component @source, Rectangle @aRectangle, Component @destination)
		{
			return default(Rectangle);
		}
		/// <summary>
		/// Computes the parameters for a blit where the backing store image
		/// currently contains <code>oldLoc</code> in the upper left hand corner
		/// and we're scrolling to <code>newLoc</code>.
		/// </summary>
		protected bool computeBlit(int @dx, int @dy, Point @blitFrom, Point @blitTo, Dimension @blitSize, Rectangle @blitPaint)
		{
			return default(bool);
		}
		/// <summary>
		/// Computes and returns an arbitrary region of the
		/// <code>BufferedImage</code>.
		/// </summary>
		public Raster getData(Rectangle @rect)
		{
			return default(Raster);
		}
		/// <summary>
		/// Constructs a Raster with the given SampleModel, DataBuffer, and
		/// parent.
		/// </summary>
		public Raster(SampleModel @sampleModel, DataBuffer @dataBuffer, Rectangle @aRegion, Point @sampleModelTranslate, Raster @parent)
		{
		}
		/// <summary>
		/// Create a compatible WritableRaster with location (minX, minY)
		/// and size (width, height) specified by rect, a
		/// new SampleModel, and a new initialized DataBuffer.
		/// </summary>
		public WritableRaster createCompatibleWritableRaster(Rectangle @rect)
		{
			return default(WritableRaster);
		}
Exemple #13
0
        /**
         * Transforms a point in screen coordinates to a point in model coordinates. The input x and y are relative to the
         * screen's lower left hand screen corner, while the z-value denotes the point's depth in screen coordinates (in the
         * range [0, 1]). This returns null if the specified combination of modelview matrix, projection matrix, and
         * viewport cannot produce a transformation.
         *
         * @param windowPoint the point in screen coordinates to transform into model coordinates.
         * @param modelview   the modelview matrix.
         * @param projection  the projection matrix.
         * @param viewport    the viewport rectangle.
         *
         * @return the point in model coordinates, or null if the point cannot be transformed.
         *
         * @throws ArgumentException if any of the model point, modelview matrix, projection matrix, or viewport
         *                                  rectangle are null.
         */
        public static Vec4 unProject(Vec4 windowPoint, Matrix modelview, Matrix projection, java.awt.Rectangle viewport)
        {
            if (windowPoint == null)
            {
                String message = Logging.getMessage("nullValue.PointIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (modelview == null)
            {
                String message = Logging.getMessage("nullValue.ModelViewIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (projection == null)
            {
                String message = Logging.getMessage("nullValue.ProjectionIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (viewport == null)
            {
                String message = Logging.getMessage("nullValue.ViewportIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            GLU glu = new GLUgl2();

            // GLU expects matrices as column-major arrays.
            double[] modelviewArray  = modelview.toArray(new double[16], 0, false);
            double[] projectionArray = projection.toArray(new double[16], 0, false);
            // GLU expects the viewport as a four-component array.
            int[] viewportArray = new int[] { viewport.x, viewport.y, viewport.width, viewport.height };

            double[] result = new double[3];

            if (!glu.gluUnProject(
                    windowPoint.x, windowPoint.y, windowPoint.z,
                    modelviewArray, 0,
                    projectionArray, 0,
                    viewportArray, 0,
                    result, 0))
            {
                return(null);
            }

            return(Vec4.fromArray3(result, 0));
        }
		private Graphics (Image image) {
			_nativeObject = (awt.Graphics2D)image.NativeObject.CurrentImage.NativeImage.getGraphics();
			_image = image;
			_transform = new Matrix ();

			NativeObject.setStroke(new DummyStroke());
			NativeObject.setRenderingHint(awt.RenderingHints.KEY_COLOR_RENDERING, awt.RenderingHints.VALUE_COLOR_RENDER_QUALITY);

			InterpolationMode = InterpolationMode.Bilinear;
			TextRenderingHint = TextRenderingHint.SystemDefault;

			_windowRect = new awt.Rectangle(_image.Width, _image.Height);
			_clip = new Region();
		}
    private Point findSpace([In] DisplayElement obj0)
    {
      Stack stack = new Stack();
      ((Vector) stack).add((object) new Point(0, 0));
      Dimension size1 = ((Component) obj0).getSize();
      Dimension size2 = ((Component) this).getSize();
label_1:
      while (!((Vector) stack).isEmpty())
      {
        Point point1 = (Point) stack.pop();
        Rectangle rectangle = new Rectangle(point1, size1);
        if (rectangle.x >= 0 && rectangle.y >= 0 && (rectangle.x + rectangle.width <= size2.width && rectangle.y + rectangle.height <= size2.height))
        {
          Iterator iterator = ((AbstractSequentialList) this.elements).iterator();
          while (iterator.hasNext())
          {
            DisplayElement displayElement = (DisplayElement) iterator.next();
            if (displayElement != obj0 && displayElement.isObstruction())
            {
              Rectangle bounds = ((Component) displayElement).getBounds();
              if (bounds.x <= rectangle.x + rectangle.width && bounds.x + bounds.width >= rectangle.x && (bounds.y <= rectangle.y + rectangle.height && bounds.y + bounds.height >= rectangle.y))
              {
                Point point2 = new Point(bounds.x + bounds.width + 1, (int) point1.y);
                if (((Vector) stack).isEmpty())
                {
                  ((Vector) stack).add((object) point2);
                  point2 = (Point) null;
                }
                ((Vector) stack).add((object) new Point((int) point1.x, bounds.y + bounds.height + 1));
                if (point2 != null && Math.abs((int) (point2.x - rectangle.x)) < rectangle.width / 3)
                {
                  ((Vector) stack).add((object) point2);
                  goto label_1;
                }
                else
                  goto label_1;
              }
            }
          }
          System.get_out().println(new StringBuilder().append("Adding an element at [").append((int) point1.x).append(",").append((int) point1.y).append("]").toString());
          return point1;
        }
      }
      return new Point(DashboardPanel.random.nextInt(32), DashboardPanel.random.nextInt(32));
    }
Exemple #16
0
		/// <summary>
		/// Sets the maximized bounds for this frame.
		/// </summary>
		public void setMaximizedBounds(Rectangle @bounds)
		{
		}
		/// <summary>
		/// Scrolls the view so that <code>Rectangle</code>
		/// within the view becomes visible.
		/// </summary>
		public void scrollRectToVisible(Rectangle @contentRect)
		{
		}
		/// <summary>
		/// Returns the bounding rectangle of the current clipping area.
		/// </summary>
		public Rectangle getClipBounds(Rectangle @r)
		{
			return default(Rectangle);
		}
		/// <summary>
		/// Constructs a WritableRaster with the given SampleModel, DataBuffer,
		/// and parent.
		/// </summary>
		public WritableRaster(SampleModel @sampleModel, DataBuffer @dataBuffer, Rectangle @aRegion, Point @sampleModelTranslate, WritableRaster @parent)
			: base(sampleModel, null)
		{
		}
		/// <summary>
		/// Checks whether or not the specified <code>Shape</code> intersects
		/// the specified <A HREF="../../java/awt/Rectangle.html" title="class in java.awt"><CODE>Rectangle</CODE></A>, which is in device
		/// space.
		/// </summary>
		abstract public bool hit(Rectangle @rect, Shape @s, bool @onStroke);
		/// <summary>
		/// Stores the position and size of
		/// the inner painting area of the specified component
		/// in <code>r</code> and returns <code>r</code>.
		/// </summary>
		public Rectangle calculateInnerArea(JComponent @c, Rectangle @r)
		{
			return default(Rectangle);
		}
		/// <summary>
		/// Returns the <code>Component</code>'s "visible rect rectangle" -  the
		/// intersection of the visible rectangles for this component
		/// and all of its ancestors.
		/// </summary>
		public void computeVisibleRect(Rectangle @visibleRect)
		{
		}
		/// <summary>
		/// Return true if <code>a</code> contains <code>b</code>
		/// </summary>
		static public bool isRectangleContainingRectangle(Rectangle @a, Rectangle @b)
		{
			return default(bool);
		}
		/// <summary>
		/// Paints the specified region now.
		/// </summary>
		public void paintImmediately(Rectangle @r)
		{
		}
		/// <summary>
		/// Paints a component <code>c</code> on an arbitrary graphics
		/// <code>g</code> in the specified rectangle, specifying a Rectangle object.
		/// </summary>
		static public void paintComponent(Graphics @g, Component @c, Container @p, Rectangle @r)
		{
		}
		/// <summary>
		/// Adds the specified region to the dirty region list if the component
		/// is showing.
		/// </summary>
		public void repaint(Rectangle @r)
		{
		}
		public LinearGradientBrush (Rectangle rect, Color color1, Color color2, float angle) {
			Init(rect.X, rect.Y, color1, rect.X + rect.Width, rect.Y + rect.Height, color2, angle);
		}
		/// <summary>
		/// Forwards the <code>scrollRectToVisible()</code> message to the
		/// <code>JComponent</code>'s parent.
		/// </summary>
		public void scrollRectToVisible(Rectangle @aRect)
		{
		}
		/// <summary>
		/// Components that display logical rows or columns should compute
		/// the scroll increment that will completely expose one new row
		/// or column, depending on the value of orientation.
		/// </summary>
		public int getScrollableUnitIncrement(Rectangle @visibleRect, int @orientation, int @direction)
		{
			return default(int);
		}
 /// <summary>
 /// Moves and resizes this component to conform to the new
 /// bounding rectangle <code>r</code>.
 /// </summary>
 public void setBounds(Rectangle @r)
 {
 }
 /// <summary>
 /// Stores the bounds of this component into "return value" <b>rv</b> and
 /// return <b>rv</b>.
 /// </summary>
 public Rectangle getBounds(Rectangle @rv)
 {
     return default(Rectangle);
 }
		/// <summary>
		/// Sets the normal bounds for this internal frame, the bounds that
		/// this internal frame would be restored to from its maximized state.
		/// </summary>
		public void setNormalBounds(Rectangle @r)
		{
		}