Recent Releases of https://github.com/arklumpus/vectsharp

https://github.com/arklumpus/vectsharp - Version 2.6.1

New features

VectSharp.MuPDFUtils

  • New methods in the PDFParser class from VectSharp.MuPDFUtils can be used to import PDF documents (and other formats supported by MuPDF).
    • PDFParser.FromFile can be used to import an entire document or a single page from a file.
    • PDFParser.FromStream can be used to import an entire document or a single page from a document in a Stream.
    • Overloads of these methods with an out Dictionary<string, string> linkDestinations parameter can be used to enable internal and external links within the document when it is later exported.

The way this is achieved is a bit roundabout, but seems to work mostly fine: first the document is converted to SVG using MuPDFCore, and then the SVG file is imported using VectSharp.SVG.

VectSharp.Markdown

  • The MarkdownRenderer class now has rendering events that are invoked at various steps and can be used to customise the appearance of the document (#69).

VectSharp.SVG

  • The SaveAsSVG method now has a public overload that returns an XmlDocument.

VectSharp.PDF

  • There are some new public properties that can be used to manually customise PDF documents:
    • PDFPage.CropBox, PDFPage.TrimBox, PDFPage.BleedBox, PDFPage.ArtBox (in addition to PDFPage.MediaBox) to set the various bounding boxes.
    • PDFCatalog.OpenAction to set which page should be shown when opening the document.
    • A new PDFOptionalContentProperties constructor supporting alternative configurations.

Bugfixes

VectSharp.SVG

  • Improved SVG animation compatibility and performance (#68).

VectSharp.Plots

  • Axis labels are now correctly positioned when the axis is inverted (#74).
  • Stacked and clustered bar charts with a single bar now work correctly (#75).

- C#
Published by arklumpus over 1 year ago

https://github.com/arklumpus/vectsharp - Version 2.6.0

New features

  • Added support drawing text with spacing (#64)
  • Added support for complex dash patterns (#67)

VectSharp.Markdown

  • Added support for emojis (#63)

VectSharp.Plots

  • Added swarm plots.

Bugfixes

  • Fixed bug with animated gif frame disposal.

VectSharp.PDF

  • Ensure that alpha values 0 and 1 are always included in the document.
  • Use code generation instead of reflection to enumerate dictionary properties. This restores support for trimmed and AOT publication.

VectSharp.SVG

  • Fixed issue with importing filled ellipses in SVG documents.

VectSharp.Plots

  • Fixed issues with the coordinate system when the resolutions on the X axis and the Y axis are different.

- C#
Published by arklumpus almost 2 years ago

https://github.com/arklumpus/vectsharp - Version 2.5.1

New features

  • The [Pure] attribute has been added to methods whose return value should not be ignored (#60). Note that this does not necessarily imply that the method is actually pure - just that you probably do not want to ignore its return value.

VectSharp.PDF

VectSharp.Raster

  • Added JPEG output support to VectSharp.Raster (using MuPDF).

- C#
Published by arklumpus about 2 years ago

https://github.com/arklumpus/vectsharp - Version 2.5.0

New features

  • New TrueTypeFile.GetNames methods to get the font name(s) defined in a TrueType file.
  • New FolderFontLibrary class (to parse fonts from a folder) and MultiFontLibrary class (to parse fonts using multiple font libraries).
  • New +, -, and * operators for the Point class.
  • New methods to monotonise segments and to flatten paths and segments.
  • New Reverse method to reverse a GraphicsPath.
  • New GraphicsPath.GetStroke method to get the stroke of a path.
  • New GraphicsPath.ContainsPoint method to check whether a path contains a point.
  • New overload of the Graphics.FillPath method, accepting a FillRule argument that determines the fill rule (non-zero winding number, or even/odd number of contours).

VectSharp.Canvas

  • Support for Avalonia 11.

VectSharp.Plots

  • Added property to specify the maximum number of bins for violin plots.

VectSharp.Raster.ImageSharp and VectSharp.ImageSharpUtils

  • Two new versions of these packages, one with ImageSharp.Drawing updated to 1.0.0 and the other to 2.0.1.
    • Versions using ImageSharp.Drawing 1.0.0 target netstandard2.0, while the latest versions target net6.0 (like ImageSharp).

Bugfixes

  • Attempting to draw a null or empty string should not throw an exception anymore.

VectSharp.SVG

  • SVG documents containing text that uses font families that are included in the default font library now work properly.
  • Font style attributes are now propagated properly when parsing SVG documents.
  • Clipping paths defined by rect objects now work properly.
  • Improved text positioning.
  • Units other than px are now allowed when parsing SVG documents.
  • Fixed issue that occurred when multiple path data point coordinates < 1 were specified using only the . as a separator.
  • Gradients with relative units are now supported when parsing SVG documents.
  • text-anchor is now supported.
  • Entities defined outside of a defs tag are now supported.
  • Fixed issues with SVG animations on Chrome and Firefox.

VectSharp.Plots

  • Fixed issue with label centering.

- C#
Published by arklumpus over 2 years ago

https://github.com/arklumpus/vectsharp - Version 2.4.2

New features

  • The Graphics class now has a UseUniqueTags property. If this is true (the default), all plot actions called with a tag parameter attempt to create unique tags. Otherwise, they use the tag as is (e.g., using the same tag for multiple sub-elements), which was the previous behaviour until v2.4.0.
  • Added an extension method GetText on IEnumerable<FormattedText>.
  • There are now a number of standard gradients in the VectSharp.Gradients static class.
  • Added an implicit conversion operator between GradientStops and Func<double, Colour>.
  • New option for text when exporting SVG images. The ConvertIntoPathsUsingGlyphs option converts the font in paths, but only stores each glyph once and reuses it. Compared to ConvertIntoPaths, this produces smaller files, while still being independent of the original font file.
  • VectSharp.Point now implements IReadOnlyList<double> and has a number of conversion methods to and from tuples and arrays.
  • New VectSharp.Plots package to draw many kinds of plots (e.g., scatter plots, line charts, bar charts, box plots, function plots, and more).

Bugfixes

  • Fixed issues with some symbols in PDF documents (#43).

- C#
Published by arklumpus about 3 years ago

https://github.com/arklumpus/vectsharp - Version 2.4.0

New features

  • Added the GetFigures method to the GraphicsPath class, to extract figures (contours) from a path.
  • Added an optional tag parameter to a number of graphics actions that were missing it (crop, transforms, filters, clipping paths).
  • Individual text components now have their own tags (e.g., underlines, individual glyphs when drawing text on a path, or individual text spans when drawing an IEnumerable<FormattedText>.
  • Added the GetColourAt method to the GradientStops class, to get the colour at a certain position in a gradient.
  • Added a new Crop method to the Graphics class, which removes graphics actions that fall completely outside of the crop region. The Crop method of the Page class now has an optional parameter that determines whether this kind of "hard" cropping should be performed or not.
  • VectSharp.Raster now has a new method SaveAsRawBytes to render a Page to raw pixel data.
  • The GraphicsPath.Linearise method now uses multiple threads to speed up execution.
  • The Rectangle struct now has a Centre property that returns the centre of the rectangle.
  • Added the GetTags method to the Graphics class to get all the tags that have been defined in the Graphics.
  • Animations! VectSharp can now be used to create animated GIFs, SVGs and PNGs. See the documentation website for more details. The demo project also has some more example code.

Bugfixes

  • In PDF documents with semi-transparent gradients, the gradient alpha mask now does not persist after the gradient has been applied.
  • Boundaries are now computed correctly for paths containing arcs with negative angles.
  • The correct scale is now applied when rasterising filters in VectSharp.Raster.
  • Fixed an issue in the SVG parser when parsing paths with symmetrical Bezier control points.

- C#
Published by arklumpus over 3 years ago

https://github.com/arklumpus/vectsharp - Version 2.3.2

New features

  • Added new methods to the Rectangle struct (Rectangle.IsNaN and Rectangle.Intersection).
  • Added the QuadraticBezierTo method to the GraphicsPath class, which makes it possible to draw quadratic Bézier curves (these are internally elevated to cubic Béziers).
  • VectSharp.Markdown now renders equations using CSharpMath instead of using a remote GitHub server.

Bugfixes

  • Clipping paths are now properly taken in consideration when determining the bounds of a plot.
  • Bounding boxes for radial gradients are now computed properly in VectSharp.PDF.
  • VectSharp.SVG now attempts to skip XML declarations (<?xml ... ?>) when parsing SVG files.

- C#
Published by arklumpus almost 4 years ago

https://github.com/arklumpus/vectsharp - Version 2.3.1

New features

  • Added an overload of the DrawGraphics method that accepts a tag parameter.
  • Updated ImageSharp.Drawing version in VectSharp.Raster.ImageSharp to 1.0.0-beta14.16 - this introduced an API change, and requires the ImageSharp MyGet source to be enabled to download the latest version of ImageSharp.Drawing.

Bugfixes

  • Prevent out of memory exception in ImageSharp when drawing lines with a stroke width of 0 (#32).
  • Line joints are now drawn correctly when using VectSharp.Raster.ImageSharp.
  • When loading an SVG with VectSharp.SVG, object ids are now preserved and transformed into tags.
  • When loading an SVG with VectSharp.SVG, non-breaking spaces are now converted back into regular spaces.
  • In VectSharp.Markdown, data URIs containing SVG images are now parsed directly as SVG images, rather than being embedded within another SVG image.
  • When creating a PDF file, the standard font family names should now be used correctly.
  • Avoid exception in ImageSharp by not drawing a raster image if it does not overlap the target image at all (#33).

- C#
Published by arklumpus about 4 years ago

https://github.com/arklumpus/vectsharp - Version 2.3.0

New features

  • Added option to use CSS style classes for presentation attributes (#24).
  • Added Discretise method to GraphicsPath. This is similar to Linearise, but it additionally ensures that each segment does not exceed the specified length (if necessary, by breaking long line segments into smaller segments).
  • Added AddPath method to GraphicsPath. This makes it possible to add a figure represented by an existing GraphicsPath to another GraphicsPath.
  • Updated dependencies.

Bugfixes

  • Return null instead of throwing exception when trying to parse an invalid CSS colour string starting with #.
  • Fixed kerning-related exception in some fonts.
  • Fixed bug causing some standard fonts not to be displayed correctly in PDF documents.

- C#
Published by arklumpus about 4 years ago

https://github.com/arklumpus/vectsharp - Version 2.2.1

New features

  • Updated the documentation website with much more detailed tutorials and interactive WebAssembly examples.
  • Added a parameterless overload to the Page.Crop method, that crops the page based on the bounds of its contents.
  • Added the FontFamily.FamilyName property to get the full name of a font family.
  • Added an overload of the Graphics.Transform method that reduces the maximum length of line segments (useful for non-projective transformations).

Bugfixes

  • Out-of-range correction of the radii for elliptical arcs is now performed correctly.
  • Béziers that are actually straight lines are now handled properly when determining the intersections for text underlines.
  • SVG text with kerning information is now imported correctly.
  • Normalisation and bias are now actually applied in the ConvolutionFilter.
  • Cropping a Page more than once now works as expected.
  • Embedding multiple fonts in the same family in a PDF document now works as expected.

- C#
Published by arklumpus over 4 years ago

https://github.com/arklumpus/vectsharp - Version 2.2.0

New features

  • Graphics.GetBounds and GraphicsPath.GetBounds methods to compute bounding boxes.
  • If VectSharp.Raster or VectSharp.Raster.ImageSharp are installed, Graphics.TryRasterise method can be used to rasterise a region of a Graphics object (otherwise, it will return false without throwing an exception). A custom implementation for Graphics.RasterisationMethod can be provided.
  • Added support for filters through the IFilter interface and its implementations.

    • This make it possible to create e.g. drop shadows:

    • When a filter is supported by the output format (e.g. a Gaussian blur filter in SVG), the filter is rendered appropriately (e.g. by using a SVG element).

    • When a filter is not supported by the output format (e.g. in PDF), the filtered image is rasterised while exporting the file. This requires either VectSharp.Raster or VectSharp.Raster.ImageSharp to be available; alternatively, a custom implementation for Graphics.RasterisationMethod can be provided.

Bugfixes

  • Fixed a few bugs involving gradients in VectSharp.PDF (especially gradients with transparent colours).

- C#
Published by arklumpus over 4 years ago

https://github.com/arklumpus/vectsharp - Version 2.1.0

New features

  • Added support for text kerning (using kerning information defined in the kern feature of the GPOS table of the font file).

  • Added options to draw underlined text.

    • The Font constructor now has an overload taking an additional bool parameter, which determines whether text is underlined or not.
    • The style of the underline can be fine-tuned by changing the properties of the Font.Underline object.
Examples

```CSharp // Font with underline enabled Font underlinedFont = new Font(FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.Helvetica), 30, true);

graphics.FillText(10, 10, "Underlined text", underlinedFont, Colours.Black);

// By default, the underline avoids intersecting glyphs that fall below the baseline. graphics.FillText(10, 60, "Skip descenders: ajcghyup", underlinedFont, Colours.Black);

// It is also possible to draw the underline over the descenders. Font underlinedFontNoSkip = new Font(FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.Helvetica), 30, true); underlinedFontNoSkip.Underline.SkipDescenders = false;

graphics.FillText(10, 110, "Don't skip descenders: ajcghyup", underlinedFontNoSkip, Colours.Black);

// You can also change the thickness and line cap of the underline. Font thickUnderlineFont = new Font(FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.Helvetica), 30, true); thickUnderlineFont.Underline.Thickness *= 2; thickUnderlineFont.Underline.LineCap = LineCaps.Round;

graphics.FillText(10, 160, "Thick underline", thickUnderlineFont, Colours.Black);

// You can also change the position of the underline. This lets you obtain a sort of strike-through effect. Font strikeThroughFont = new Font(FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.Helvetica), 30, true); strikeThroughFont.Underline.SkipDescenders = false; strikeThroughFont.Underline.LineCap = LineCaps.Square; strikeThroughFont.Underline.Position -= 0.45;

graphics.FillText(10, 210, "Strikethrough", strikeThroughFont, Colours.Black);

// If the font is italic, the sides of the underline will follow its slant. Font italicFont = new Font(FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.TimesBoldItalic), 30, true);

graphics.FillText(10, 260, "Italic text: ajcghyup", italicFont, Colours.Black);

// You can also force the underline to have straight vertical. Font italicFontNoSlant = new Font(FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.TimesBoldItalic), 30, true); italicFontNoSlant.Underline.FollowItalicAngle = false;

graphics.FillText(10, 310, "Unslanted underline: ajcghyup", italicFontNoSlant, Colours.Black);

// You can draw separately the text and the underline; this lets you create an underline with a different colour. string text = "Coloured underline: ajcghyup";

// Font to draw the text without the underline. Font fontNoUnderline = new Font(FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.HelveticaBold), 30);

// Underlined font to draw the underline. Font fontWithUnderline = new Font(FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.HelveticaBold), 30, true);

// Brush for the underline. LinearGradientBrush underlineBrush = new LinearGradientBrush(new Point(10, 360), new Point(10 + fontNoUnderline.MeasureText(text).Width, 360), new GradientStop(Colours.LawnGreen, 0), new GradientStop(Colours.CornflowerBlue, 1));

// Fill the text without underline. graphics.FillText(10, 360, text, fontNoUnderline, Colours.Black);

// Fill the underline without text. graphics.FillTextUnderline(10, 360, text, fontWithUnderline, underlineBrush); ```

- C#
Published by arklumpus over 4 years ago

https://github.com/arklumpus/vectsharp - Version 2.0.0

Breaking changes

  • New IFontLibrary API. The FontFamily(string) and FontFamily(FontFamily.StandardFontFamilies) constructors are now deprecated, use the FontFamily.ResolveFontFamily method instead.

New features

  • Changed license to LGPLv3 (except for VectSharp.Raster and VectSharp.MuPDFUtils, which remain under AGPLv3 for now).
  • The embedded fonts have been changed.
  • The VectSharp.Fonts.Nimbus package can be used to restore the fonts from previous versions (under a GPLv3 license).

Bugfixes

  • Fixed a bug causing small vertical alignment problems for text in VectSharp.Canvas on Windows.

- C#
Published by arklumpus over 4 years ago

https://github.com/arklumpus/vectsharp - Version 1.8.1

- C#
Published by arklumpus over 4 years ago

https://github.com/arklumpus/vectsharp - Version 1.8.0

New features: - Gradients - Formatted text

- C#
Published by arklumpus almost 5 years ago

https://github.com/arklumpus/vectsharp - Version 1.7.0

- C#
Published by arklumpus over 5 years ago

https://github.com/arklumpus/vectsharp - Version 1.5.1

- C#
Published by arklumpus almost 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.5.0

- C#
Published by arklumpus almost 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.4.2

- C#
Published by arklumpus almost 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.4.0

- C#
Published by arklumpus almost 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.3.1

- C#
Published by arklumpus about 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.3.0

- C#
Published by arklumpus about 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.2.1

- C#
Published by arklumpus about 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.2.0

- C#
Published by arklumpus about 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.1.2

- C#
Published by arklumpus over 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.1.1

- C#
Published by arklumpus over 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.1.0

- C#
Published by arklumpus over 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.0.2

Fixed a bug with the advertised length of compressed embedded fonts.

- C#
Published by arklumpus over 6 years ago

https://github.com/arklumpus/vectsharp - Version 1.0.0

- C#
Published by arklumpus over 6 years ago