本文整理汇总了C#中SmoothingMode类的典型用法代码示例。如果您正苦于以下问题:C# SmoothingMode类的具体用法?C# SmoothingMode怎么用?C# SmoothingMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SmoothingMode类属于命名空间,在下文中一共展示了SmoothingMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:34,代码来源:GraphicsContainer.cs
示例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;
}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:28,代码来源:Overview.cs
示例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;
}
开发者ID:geobabbler,项目名称:SharpMap,代码行数:14,代码来源:BaseSymbolizer.cs
示例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());
}
开发者ID:28427328,项目名称:SQCharts,代码行数:9,代码来源:DSView.cs
示例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());
}
开发者ID:heber,项目名称:FreeOQ,代码行数:10,代码来源:DSView.cs
示例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;
}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:55,代码来源:ImageResizer.cs
示例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;
}
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:15,代码来源:FeatureSymbolizerOld.cs
示例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);
}
}
开发者ID:Cizall,项目名称:Tibialyzer,代码行数:52,代码来源:SummaryForm.cs
示例9: GraphicsQualityManager
public GraphicsQualityManager(Graphics g, bool setHighQuality = true)
{
this.g = g;
previousCompositingQuality = g.CompositingQuality;
previousInterpolationMode = g.InterpolationMode;
previousSmoothingMode = g.SmoothingMode;
if (setHighQuality)
{
SetHighQuality();
}
}
开发者ID:ElectronicWar,项目名称:ShareX,代码行数:13,代码来源:GraphicsQualityManager.cs
示例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;
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:19,代码来源:NuGenGrfxMode.cs
示例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;
}
开发者ID:piaolingzxh,项目名称:Justin,代码行数:18,代码来源:UseAntiAlias.cs
示例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;
}
开发者ID:Egoily,项目名称:CSharp-EAlbum,代码行数:18,代码来源:UseAntiAlias.cs
示例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;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:15,代码来源:ToolkitGraphicsBase.cs
示例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;
}
开发者ID:rrreese,项目名称:Utilities,代码行数:14,代码来源:ImageHelper.cs
示例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();
}
}
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:49,代码来源:Watermarker.cs
示例16: CreateCircle
/// <summary>
/// Rasterize a circle of specified radius in an image.
/// </summary>
/// <param name="radius"></param>
/// <param name="smoothingMode"></param>
/// <returns></returns>
public static Bitmap CreateCircle(int radius, SmoothingMode smoothingMode)
{
int size = Math.Max(2 * radius, 1);
Bitmap image = new Bitmap(size, size, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(image);
g.SmoothingMode = smoothingMode;
g.FillRectangle(Brushes.Black, 0, 0, size, size);
g.FillEllipse(Brushes.White, new RectangleF(
new PointF(-0.5f, -0.5f), new SizeF(size, size)));
g.Dispose();
return image;
}
开发者ID:bzamecnik,项目名称:bokehlab,代码行数:21,代码来源:CirclePSFGenerator.cs
示例17: InterpolationMode
public void 缩放图像Test()
{
Image 图像 = null; // TODO: 初始化为适当的值
int 指定宽度 = 0; // TODO: 初始化为适当的值
int 指定高度 = 0; // TODO: 初始化为适当的值
缩放方式 缩放方式 = new 缩放方式(); // TODO: 初始化为适当的值
InterpolationMode 插值算法 = new InterpolationMode(); // TODO: 初始化为适当的值
SmoothingMode 平滑模式 = new SmoothingMode(); // TODO: 初始化为适当的值
CompositingQuality 合成质量 = new CompositingQuality(); // TODO: 初始化为适当的值
Bitmap expected = null; // TODO: 初始化为适当的值
Bitmap actual;
actual = Drawing处理函数.缩放图像(图像, 指定宽度, 指定高度, 缩放方式, 插值算法, 平滑模式, 合成质量);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("验证此测试方法的正确性。");
}
开发者ID:manasheep,项目名称:Core3,代码行数:15,代码来源:Drawing处理函数Test.cs
示例18: Resize
private static Image Resize(Image originalImage, int newWidth, int newHeight, CompositingQuality compositingQuality, SmoothingMode smoothingMode, InterpolationMode interpolationMode, PixelOffsetMode pixelOffsetmode)
{
Image result = new Bitmap(newWidth, newHeight);
using (var graphic = Graphics.FromImage(result))
{
graphic.CompositingQuality = compositingQuality;
graphic.SmoothingMode = smoothingMode;
graphic.InterpolationMode = interpolationMode;
graphic.PixelOffsetMode = pixelOffsetmode;
Rectangle rectangle = new Rectangle(0, 0, newWidth, newHeight);
graphic.DrawImage(originalImage, rectangle);
return result;
}
}
开发者ID:an83,项目名称:KinectTouch2,代码行数:15,代码来源:ImageOperations.cs
示例19: CreateResizedImageFile
public static Stream CreateResizedImageFile(Stream originalStream, double x, double y, double q, bool allowStretching, ImageFormat outputFormat, SmoothingMode smoothingMode, InterpolationMode interpolationMode, PixelOffsetMode pixelOffsetMode)
{
if (originalStream == null)
return new MemoryStream(); ;
Stream stream;
using (Bitmap img = new Bitmap(originalStream))
{
// if the size of the original image is the same as the specified resizing size then we just return the original stream
if (img.Width == System.Convert.ToInt32(x) && img.Height == System.Convert.ToInt32(y)) return originalStream;
double iw = img.Width; double ih = img.Height;
double w = 0; double h = 0;
if (allowStretching)
{
w = (x == 0 ? img.Width : x);
h = (y == 0 ? img.Height : y);
}
else
{
GetRealXY(iw, ih, x, y, out w, out h);
}
Bitmap newimg;
if (w == 0 || h == 0)
{
newimg = new Bitmap(img);
}
else
{
newimg = new Bitmap(img, (int)w, (int)h);
using (Graphics gr = Graphics.FromImage(newimg))
{
gr.SmoothingMode = smoothingMode;
gr.InterpolationMode = interpolationMode;
gr.PixelOffsetMode = pixelOffsetMode;
gr.DrawImage(img, new Rectangle(0, 0, (int)w, (int)h));
}
}
stream = new MemoryStream();
newimg.Save(stream, outputFormat);
if (newimg != null)
newimg.Dispose();
}
stream.Position = 0;
return stream;
}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:48,代码来源:ImageResizer.cs
示例20: GdiResize
public static Bitmap GdiResize(Image photo, int width, int height,
InterpolationMode interpolationMode = InterpolationMode.HighQualityBicubic,
SmoothingMode smoothingMode = SmoothingMode.HighQuality,
PixelOffsetMode pixelMode = PixelOffsetMode.HighQuality,
CompositingQuality compositingQuality = CompositingQuality.HighQuality,
CompositingMode compositingMode = CompositingMode.SourceOver
)
{
var resized = new Bitmap(width, height);
using (var graphics = Graphics.FromImage(resized)) {
graphics.CompositingQuality = compositingQuality;
graphics.InterpolationMode = interpolationMode;
graphics.CompositingMode = compositingMode;
graphics.SmoothingMode = smoothingMode;
graphics.PixelOffsetMode = pixelMode;
graphics.DrawImage(photo, 0, 0, width, height);
}
return resized;
}
开发者ID:eakova,项目名称:resizer,代码行数:20,代码来源:Utils.cs
注:本文中的SmoothingMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论