本文整理汇总了C#中Surface.IsRowVisible方法的典型用法代码示例。如果您正苦于以下问题:C# Surface.IsRowVisible方法的具体用法?C# Surface.IsRowVisible怎么用?C# Surface.IsRowVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surface
的用法示例。
在下文中一共展示了Surface.IsRowVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawText
private unsafe void DrawText(Surface dst, Font textFont, string text, Point pt, Size measuredSize, bool antiAliasing, Surface brush8x8)
{
Point pt2 = pt;
Size measuredSize2 = measuredSize;
int offset = (int)textFont.Height;
pt.X -= offset;
measuredSize.Width += 2 * offset;
Rectangle dstRect = new Rectangle(pt, measuredSize);
Rectangle dstRectClipped = Rectangle.Intersect(dstRect, ScratchSurface.Bounds);
if (dstRectClipped.Width == 0 || dstRectClipped.Height == 0)
{
return;
}
// We only use the first 8,8 of brush
using (RenderArgs renderArgs = new RenderArgs(this.ScratchSurface))
{
renderArgs.Graphics.FillRectangle(Brushes.White, pt.X, pt.Y, measuredSize.Width, measuredSize.Height);
if (measuredSize.Width > 0 && measuredSize.Height > 0)
{
using (Surface s2 = renderArgs.Surface.CreateWindow(dstRectClipped))
{
using (RenderArgs renderArgs2 = new RenderArgs(s2))
{
SystemLayer.Fonts.DrawText(
renderArgs2.Graphics,
this.font,
text,
new Point(dstRect.X - dstRectClipped.X + offset, dstRect.Y - dstRectClipped.Y),
AppEnvironment.AntiAliasing,
AppEnvironment.FontSmoothing);
}
}
}
// Mask out anything that isn't within the user's clip region (selected region)
using (PdnRegion clip = Selection.CreateRegion())
{
clip.Xor(renderArgs.Surface.Bounds); // invert
clip.Intersect(new Rectangle(pt, measuredSize));
renderArgs.Graphics.FillRegion(Brushes.White, clip.GetRegionReadOnly());
}
int skipX;
if (pt.X < 0)
{
skipX = -pt.X;
}
else
{
skipX = 0;
}
int xEnd = Math.Min(dst.Width, pt.X + measuredSize.Width);
bool blending = AppEnvironment.AlphaBlending;
if (dst.IsColumnVisible(pt.X + skipX))
{
for (int y = pt.Y; y < pt.Y + measuredSize.Height; ++y)
{
if (!dst.IsRowVisible(y))
{
continue;
}
ColorBgra *dstPtr = dst.GetPointAddressUnchecked(pt.X + skipX, y);
ColorBgra *srcPtr = ScratchSurface.GetPointAddress(pt.X + skipX, y);
ColorBgra *brushPtr = brush8x8.GetRowAddressUnchecked(y & 7);
for (int x = pt.X + skipX; x < xEnd; ++x)
{
ColorBgra srcPixel = *srcPtr;
ColorBgra dstPixel = *dstPtr;
ColorBgra brushPixel = brushPtr[x & 7];
int alpha = ((255 - srcPixel.R) * brushPixel.A) / 255; // we could use srcPixel.R, .G, or .B -- the choice here is arbitrary
brushPixel.A = (byte)alpha;
if (srcPtr->R == 255) // could use R, G, or B -- arbitrary choice
{
// do nothing -- leave dst alone
}
else if (alpha == 255 || !blending)
{
// copy it straight over
*dstPtr = brushPixel;
}
else
{
// do expensive blending
*dstPtr = UserBlendOps.NormalBlendOp.ApplyStatic(dstPixel, brushPixel);
}
++dstPtr;
++srcPtr;
}
//.........这里部分代码省略.........