public AntiAliasingDrawer(Drawer Source, double Size, int Quality) { this._Samples = new List<Sample>(Quality * Quality); double delta = 1.0 / (double)Quality; double inital = -0.5 + delta * 0.5; double totalintensity = 0.0; for (int x = 0; x < Quality; x++) { for (int y = 0; y < Quality; y++) { Vector point = new Vector((double)x * delta + inital, (double)y * delta + inital); double intensity = IntensityAtDistance(point.Length * 2.0); totalintensity += intensity; this._Samples.Add(new Sample() { Offset = point * Size, Intensity = intensity }); } } this._Source = Source; }
/// <summary> /// Performs antialiasing on a drawer. /// </summary> public static AntiAliasingDrawer Antialias(Drawer Source, double Size) { return new AntiAliasingDrawer(Source, Size, 3); }
/// <summary> /// Defines a texture based on a drawer source. /// </summary> /// <param name="AspectRatio">The target aspect ratio for the image.</param> /// <param name="Detail">A relative estimate of the detail level required for the texture.</param> public static Texture Define(Drawer Source, double AspectRatio, double Detail) { return new Texture() { _Source = Source, _AspectRatio = AspectRatio, _Detail = Detail, _ID = -1 }; }