Beispiel #1
0
        /// <summary>
        /// Creates a graphics context (as a <seealso cref="Graphics2D"/> object) for the splash
        /// screen overlay image, which allows you to draw over the splash screen.
        /// Note that you do not draw on the main image but on the image that is
        /// displayed over the main image using alpha blending. Also note that drawing
        /// on the overlay image does not necessarily update the contents of splash
        /// screen window. You should call {@code update()} on the
        /// <code>SplashScreen</code> when you want the splash screen to be
        /// updated immediately.
        /// <para>
        /// The pixel (0, 0) in the coordinate space of the graphics context
        /// corresponds to the origin of the splash screen native window bounds (see
        /// <seealso cref="#getBounds()"/>).
        ///
        /// </para>
        /// </summary>
        /// <returns> graphics context for the splash screen overlay surface </returns>
        /// <exception cref="IllegalStateException"> if the splash screen has already been closed </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public Graphics2D createGraphics() throws IllegalStateException
        public Graphics2D CreateGraphics()
        {
            lock (typeof(SplashScreen))
            {
                CheckVisible();
                if (Image == null)
                {
                    // get unscaled splash image size
                    Dimension dim = _getBounds(SplashPtr).Size;
                    Image = new BufferedImage(dim.Width_Renamed, dim.Height_Renamed, BufferedImage.TYPE_INT_ARGB);
                }
                float      scale = _getScaleFactor(SplashPtr);
                Graphics2D g     = Image.CreateGraphics();
                assert(scale > 0);
                if (scale <= 0)
                {
                    scale = 1;
                }
                g.Scale(scale, scale);
                return(g);
            }
        }