Search Results for

    Show / Hide Table of Contents

    Class GraphicUtils

    Inheritance
    object
    GraphicUtils
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Reportman.Drawing.Windows
    Assembly: Reportman.Drawing.Windows.dll
    Syntax
    public class GraphicUtils

    Constructors

    GraphicUtils()

    Declaration
    public GraphicUtils()

    Fields

    DefaultDPI

    Declaration
    public static int DefaultDPI
    Field Value
    Type Description
    int

    Properties

    DPIScale

    Declaration
    public static float DPIScale { get; }
    Property Value
    Type Description
    float

    DPIScaleX

    Declaration
    public static float DPIScaleX { get; }
    Property Value
    Type Description
    float

    DPIScaleY

    Declaration
    public static float DPIScaleY { get; }
    Property Value
    Type Description
    float

    Methods

    ConvertToBitonal(Bitmap, int)

    Declaration
    public static Bitmap ConvertToBitonal(Bitmap original, int threshold)
    Parameters
    Type Name Description
    Bitmap original
    int threshold
    Returns
    Type Description
    Bitmap

    CreateWindowsMetafile(int, int)

    Declaration
    public static Metafile CreateWindowsMetafile(int Width, int Height)
    Parameters
    Type Name Description
    int Width
    int Height
    Returns
    Type Description
    Metafile

    DrawGrid(Graphics, int, int, int, int, Color, bool, int, int, double)

    Draw a grid given a distance in twips

    Declaration
    public static void DrawGrid(Graphics gr, int XWidth, int XHeight, int PixelsWidth, int PixelsHeight, Color GridColor, bool Lines, int XOffset, int YOffset, double Scale)
    Parameters
    Type Name Description
    Graphics gr

    Destination

    int XWidth

    Width in twips (1440 twips=1 inch)

    int XHeight

    Height in twips

    int PixelsWidth

    Width in pixels

    int PixelsHeight

    Height in pixels

    Color GridColor

    Color of the points or lines drawn

    bool Lines

    Set to true to draw lines instead of points

    int XOffset

    Horizontal offset

    int YOffset

    Vertical offset

    double Scale

    Scale the grid, set to 1.0 to draw in real size

    ExifRotate(Image)

    Declaration
    public static bool ExifRotate(Image img)
    Parameters
    Type Name Description
    Image img
    Returns
    Type Description
    bool

    FontStyleFromInteger(int)

    Create a FontStyle from integer

    Declaration
    public static FontStyle FontStyleFromInteger(int intfontstyle)
    Parameters
    Type Name Description
    int intfontstyle
    Returns
    Type Description
    FontStyle

    GetAvgFontSizeTwips(string, float, FontStyle)

    Declaration
    public static Size GetAvgFontSizeTwips(string FontFamily, float FontSize, FontStyle FStyle)
    Parameters
    Type Name Description
    string FontFamily
    float FontSize
    FontStyle FStyle
    Returns
    Type Description
    Size

    GetBitmapGrid(int, int, int, int, Color, Color, bool, double)

    Obtain a bitmap to perform fast drawing of a grid, so consecutive calls with similar parameters will execute faster. The implementation uses a shared bitmap.

    Declaration
    public static Bitmap GetBitmapGrid(int Width, int Height, int GWidth, int GHeight, Color GColor, Color BackColor, bool Lines, double Scale)
    Parameters
    Type Name Description
    int Width
    int Height
    int GWidth
    int GHeight
    Color GColor
    Color BackColor
    bool Lines
    double Scale
    Returns
    Type Description
    Bitmap

    GetEncoderInfo(string)

    Declaration
    public static ImageCodecInfo GetEncoderInfo(string mimeType)
    Parameters
    Type Name Description
    string mimeType
    Returns
    Type Description
    ImageCodecInfo

    GetImageCodec(string)

    Retuns a codec with the mime type or null if not found

    Declaration
    public static ImageCodecInfo GetImageCodec(string mimeType)
    Parameters
    Type Name Description
    string mimeType

    Codec string, example "image/jpeg"

    Returns
    Type Description
    ImageCodecInfo

    GetImageCodecFromExtension(string)

    Retuns a codec with the mime type or null if not found

    Declaration
    public static ImageCodecInfo GetImageCodecFromExtension(string extension)
    Parameters
    Type Name Description
    string extension
    Returns
    Type Description
    ImageCodecInfo

    GetImageCodecs()

    Obtain a list of available image codecs

    Declaration
    public static Strings GetImageCodecs()
    Returns
    Type Description
    Strings

    A list, string collection of image codecs

    GetImageGrid(int, int, int, int, Color, Color, bool, double)

    Obtain a Image (Metafile or Bitmap) to perform fast drawing of a grid, so consecutive calls with similar parameters will execute faster. The implementation uses a shared bitmap or metafile.

    Declaration
    public static Image GetImageGrid(int Width, int Height, int GWidth, int GHeight, Color GColor, Color BackColor, bool Lines, double Scale)
    Parameters
    Type Name Description
    int Width
    int Height
    int GWidth
    int GHeight
    Color GColor
    Color BackColor
    bool Lines
    double Scale
    Returns
    Type Description
    Image

    GetInvertedBlackWhite(Color)

    Declaration
    public static Color GetInvertedBlackWhite(Color c)
    Parameters
    Type Name Description
    Color c
    Returns
    Type Description
    Color

    GetMetafileGrid(int, int, int, int, Color, Color, bool, double)

    Obtain a metafile to perform fast drawing of a grid, so consecutive calls with similar parameters will execute faster. The implementation uses a shared metafile.

    Declaration
    public static Metafile GetMetafileGrid(int Width, int Height, int GWidth, int GHeight, Color GColor, Color BackColor, bool Lines, double Scale)
    Parameters
    Type Name Description
    int Width
    int Height
    int GWidth
    int GHeight
    Color GColor
    Color BackColor
    bool Lines
    double Scale
    Returns
    Type Description
    Metafile

    GetMimeType(Image)

    Declaration
    public static string GetMimeType(Image i)
    Parameters
    Type Name Description
    Image i
    Returns
    Type Description
    string

    GetRotateFlipTypeByExifOrientationData(int)

    Declaration
    public static RotateFlipType GetRotateFlipTypeByExifOrientationData(int orientation)
    Parameters
    Type Name Description
    int orientation
    Returns
    Type Description
    RotateFlipType

    GetRoundedLine(PointF[], float)

    Declaration
    public static GraphicsPath GetRoundedLine(PointF[] points, float cornerRadius)
    Parameters
    Type Name Description
    PointF[] points
    float cornerRadius
    Returns
    Type Description
    GraphicsPath

    ImageFromStream(Stream)

    Returns a Image from stream. Do rotation for jpeg camera images

    Declaration
    public static Image ImageFromStream(Stream mstream)
    Parameters
    Type Name Description
    Stream mstream

    Memory stream to read Image from

    Returns
    Type Description
    Image

    Image object

    ImageToByteArray(Image)

    Declaration
    public static byte[] ImageToByteArray(Image nimage)
    Parameters
    Type Name Description
    Image nimage
    Returns
    Type Description
    byte[]

    ImageToStream(Image)

    Declaration
    public static MemoryStream ImageToStream(Image nimage)
    Parameters
    Type Name Description
    Image nimage
    Returns
    Type Description
    MemoryStream

    IntegerFromFontStyle(FontStyle)

    Declaration
    public static int IntegerFromFontStyle(FontStyle astyle)
    Parameters
    Type Name Description
    FontStyle astyle
    Returns
    Type Description
    int

    IntegerFromStringFontStyle(string)

    Declaration
    public static int IntegerFromStringFontStyle(string sfontstyle)
    Parameters
    Type Name Description
    string sfontstyle
    Returns
    Type Description
    int

    LengthenLine(PointF, ref PointF, float)

    Declaration
    public static void LengthenLine(PointF startPoint, ref PointF endPoint, float pixelCount)
    Parameters
    Type Name Description
    PointF startPoint
    PointF endPoint
    float pixelCount

    MeasureDisplayStringWidth(Graphics, string, Font)

    Calculates the with in current graphics units of a text

    Declaration
    public static double MeasureDisplayStringWidth(Graphics graphics, string text, Font font)
    Parameters
    Type Name Description
    Graphics graphics

    Graphics object where the measurement will be done

    string text

    Text to be measured

    Font font

    Font used for the measurement

    Returns
    Type Description
    double

    Width in graphic units of the measured text

    RemapImageTransparentColor(Image, Color)

    Declaration
    public static Image RemapImageTransparentColor(Image img, Color OldColor)
    Parameters
    Type Name Description
    Image img
    Color OldColor
    Returns
    Type Description
    Image

    ScaleBitmapDPI(Image)

    Declaration
    public static Image ScaleBitmapDPI(Image image)
    Parameters
    Type Name Description
    Image image
    Returns
    Type Description
    Image

    ScaleToDPI(int)

    Declaration
    public static int ScaleToDPI(int pixels)
    Parameters
    Type Name Description
    int pixels
    Returns
    Type Description
    int

    ScaledBitmapRatio(Image, int, int, bool)

    Scale bitmap to a maximum of width and height

    Declaration
    public static Image ScaledBitmapRatio(Image image, int width, int height, bool highquality)
    Parameters
    Type Name Description
    Image image
    int width
    int height
    bool highquality
    Returns
    Type Description
    Image

    ScaledBitmapRatio(Image, int, int, bool, bool)

    Declaration
    public static Image ScaledBitmapRatio(Image image, int width, int height, bool highquality, bool allowexpand)
    Parameters
    Type Name Description
    Image image
    int width
    int height
    bool highquality
    bool allowexpand
    Returns
    Type Description
    Image

    ScreenDPI()

    Declaration
    public static int ScreenDPI()
    Returns
    Type Description
    int

    ScreenDPIX()

    Declaration
    public static int ScreenDPIX()
    Returns
    Type Description
    int

    ScreenDPIY()

    Declaration
    public static int ScreenDPIY()
    Returns
    Type Description
    int

    SimpleThresholdBW(byte[], int, int, int, int, int)

    Declaration
    public static byte[] SimpleThresholdBW(byte[] sourceBuffer, int width, int height, int srcStride, int dstStride, int threshold)
    Parameters
    Type Name Description
    byte[] sourceBuffer
    int width
    int height
    int srcStride
    int dstStride
    int threshold
    Returns
    Type Description
    byte[]

    StringFontStyleFromInteger(int)

    Declaration
    public static string StringFontStyleFromInteger(int intstyle)
    Parameters
    Type Name Description
    int intstyle
    Returns
    Type Description
    string

    StringFromFontStyle(FontStyle)

    Declaration
    public static string StringFromFontStyle(FontStyle astyle)
    Parameters
    Type Name Description
    FontStyle astyle
    Returns
    Type Description
    string

    TextToBitmap(int, string, string, float)

    Converts a text to his representation in bitmap form

    Declaration
    public static Bitmap TextToBitmap(int width, string text, string fontfamily, float fontsize)
    Parameters
    Type Name Description
    int width

    Witdh of the resulting bitmap

    string text

    Text to be printed into the bitmap

    string fontfamily

    Font family

    float fontsize

    Font size

    Returns
    Type Description
    Bitmap

    Returns a bitmap with the text drawn on it

    WriteWindowsMetaFile(Metafile, Stream, float)

    Write a Windows Metafile into a stream

    Declaration
    public static void WriteWindowsMetaFile(Metafile metaf, Stream destination, float Scale)
    Parameters
    Type Name Description
    Metafile metaf

    Metafile to write

    Stream destination

    Stream destination

    float Scale

    Scale of the Windows Metafile

    WriteWindowsMetaFileCodec(Metafile, Stream, float, string, out string)

    Convert a windows metafile to a image format saved into a stream

    Declaration
    public static void WriteWindowsMetaFileCodec(Metafile metaf, Stream destination, float Scale, string codecstring, out string mimetype)
    Parameters
    Type Name Description
    Metafile metaf

    Windows Metafile to be converted

    Stream destination

    Destination stream

    float Scale

    Scale of the metafile

    string codecstring

    Codec to be used you can obtain a list by using GetImageCodecs

    string mimetype

    Mimetype of the selected codec

    In this article
    Back to top Generated by DocFX