Text and graphics rendering
Overcoming the limitations of System.Drawing
- Draw on any bitmaps, even CMYK and 16 bit/channel
- Vector PDF/EPS files
- TrueType, OpenType, Type 1 fonts
- Multiline, curved, and artistic text
- Advanced typographic features
Draw text and graphics on any bitmaps
You are no longer limited by a bitmap type when you need to draw text or graphics (lines, rectangles, ellipses, etc) on an image. Graphics Mill can modify all types of bitmaps:
- RGB/CMYK/Grayscale
- Both 8-bit and 16-bit per channel
- With and without alpha channel
Alpha blending and antialiasing are fully supported and the graphics output is extremely precise. You can also define a clipping path or even read it from the Adobe Resources block of your JPEG/TIFF/PSD file.
View code sampleSave vector data as PDF/EPS
If you are going to send graphics created by Graphics Mill to a printer, you would definitely prefer to save it as vector. It's easy! Create PDF or EPS files and export the following data:
- Lines, curves, rectangles and other graphics
- Text
- Bitmaps
You can add one or more pages, define a crop/bleed/trim box for each page, and even define an embedded color profile!
View code sampleWork with any font files (TrueType, Open Type, Type 1)
Unlike System.Drawing, you are not limited with TrueType. You can draw text strings with fonts of other types as well. Moreover, you don't have to install that fonts on your computer - it is easy to load fonts from a specified file!
using (var bitmap = new Bitmap(600, 250, PixelFormat.Format24bppRgb, RgbColor.White)) using (var graphics = bitmap.GetAdvancedGraphics()) using (var fontRegistry = new CustomFontRegistry()) { var fontSize = 32f; var fontName = fontRegistry.Add(@"Lobster.otf"); graphics.FontRegistry = fontRegistry; var font = graphics.CreateFont(fontName, fontSize); var plainText = new PlainText("plain text", font); plainText.Position = new System.Drawing.PointF(5, plainText.GetBlackBox().Height + 10); //... }
Advanced text output
Graphics Mill is a really powerful when it comes to the text output:
- Rendering not just a plain text with some certain font settings, but it also supports rich text formatting.
- Work with advanced font features, such as ligatures, etc.
- Precisely calculate the text block size (black box) and various font metrics (ascender, descender, height, etc).
- Draw text not only as a single string but also as a paragraph. Specify the text boundaries and Graphics Mill will automatically break it into multiple lines and clip the text outside of the allowed box. You can control many aspects of the text output:
- Alignment
- Orientation
- Transformation (e.g. rotation)
- Distance between lines (leading)
- Distance between characters (tracking, kerning)
- Number of columns
- Link several text blocks together and Graphics Mill will automatically arrange text between them.
- Overlap objects over the text block. Depending on your settings, it may wrap such objects around.
Using these features you can render texts even with really complicated layouts!
View code sampleRender text with artistic effects
Graphics Mill can turn a simple text string into a piece of art. You can apply the following effects:
- Add glow, shadow, outline
- Morph different parts of a string to create various artistic effects (predefined and custom)
- Draw text on a specified curve or circle
No need to perform complicated math or transformation. Just add a single line of code and Graphics Mill will do all the job automatically!