本文整理汇总了C#中SmoothingMode类的典型用法代码示例。如果您正苦于以下问题:C# SmoothingMode类的具体用法?C# SmoothingMode怎么用?C# SmoothingMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SmoothingMode类属于命名空间,在下文中一共展示了SmoothingMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GraphicsContainer
// Constructor, which saves away all of the important information.
// We assume that the lock on the "graphics" object is held by the caller.
internal GraphicsContainer(Graphics graphics)
{
// Push this container onto the stack.
this.graphics = graphics;
next = graphics.stackTop;
graphics.stackTop = this;
// Save the graphics state information.
clip = graphics.Clip;
if(clip != null)
{
clip = clip.Clone();
}
compositingMode = graphics.CompositingMode;
compositingQuality = graphics.CompositingQuality;
interpolationMode = graphics.InterpolationMode;
pageScale = graphics.PageScale;
pageUnit = graphics.PageUnit;
pixelOffsetMode = graphics.PixelOffsetMode;
renderingOrigin = graphics.RenderingOrigin;
smoothingMode = graphics.SmoothingMode;
textContrast = graphics.TextContrast;
textRenderingHint = graphics.TextRenderingHint;
if (graphics.transform == null)
{
transform = null;
}
else
{
transform = Matrix.Clone(graphics.transform);
}
}
示例2: Overview
public Overview()
{
// Set some styles
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.UserPaint, true);
document = null;
options = new MindFusion.FlowChartX.PrintOptions(null);
smoothMode = SmoothingMode.Default;
scaleFactor = 30;
fitToAll = false;
marginalColor = Color.FromArgb(35, Color.Black);
// Initialize rendering options
options.EnableShadows = true;
options.EnableImages = true;
options.EnableInterior = true;
options.EnableBackground = true;
options.EnableBackgroundImage = true;
options.EnableText = true;
options.PaintControls = true;
// Auto scroll
autoScroll = true;
autoScrDX = autoScrDY = 0;
}
示例3: Begin
/// <summary>
/// Method to perform preparatory work for symbilizing.
/// </summary>
/// <param name="g">The graphics object to symbolize upon</param>
/// <param name="map">The map</param>
/// <param name="aproximateNumberOfGeometries">An approximate number of geometries to symbolize</param>
public virtual void Begin(Graphics g, Map map, int aproximateNumberOfGeometries)
{
_oldSmootingMode = g.SmoothingMode;
_oldPixelOffsetMode = g.PixelOffsetMode;
g.SmoothingMode = SmoothingMode;
g.PixelOffsetMode = PixelOffsetMode;
}
示例4: DSView
public DSView(Pad pad, TimeSeries series, Color color, SearchOption option, SmoothingMode smoothing)
: base(pad)
{
this.series = series;
Option = option;
Color = color;
SmoothingMode = smoothing;
ToolTipFormat = "{0}\n{2} - {3:F*}".Replace("*", pad.Chart.LabelDigitsCount.ToString());
}
示例5: DSView
public DSView(Pad pad, DoubleSeries series, Color color, EIndexOption option, SmoothingMode smoothing)
: base(pad)
{
this.mainSeries = series;
this.option = option;
this.KNRy1kSrcC = color;
this.IXfyvDxxVL = smoothing;
this.ToolTipFormat = "toool";
// this.ToolTipFormat = this.toolTipFormat.Replace(FJDHryrxb1WIq5jBAt.mT707pbkgT(2828), pad.Chart.LabelDigitsCount.ToString());
}
示例6: CreateCropedImageFile
public static Stream CreateCropedImageFile(Stream originalStream, double x, double y, double q, ImageFormat outputFormat, SmoothingMode smoothingMode, InterpolationMode interpolationMode, PixelOffsetMode pixelOffsetMode, double verticalDiff, double horizontalDiff)
{
if (originalStream == null)
return new MemoryStream();
Stream newMemoryStream;
using (var originalImage = System.Drawing.Image.FromStream(originalStream))
{
using (var bmp = new Bitmap((int)x, (int)y))
{
double verticalOffset = verticalDiff;
double horizontalOffset = horizontalDiff;
if(horizontalDiff == double.MaxValue)
{
horizontalOffset = originalImage.Width - x;
}else if(horizontalDiff < 0)
{
horizontalOffset = (originalImage.Width - x)/2;
}
if(horizontalOffset<0)
horizontalOffset = 0;
if (verticalDiff == double.MaxValue)
{
verticalOffset = originalImage.Height - y;
}else if(verticalDiff < 0)
{
verticalOffset = (originalImage.Height - y)/2;
}
if(verticalOffset<0)
verticalOffset = 0;
bmp.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution);
using (var graphic = Graphics.FromImage(bmp))
{
graphic.SmoothingMode = smoothingMode;
graphic.InterpolationMode = interpolationMode;
graphic.PixelOffsetMode = pixelOffsetMode;
graphic.DrawImage(originalImage, new Rectangle(0, 0, (int)x, (int)y), (int)horizontalOffset, (int)verticalOffset, (int)x, (int)y, GraphicsUnit.Pixel);
newMemoryStream = new MemoryStream();
bmp.Save(newMemoryStream, originalImage.RawFormat);
if(bmp != null)
bmp.Dispose();
}
}
}
newMemoryStream.Position = 0;
return newMemoryStream;
}
示例7: FeatureSymbolizerOld
/// <summary>
/// This constructor takes on some default values, and assumes that it
/// has no other underlying symblizer to reference.
/// </summary>
public FeatureSymbolizerOld()
{
// Use the property to also set FillColor
_fillColor = SymbologyGlobal.RandomColor();
_fillBrush = new SolidBrush(_fillColor);
_opacity = 1f;
_isVisible = true; // This is boolean and should be true by default
_smoothing = SmoothingMode.AntiAlias;
LegendType = LegendType.Symbol;
base.LegendSymbolMode = SymbolMode.Symbol;
}
示例8: RenderText
public static void RenderText(Graphics gr, string text, int x, Color fillColor, Color textColor, Color traceColor, int maxHeight = -1, int y = 4, Font font = null, bool center = false, InterpolationMode interpolationMode = InterpolationMode.High, SmoothingMode smoothingMode = SmoothingMode.HighQuality)
{
gr.InterpolationMode = interpolationMode;
gr.SmoothingMode = smoothingMode;
gr.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
gr.CompositingQuality = CompositingQuality.HighQuality;
FontFamily family = FontFamily.GenericMonospace;
FontStyle fontStyle = FontStyle.Bold;
float fontSize = 10;
if (font != null) {
family = font.FontFamily;
fontStyle = font.Style;
fontSize = font.SizeInPoints;
}
GraphicsPath p = new GraphicsPath();
p.AddString(
text,
family,
(int)fontStyle,
gr.DpiY * fontSize / 72,
new Point(x, y),
new StringFormat());
if (x < 0 || center) {
if (x < 0) {
x = (int)(Math.Abs(x) - p.GetBounds().Width - 10);
}
if (center) {
y = (int)((maxHeight - (p.GetBounds().Height + p.GetBounds().Y)) / 2);
}
p = new GraphicsPath();
p.AddString(
text,
family,
(int)fontStyle,
gr.DpiY * fontSize / 72,
new Point(x, y),
new StringFormat());
}
maxHeight = maxHeight < 0 ? (int)p.GetBounds().Height : maxHeight;
if (fillColor != Color.Empty) {
using (Brush brush = new SolidBrush(fillColor)) {
gr.FillRectangle(brush, new RectangleF(p.GetBounds().X - 8, 0, p.GetBounds().Width + 16, maxHeight - 1));
}
gr.DrawRectangle(Pens.Black, new Rectangle((int)p.GetBounds().X - 8, 0, (int)p.GetBounds().Width + 16, maxHeight - 1));
}
using (Pen pen = new Pen(traceColor, 2)) {
gr.DrawPath(pen, p);
}
using (SolidBrush brush = new SolidBrush(textColor)) {
gr.FillPath(brush, p);
}
}
示例9: GraphicsQualityManager
public GraphicsQualityManager(Graphics g, bool setHighQuality = true)
{
this.g = g;
previousCompositingQuality = g.CompositingQuality;
previousInterpolationMode = g.InterpolationMode;
previousSmoothingMode = g.SmoothingMode;
if (setHighQuality)
{
SetHighQuality();
}
}
示例10: NuGenGrfxMode
/// <summary>
/// Initializes a new instance of the <see cref="NuGenGrfxMode"/> class.
/// </summary>
/// <exception cref="ArgumentNullException">
/// <para><paramref name="grfx"/> is <see langword="null"/>.</para>
/// </exception>
public NuGenGrfxMode(Graphics grfx)
{
if (grfx == null)
{
throw new ArgumentNullException("grfx");
}
_grfx = grfx;
_oldPixelOffsetMode = _grfx.PixelOffsetMode;
_oldSmoothingMode = _grfx.SmoothingMode;
_oldTextRenderingHint = _grfx.TextRenderingHint;
}
示例11: UseAntiAlias
/// <summary>
/// Initialize a new instance of the UseAntiAlias class.
/// </summary>
/// <param name="graphics">Graphics instance.</param>
public UseAntiAlias(Graphics graphics)
{
if (graphics == null)
{
throw new ArgumentNullException("graphics",
string.Format(System.Globalization.CultureInfo.InvariantCulture,
BSE.Windows.Forms.Properties.Resources.IDS_ArgumentException,
"graphics"));
}
this.m_graphics = graphics;
this.m_smoothingMode = m_graphics.SmoothingMode;
this.m_graphics.SmoothingMode = SmoothingMode.AntiAlias;
}
示例12: UseAntiAlias
/// <summary>
/// Initialize a new instance of the UseAntiAlias class.
/// </summary>
/// <param name="graphics">Graphics instance.</param>
public UseAntiAlias(Graphics graphics)
{
if (graphics == null)
{
throw new ArgumentNullException("graphics",
string.Format(CultureInfo.InvariantCulture,
Resources.IDS_ArgumentException,
"graphics"));
}
this.m_graphics = graphics;
this.m_smoothingMode = m_graphics.SmoothingMode;
this.m_graphics.SmoothingMode = SmoothingMode.AntiAlias;
}
示例13: ToolkitGraphicsBase
// Constructor.
protected ToolkitGraphicsBase(IToolkit toolkit)
{
this.toolkit = toolkit;
clip = null;
compositingMode = CompositingMode.SourceOver;
compositingQuality = CompositingQuality.Default;
interpolationMode = InterpolationMode.Default;
pixelOffsetMode = PixelOffsetMode.Default;
renderingOrigin = new Point(0, 0);
smoothingMode = SmoothingMode.Default;
textContrast = 4;
textRenderingHint = TextRenderingHint.SystemDefault;
dirtyFlags = DirtyFlags.All;
}
示例14: Resize
public static Image Resize(this Image image, int newWidth, int newHeight, SmoothingMode quality = SmoothingMode.HighQuality)
{
var newImage = new Bitmap(newWidth, newHeight);
using (var graphics = Graphics.FromImage(newImage))
{
graphics.SmoothingMode = quality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.DrawImage(image, new Rectangle(0, 0, newWidth, newHeight));
}
return newImage;
}
示例15: WatermarkImageWithText
public void WatermarkImageWithText(Image inputImage, ref Image outputImage, SmoothingMode smoothingMode,
string text, Font font, int x, int y, bool renderOver, Brush under,
Brush over, StringAlignment xAlignment, StringAlignment yAlignment)
{
int phWidth = inputImage.Width;
int phHeight = inputImage.Height;
//create a Bitmap the Size of the original photograph
var bmPhoto = new Bitmap(phWidth, phHeight, PixelFormat.Format24bppRgb);
bmPhoto.SetResolution(inputImage.HorizontalResolution, inputImage.VerticalResolution);
Graphics grPhoto = null;
try
{
//load the Bitmap into a Graphics object
grPhoto = Graphics.FromImage(bmPhoto);
//Set the rendering quality for this Graphics object
grPhoto.SmoothingMode = smoothingMode;
//Draws the photo Image object at original size to the graphics object.
grPhoto.DrawImage(
inputImage, // Photo Image object
new Rectangle(0, 0, phWidth, phHeight), // Rectangle structure
0, // x-coordinate of the portion of the source image to draw.
0, // y-coordinate of the portion of the source image to draw.
phWidth, // Width of the portion of the source image to draw.
phHeight, // Height of the portion of the source image to draw.
GraphicsUnit.Pixel); // Units of measure
// calculate the text size
SizeF textSize = grPhoto.MeasureString(text, font);
int textX = CalculatePosition(x, phWidth, (int) textSize.Width, xAlignment);
int textY = CalculatePosition(y, phHeight, (int) textSize.Height, yAlignment);
if (renderOver) DrawString(grPhoto, text, font, textX + 1, textY + 1, over);
DrawString(grPhoto, text, font, textX, textY, under);
outputImage = bmPhoto;
bmPhoto = null;
}
finally
{
if (grPhoto != null) grPhoto.Dispose();
if (bmPhoto != null) bmPhoto.Dispose();
}
}