本文整理汇总了C#中Cairo.ImageSurface.GetBilinearSampleWrapped方法的典型用法代码示例。如果您正苦于以下问题:C# ImageSurface.GetBilinearSampleWrapped方法的具体用法?C# ImageSurface.GetBilinearSampleWrapped怎么用?C# ImageSurface.GetBilinearSampleWrapped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.ImageSurface
的用法示例。
在下文中一共展示了ImageSurface.GetBilinearSampleWrapped方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public unsafe override void Render(ImageSurface src, ImageSurface dst, Gdk.Rectangle[] rois)
{
ColorBgra colPrimary = PintaCore.Palette.PrimaryColor.ToColorBgra ();
ColorBgra colSecondary = PintaCore.Palette.SecondaryColor.ToColorBgra ();
ColorBgra colTransparent = ColorBgra.Transparent;
int aaSampleCount = Data.Quality * Data.Quality;
Cairo.PointD* aaPoints = stackalloc Cairo.PointD[aaSampleCount];
Utility.GetRgssOffsets (aaPoints, aaSampleCount, Data.Quality);
ColorBgra* samples = stackalloc ColorBgra[aaSampleCount];
TransformData td;
foreach (Gdk.Rectangle rect in rois) {
for (int y = rect.Top; y < rect.Bottom; y++) {
ColorBgra* dstPtr = dst.GetPointAddressUnchecked (rect.Left, y);
double relativeY = y - Data.CenterOffset.Y;
for (int x = rect.Left; x < rect.Right; x++) {
double relativeX = x - Data.CenterOffset.X;
int sampleCount = 0;
for (int p = 0; p < aaSampleCount; ++p) {
td.X = relativeX + aaPoints[p].X;
td.Y = relativeY - aaPoints[p].Y;
InverseTransform (ref td);
float sampleX = (float)(td.X + Data.CenterOffset.X);
float sampleY = (float)(td.Y + Data.CenterOffset.Y);
ColorBgra sample = colPrimary;
if (IsOnSurface (src, sampleX, sampleY)) {
sample = src.GetBilinearSample (sampleX, sampleY);
} else {
switch (Data.EdgeBehavior) {
case WarpEdgeBehavior.Clamp:
sample = src.GetBilinearSampleClamped (sampleX, sampleY);
break;
case WarpEdgeBehavior.Wrap:
sample = src.GetBilinearSampleWrapped (sampleX, sampleY);
break;
case WarpEdgeBehavior.Reflect:
sample = src.GetBilinearSampleClamped (ReflectCoord (sampleX, src.Width), ReflectCoord (sampleY, src.Height));
break;
case WarpEdgeBehavior.Primary:
sample = colPrimary;
break;
case WarpEdgeBehavior.Secondary:
sample = colSecondary;
break;
case WarpEdgeBehavior.Transparent:
sample = colTransparent;
break;
case WarpEdgeBehavior.Original:
sample = src.GetColorBgra (x, y);
break;
default:
break;
}
}
samples[sampleCount] = sample;
++sampleCount;
}
*dstPtr = ColorBgra.Blend (samples, sampleCount);
++dstPtr;
}
}
}
}