本文整理汇总了C#中InterpolationMode类的典型用法代码示例。如果您正苦于以下问题:C# InterpolationMode类的具体用法?C# InterpolationMode怎么用?C# InterpolationMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InterpolationMode类属于命名空间,在下文中一共展示了InterpolationMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ThumbnailSettings
private ThumbnailSettings(Size size, InterpolationMode interpolationMode, Color backColor, ThreadPriority threadPriority)
{
this.size = size;
this.interpolationMode = interpolationMode;
this.backColor = backColor;
this.threadPriority = threadPriority;
}
开发者ID:hazychill,项目名称:oog,代码行数:7,代码来源:ThumbnailSetting.cs
示例2: ApplyScaler
/// <summary>
/// Applies the GDI+ pixel scaler.
/// </summary>
/// <param name="type">The type of scaler to use.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="filterRegion">The filter region, if any.</param>
/// <returns>
/// The rescaled image.
/// </returns>
public cImage ApplyScaler(InterpolationMode type, int width, int height, Rectangle? filterRegion = null) {
if (!((IList<InterpolationMode>)INTERPOLATORS).Contains(type))
throw new NotSupportedException(string.Format("Interpolation mode '{0}' not supported.", type));
var startX = filterRegion == null ? 0 : Math.Max(0, filterRegion.Value.Left);
var startY = filterRegion == null ? 0 : Math.Max(0, filterRegion.Value.Top);
var endX = filterRegion == null ? this.Width : Math.Min(this.Width, filterRegion.Value.Right);
var endY = filterRegion == null ? this.Height : Math.Min(this.Height, filterRegion.Value.Bottom);
// run through scaler
var bitmap = new Bitmap(width, height);
using (var graphics = Graphics.FromImage(bitmap)) {
//set the resize quality modes to high quality
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = type;
graphics.SmoothingMode = SmoothingMode.HighQuality;
//draw the image into the target bitmap
//graphics.DrawImage(source, 0, 0, result.Width, result.Height);
// FIXME: this is a hack to prevent the microsoft bug from creating a white pixel on top and left border (see http://forums.asp.net/t/1031961.aspx/1)
graphics.DrawImage(filterRegion == null ? this.ToBitmap() : this.ToBitmap(startX, startY, endX - startX, endY - startY), -1, -1, bitmap.Width + 1, bitmap.Height + 1);
}
var result = FromBitmap(bitmap);
result.HorizontalOutOfBoundsMode = this.HorizontalOutOfBoundsMode;
result.VerticalOutOfBoundsMode = this.VerticalOutOfBoundsMode;
return (result);
}
开发者ID:Acecool,项目名称:2dimagefilter,代码行数:41,代码来源:Image.Resizer.Interpolation.cs
示例3: bicubicaToolStripMenuItem_Click
private void bicubicaToolStripMenuItem_Click(object sender, EventArgs e)
{
desativaOpcoes();
bicubicaToolStripMenuItem.Checked = true;
suavizacao = InterpolationMode.Bicubic;
refreshImages();
}
开发者ID:michaelrbk,项目名称:pixelart-vectorizer,代码行数:7,代码来源:Form1.cs
示例4: contextMenuFilterBicubic_Click
private void contextMenuFilterBicubic_Click(object sender, EventArgs e)
{
this.filter = InterpolationMode.Bicubic;
this.Invalidate();
this.contextMenuFilterNearest.Checked = this.contextMenuFilterBilinear.Checked = false;
this.contextMenuFilterBicubic.Checked = true;
}
开发者ID:nitroxis,项目名称:bz2terraineditor,代码行数:7,代码来源:ImageViewer.cs
示例5: Interpolate
/// <summary>
/// Interpolate between two values using the specified interpolation mode.
/// </summary>
/// <param name="from">The starting value to interpolate from.</param>
/// <param name="to">The end value to interpolate to.</param>
/// <param name="delta">The percentage of progress between the two. Ranges from 0.0 to 1.0 are acceptable.</param>
/// <param name="mode">The interpolation mode to used, specified by the InterpolationMode enum. ex: InterpolationMode.Sigmoid</param>
/// <returns>The current value between from and to based on the delta specified.</returns>
public static float Interpolate(float from, float to, float delta, InterpolationMode mode)
{
// return the results of different methods based on which mode is specified
if (mode == InterpolationMode.Linear)
{
// use linear for entire interpolation curve
return _InterpolateLinear(from, to, delta);
}
else if (mode == InterpolationMode.EaseInOut)
{
// use sigmoid for the entire interpolation curve
return _InterpolateSigmoid(from, to, delta);
}
else if (mode == InterpolationMode.EaseIn)
{
// use sigmoid for only the first half of the curve
if (delta <= 0.5f)
return _InterpolateSigmoid(from, to, delta);
else
return _InterpolateLinear(from, to, delta);
}
else if (mode == InterpolationMode.EaseOut)
{
// use sigmoid for only the last half of the curve
if (delta >= 0.5f)
return _InterpolateSigmoid(from, to, delta);
else
return _InterpolateLinear(from, to, delta);
}
// default to linear
return _InterpolateLinear(from, to, delta);
}
开发者ID:andrewstrauch,项目名称:The-Scarab-Gauntlet,代码行数:41,代码来源:Interpolation.cs
示例6: InterpolationModeGraphics
public InterpolationModeGraphics(
System.Drawing.Graphics graphics, InterpolationMode newMode)
{
_graphics = graphics;
_oldMode = graphics.InterpolationMode;
graphics.InterpolationMode = newMode;
}
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:7,代码来源:InterpolationModeGraphics.cs
示例7: PolynomialImageTransformer
public PolynomialImageTransformer(RegistrationDefinition registration, InterpolationMode interpolationMode, int polynomialDegree) : base(registration, interpolationMode)
{
List<PositionAssociation> associationList = registration.GetAssociationList();
TransformationStyle arg_15_0 = registration.warpStyle;
int num = associationList.Count;
if (num == 2)
{
num++;
}
JamaMatrix jamaMatrix = new JamaMatrix(num, 2);
JamaMatrix jamaMatrix2 = new JamaMatrix(num, 2);
for (int i = 0; i < num; i++)
{
LatLon latLon = (i == associationList.Count) ? PolynomialImageTransformer.getThirdPosition(associationList[0].sourcePosition.pinPosition.latlon, associationList[1].sourcePosition.pinPosition.latlon, true) : associationList[i].sourcePosition.pinPosition.latlon;
jamaMatrix.SetElement(i, 0, latLon.lon);
jamaMatrix.SetElement(i, 1, latLon.lat);
LatLon latLon2 = (i == associationList.Count) ? PolynomialImageTransformer.getThirdPosition(MercatorCoordinateSystem.LatLonToMercator(associationList[0].globalPosition.pinPosition.latlon), MercatorCoordinateSystem.LatLonToMercator(associationList[1].globalPosition.pinPosition.latlon), false) : MercatorCoordinateSystem.LatLonToMercator(associationList[i].globalPosition.pinPosition.latlon);
jamaMatrix2.SetElement(i, 0, latLon2.lon);
jamaMatrix2.SetElement(i, 1, latLon2.lat);
}
this.destMercatorToSourceTransformer = PolynomialImageTransformer.getPolyPointTransformer(jamaMatrix, jamaMatrix2, polynomialDegree);
this.sourceToDestMercatorTransformer_approximate = PolynomialImageTransformer.getApproximateInverterPolyPointTransformer(jamaMatrix, jamaMatrix2, polynomialDegree);
DownhillInverterPointTransformer flakyPointTransformer = new DownhillInverterPointTransformer(this.destMercatorToSourceTransformer, this.sourceToDestMercatorTransformer_approximate);
IPointTransformer sourceToMercator = new RobustPointTransformer(flakyPointTransformer, this.sourceToDestMercatorTransformer_approximate);
this.destLatLonToSourceTransformer = new LatLonToSourceTransform(this.destMercatorToSourceTransformer);
this.sourceToDestLatLonTransformer = new SourceToLatLonTransform(sourceToMercator);
}
开发者ID:mikhp,项目名称:greatmaps,代码行数:27,代码来源:PolynomialImageTransformer.cs
示例8: RenderQualityStyle
private RenderQualityStyle(string _styleName, InterpolationMode invokeImageInterpolationMode, InterpolationMode warpInterpolationMode, double hackyWarperAntialiasFactor)
{
this._styleName = _styleName;
this._invokeImageInterpolationMode = invokeImageInterpolationMode;
this._warpInterpolationMode = warpInterpolationMode;
this._hackyWarperAntialiasFactor = hackyWarperAntialiasFactor;
}
开发者ID:mikhp,项目名称:greatmaps,代码行数:7,代码来源:RenderQualityStyle.cs
示例9: ToBitmapHolderAsync
public async static Task<BitmapHolder> ToBitmapHolderAsync(this Stream imageStream, Tuple<int, int> downscale, bool useDipUnits, InterpolationMode mode)
{
if (imageStream == null)
return null;
using (IRandomAccessStream image = new RandomStream(imageStream))
{
if (downscale != null && (downscale.Item1 > 0 || downscale.Item2 > 0))
{
using (var downscaledImage = await image.ResizeImage(downscale.Item1, downscale.Item2, mode, useDipUnits).ConfigureAwait(false))
{
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(downscaledImage);
PixelDataProvider pixelDataProvider = await decoder.GetPixelDataAsync();
var bytes = pixelDataProvider.DetachPixelData();
int[] array = new int[decoder.PixelWidth * decoder.PixelHeight];
CopyPixels(bytes, array);
return new BitmapHolder(array, (int)decoder.PixelWidth, (int)decoder.PixelHeight);
}
}
else
{
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(image);
PixelDataProvider pixelDataProvider = await decoder.GetPixelDataAsync();
var bytes = pixelDataProvider.DetachPixelData();
int[] array = new int[decoder.PixelWidth * decoder.PixelHeight];
CopyPixels(bytes, array);
return new BitmapHolder(array, (int)decoder.PixelWidth, (int)decoder.PixelHeight);
}
}
}
开发者ID:nukedbit,项目名称:FFImageLoading,代码行数:34,代码来源:ImageExtensions.cs
示例10: AnimationController
/// <summary>Initializes a new instance of the
/// <see cref="T:XNAnimation.Controllers.AnimationController" />
/// class.
/// </summary>
/// <param name="skeleton">The skeleton of the model to be animated</param>
public AnimationController(SkinnedModelBoneCollection skeleton)
{
this.skeleton = skeleton;
localBonePoses = new Pose[skeleton.Count];
skinnedBoneTransforms = new Matrix[skeleton.Count];
skeleton[0].CopyBindPoseTo(localBonePoses);
time = TimeSpan.Zero;
speed = 1.0f;
loopEnabled = true;
playbackMode = PlaybackMode.Forward;
blendWeight = 1.0f;
translationInterpolation = InterpolationMode.None;
orientationInterpolation = InterpolationMode.None;
scaleInterpolation = InterpolationMode.None;
crossFadeEnabled = false;
crossFadeInterpolationAmount = 0.0f;
crossFadeTime = TimeSpan.Zero;
crossFadeElapsedTime = TimeSpan.Zero;
hasFinished = false;
isPlaying = false;
}
开发者ID:blackEagle2012,项目名称:XNA-Game-project,代码行数:31,代码来源:AnimationController.cs
示例11: CreateThumbnail
/// <summary>
/// Creates a scaled thumbnail.
/// </summary>
/// <param name="width">The maximum width of the thumbnail to create.</param>
/// <param name="height">The maximum height of the thumbnail to create.</param>
/// <param name="interpolationMode">The Interpolation of the thumbnailing (HighQualityBicubic provides best quality)</param>
/// <returns>A bitmap thumbnail of the source image.</returns>
public static Bitmap CreateThumbnail(Bitmap aBitmap, int width, int height, InterpolationMode interpolationMode)
{
//Calculate scales
float x = ((float)aBitmap.Width / (float)width);
float y = ((float)aBitmap.Height / (float)height);
float factor = Math.Max(x, y);
if (factor < 1)
factor = 1;
int thWidth = (int)Math.Round((aBitmap.Width / factor), 0);
int thHeight = (int)Math.Round((aBitmap.Height / factor), 0);
// Set the size of the target image
Bitmap bmpTarget = new Bitmap(thWidth, thHeight);
Graphics grfxThumb = Graphics.FromImage(bmpTarget);
grfxThumb.InterpolationMode = interpolationMode;
// Draw the original image to the target image
grfxThumb.DrawImage(aBitmap, new Rectangle(0, 0, thWidth, Convert.ToInt32(thWidth * aBitmap.Height / aBitmap.Width)));
grfxThumb.Dispose();
return bmpTarget;
}
开发者ID:huanlin,项目名称:YetAnotherLibrary,代码行数:32,代码来源:ImageHelper.cs
示例12: KaMagnify
public static Image KaMagnify(
this Image self,
int rate,
InterpolationMode im = InterpolationMode.Default)
{
if ( !self.KaIs() )
{
return null;
}
var src = self.Clone() as Image;
var w = src.Width * rate;
var h = src.Height * rate;
var res = new Bitmap( w, h );
Graphics g = null;
using ( g = Graphics.FromImage( res ) )
{
g.InterpolationMode = im;
g.DrawImage( src, 0, 0, w, h );
}
return res;
}
开发者ID:kathar,项目名称:KaLibCs,代码行数:25,代码来源:KaExtensionForImage.cs
示例13: ScaleByPercent
public static Image ScaleByPercent(Image imgPhoto, int Percent, InterpolationMode interpolationMode)
{
float nPercent = ((float)Percent / 100);
int sourceWidth = imgPhoto.Width;
int sourceHeight = imgPhoto.Height;
int sourceX = 0;
int sourceY = 0;
int destX = 0;
int destY = 0;
int destWidth = (int)(sourceWidth * nPercent);
int destHeight = (int)(sourceHeight * nPercent);
Bitmap bmPhoto = new Bitmap(destWidth, destHeight,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
bmPhoto.SetResolution(imgPhoto.HorizontalResolution,
imgPhoto.VerticalResolution);
Graphics grPhoto = Graphics.FromImage(bmPhoto);
grPhoto.InterpolationMode = interpolationMode;
//int memoryMB = (int)(Process.GetCurrentProcess().PagedMemorySize64 / (1024 * 1024));
grPhoto.DrawImage(imgPhoto,
new Rectangle(destX, destY, destWidth, destHeight),
new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight),
GraphicsUnit.Pixel);
grPhoto.Dispose();
return bmPhoto;
}
开发者ID:ctapang,项目名称:GPUCyclops,代码行数:32,代码来源:ImageLib.cs
示例14: InterpolationModeGraphics
public InterpolationModeGraphics(
Graphics graphics, InterpolationMode newMode)
{
_graphics = graphics;
_oldMode = graphics.InterpolationMode;
graphics.InterpolationMode = newMode;
}
开发者ID:panshuiqing,项目名称:winform-ui,代码行数:7,代码来源:InterpolationModeGraphics.cs
示例15: LinearScroll
public LinearScroll(Vector2 position, Vector2 target, float duration, InterpolationMode mode = InterpolationMode.Linear)
{
_InitialPoint = position;
_TargetPoint = target;
_Method = Interpolate.GetMethod(mode);
_Duration = duration;
}
开发者ID:impworks,项目名称:xna.geek.engine,代码行数:7,代码来源:LinearScroll.cs
示例16: Tweener
public Tweener(float from, float to, float time, InterpolationMode mode = InterpolationMode.Linear)
{
_From = from;
_To = to;
_DesiredTime = time;
_Method = Interpolate.GetMethod(mode);
}
开发者ID:impworks,项目名称:xna.geek.engine,代码行数:7,代码来源:Tweener.cs
示例17: 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
示例18: TextureBrush
public TextureBrush(Texture texture)
{
IsAsync = texture.IsAsync;
disposeTexture = false;
this.texture = texture;
Color = Color4.White;
InterpolationMode = InterpolationMode.Default;
}
开发者ID:Artentus,项目名称:GameUtils,代码行数:9,代码来源:TextureBrush.cs
示例19: FontState
public FontState(Font f, char g, InterpolationMode i, int r, string file)
{
font = f;
glyph = g;
interpolation = i;
range = r;
filename = file;
s.Start();
}
开发者ID:czaloj,项目名称:signed-distance-field-font-generator,代码行数:9,代码来源:Form1.cs
示例20: Resize
public void Resize(int width, int height, InterpolationMode mode = InterpolationMode.Bicubic)
{
Bitmap tmp = new Bitmap(width, height);
Graphics g = Graphics.FromImage(tmp);
g.InterpolationMode = mode;
g.DrawImage(Image, 0, 0, width, height);
Image.Dispose();
Image = tmp;
}
开发者ID:cube-soft,项目名称:CubeImageResize,代码行数:9,代码来源:resize.cs
注:本文中的InterpolationMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论