public static void FitFill <TPixel>(this Image <TPixel> target, ITextureSampler <Vector4> sampler) where TPixel : struct, IPixel <TPixel> { var scale = new Vector2(sampler.Scale.Width / (float)target.Width, sampler.Scale.Height / (float)target.Height); for (int dy = 0; dy < target.Height; ++dy) { var tl = default(UV); var tr = default(UV); var bl = default(UV); var br = default(UV); tl.Y = tr.Y = dy; bl.Y = br.Y = dy + 1; var c = default(TPixel); for (int dx = 0; dx < target.Width; ++dx) { tl.X = bl.X = dx; tr.X = br.X = dx + 1; var r = sampler.GetAreaSample(tl * scale, tr * scale, br * scale, bl * scale); c.PackFromVector4(r); target[dx, dy] = c; } } }
public _PolarTransformedTextureSampler(ITextureSampler <TPixel> source, bool inverse = false) : base(source) { _Inverse = inverse; _Scale = source.Scale; _Center = _Scale / 2; _Center = _Center.RoundDown(); // todo: we could "snap" the _Center of the image to an interpixel cross. }
public CubemapSampler(ITextureSampler <T> f, ITextureSampler <T> b, ITextureSampler <T> l, ITextureSampler <T> r, ITextureSampler <T> top, ITextureSampler <T> bottom) { _Front = f; _Back = b; _Left = l; _Right = r; _Top = top; _Bottom = bottom; }
public static ITextureSampler <Vector4> LerpColor(this ITextureSampler <float> source, IPixel odd, IPixel even) { return(new _LerpColorSampler(source, odd, even)); }
public static ITextureSampler <HalfSingle> ToHalfSingle(this ITextureSampler <float> source) { return(new _FloatToHalfSingleSampler(source)); }
public _FloatToHalfSingleSampler(ITextureSampler <float> source) { _Source = source; }
public _LerpColorSampler(ITextureSampler <float> source, IPixel odd, IPixel even) { _Source = source; _OddColor = odd.ToVector4(); _EvenColor = even.ToVector4(); }
public static ITextureSampler <TPixel> ToPolarTransform <TPixel>(this ITextureSampler <TPixel> ts, bool inverse) { return(new _PolarTransformedTextureSampler <TPixel>(ts, inverse)); }
public _TransformedTextureSampler(ITextureSampler <TPixel> source) { _Source = source; }
public TextureSamplingManager(TextureSamplingQuality q) { this.Quality = q; if (q == TextureSamplingQuality.Linear) { this.sampler = new LinearTextureSampler(); } else if (q == TextureSamplingQuality.Nearest) { this.sampler = new NearestTextureSampler(); } }