Package cli.System.Drawing

Examples of cli.System.Drawing.Graphics


     * Create a Graphics with the settings for the given FontRenderContext
     *
     * @return
     */
    private static Graphics createGraphics(FontRenderContext frc){
        Graphics g = Graphics.FromImage(BITMAP);
        boolean fm = frc.usesFractionalMetrics();
        g.set_SmoothingMode(SmoothingMode.wrap(fm ? SmoothingMode.None : SmoothingMode.AntiAlias));
        g.set_PixelOffsetMode(PixelOffsetMode.wrap(fm ? PixelOffsetMode.None : PixelOffsetMode.HighQuality));
        g.set_TextRenderingHint(TextRenderingHint.wrap(fm ? TextRenderingHint.SingleBitPerPixelGridFit : TextRenderingHint.AntiAliasGridFit));
        return g;
    }
View Full Code Here


        format.set_FormatFlags( StringFormatFlags.wrap( StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap |
                             StringFormatFlags.FitBlackBox ));
        format.set_Trimming( StringTrimming.wrap( StringTrimming.None ) );
        format.SetMeasurableCharacterRanges(new CharacterRange[] {new CharacterRange(0, 1)});
        Graphics g = createGraphics( frc );
        Region[] regions = g.MeasureCharacterRanges(String.valueOf((char)cp), font.getNetFont(),
                                                    new RectangleF(0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE), format);
        SizeF size = regions[0].GetBounds(g).get_Size();
        regions[0].Dispose();
        return frc.usesFractionalMetrics() ? size.get_Width() :  Math.round(size.get_Width());
    }
View Full Code Here

TOP

Related Classes of cli.System.Drawing.Graphics

Copyright © 2018 www.massapicom. 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.