 |
VectSharp
2.2.1
A light library for C# vector graphics
|
80 void RasteriseParameter(Func<Graphics, Rectangle, double, bool, RasterImage> rasterisationMethod,
double scale);
91 protected virtual Graphics RasterisableParameter {
get; }
97 private bool disposedValue;
105 protected virtual RasterImage GetCachedRasterisation(
double scale)
107 if (this.cachedRasterisation ==
null || CachedResolution != scale)
112 return this.cachedRasterisation;
118 protected virtual Rectangle CachedBounds {
get;
set; }
123 protected virtual double CachedResolution {
get;
set; } =
double.
NaN;
131 this.RasterisableParameter = rasterisableParameter;
135 public virtual void RasteriseParameter(Func<Graphics, Rectangle, double, bool, RasterImage> rasterisationMethod,
double scale)
139 this.cachedRasterisation?.Dispose();
141 this.cachedRasterisation = rasterisationMethod(this.RasterisableParameter, bounds, scale,
true);
142 this.CachedResolution = scale;
143 this.CachedBounds = bounds;
156 this.cachedRasterisation?.Dispose();
160 this.cachedRasterisation = raster;
161 this.CachedResolution = scale;
162 this.CachedBounds = bounds;
166 throw new NotImplementedException(
@"The filter could not be rasterised! You can avoid this error by doing one of the following:
167 • Add a reference to VectSharp.Raster or VectSharp.Raster.ImageSharp (you may also need to add a using directive somewhere to force the assembly to be loaded).
168 • Provide your own implementation of Graphics.RasterisationMethod.");
173 protected virtual void Dispose(
bool disposing)
179 this.cachedRasterisation?.Dispose();
182 disposedValue =
true;
190 GC.SuppressFinalize(
this);
Point TopLeftMargin
Determines how much the area of the filter's subject should be expanded on the top-left to accommodat...
Represents a raster image, created from raw pixel data. Consider using the derived classes included i...
Represents a filter. Do not implement this interface directly; instead, implement ILocationInvariantF...
RasterImage Filter(RasterImage image, Rectangle bounds, double scale)
Applies the filter to a RasterImage.
Represents an abstract drawing surface.
Represents a filter with a parameter that needs to be rasterised at the same resolution as the subjec...
bool TryRasterise(Rectangle region, double scale, bool interpolate, out RasterImage output)
Tries to rasterise specified region of this Graphics object using the default rasterisation method.
static readonly Rectangle NaN
A rectangle whose dimensions are all double.NaN.
void RasteriseParameter(Func< Graphics, Rectangle, double, bool, RasterImage > rasterisationMethod, double scale)
Rasterises the filter's parameter at the specified scale, using the specified rasterisation method.
Represents a filter with a parameter that needs to be rasterised at the same resolution as the subjec...
RasterImage Filter(RasterImage image, double scale)
Applies the filter to a RasterImage.
Point BottomRightMargin
Determines how much the area of the filter's subject should be expanded on the bottom-right to accomm...
Represents a filter whose results depend on the position of the subject image on the graphics surface...
Represents a filter that can be applied to an image regardless of its location on the graphics surfac...
virtual void RasteriseParameter(Func< Graphics, Rectangle, double, bool, RasterImage > rasterisationMethod, double scale)
Rasterises the filter's parameter at the specified scale, using the specified rasterisation method.
Represents a point relative to an origin in the top-left corner.
Rectangle GetBounds()
Computes the rectangular bounds of the region affected by the drawing operations performed on the Gra...