本文整理汇总了C#中Bitmap.DrawEllipse方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.DrawEllipse方法的具体用法?C# Bitmap.DrawEllipse怎么用?C# Bitmap.DrawEllipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitmap
的用法示例。
在下文中一共展示了Bitmap.DrawEllipse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderEllipse
protected internal override void RenderEllipse(Bitmap bmp, Pen pen, int x, int y, int xRadius, int yRadius)
{
Color outlineColor = (pen != null) ? pen.Color : (Color)0x0;
ushort outlineThickness = (pen != null) ? pen.Thickness : (ushort)0;
bmp.DrawEllipse(outlineColor, outlineThickness, x, y, xRadius, yRadius,
Color, 0, 0, Color, 0, 0, Opacity);
}
示例2: BitmapStressTest_StretchImage
public MFTestResults BitmapStressTest_StretchImage()
{
MFTestResults result = MFTestResults.Fail;
ArrayList bitmaps = new ArrayList();
Log.Comment("Allocate as many bitmaps as possible");
try
{
while (true)
{
Bitmap bmp = new Bitmap(width, height);
bmp.DrawLine(Color.White, 5, 0, 0, bmp.Width, bmp.Height);
bmp.DrawEllipse(Color.White, 4, 50, 50, 40, 11, Color.White, 0, 0, Color.Black, bmp.Width, bmp.Height, 5);
bitmaps.Add(bmp);
window.StretchImage(0, 0, bmp, width, height, 0xFF);
window.Flush();
}
}
catch (OutOfMemoryException e)
{
Log.Comment("Correctly threw exception: " + e.ToString());
result = MFTestResults.Pass;
}
finally
{
foreach (Bitmap b in bitmaps)
{
b.Dispose();
}
Debug.GC(true);
System.Threading.Thread.Sleep(500);
}
Log.Comment("Total Bitmap count = " + bitmaps.Count.ToString());
return result;
}
示例3: BitmapSuperStressTest_StretchImage
public MFTestResults BitmapSuperStressTest_StretchImage()
{
MFTestResults result = MFTestResults.Pass;
ArrayList bitmaps = new ArrayList();
Random random = new Random();
Log.Comment("Allocate as many bitmaps as possible");
for (int i = 0; i < 10; ++i)
{
try
{
while (true)
{
Bitmap bmp = new Bitmap(width, height);
bmp.DrawLine(Color.White, 5, 0, 0, bmp.Width, bmp.Height);
bmp.DrawEllipse(Color.White, 4, 50, 50, 40, 11, Color.White, 0, 0, Color.Black, bmp.Width, bmp.Height, 5);
bitmaps.Add(bmp);
window.StretchImage(0, 0, bmp, width, height, 0xFF);
window.Flush();
}
}
catch (OutOfMemoryException)
{
while (bitmaps.Count > 2)
bitmaps.RemoveAt(random.Next(bitmaps.Count));
}
catch (Exception e)
{
Log.Comment("Incorrect exception caught: " + e.ToString());
result = MFTestResults.Fail;
}
finally
{
foreach (Bitmap b in bitmaps)
{
b.Dispose();
}
}
Debug.GC(true);
System.Threading.Thread.Sleep(500);
}
Log.Comment("Total Bitmap count = " + bitmaps.Count.ToString());
return result;
}
示例4: LargeBitmapTest
public MFTestResults LargeBitmapTest()
{
MFTestResults result = MFTestResults.Fail;
ScreenSize[] pairs = new ScreenSize[] {
new ScreenSize( 160, 120 ), // QQVGA
new ScreenSize( 240, 160 ), // HQVGA
new ScreenSize( 320, 240 ), // QVGA
new ScreenSize( 480, 320 ), // HVGA
new ScreenSize( 640, 240 ), // HVGA
new ScreenSize( 864, 480 ), // FWVGA
new ScreenSize( 640, 480 ), // VGA
new ScreenSize( 800, 480 ), // WVGA
new ScreenSize( 848, 480 ), // WVGA
new ScreenSize( 854, 480 ), // WVGA
//new ScreenSize( 1024, 768 ), // XVGA
//new ScreenSize( 1152, 864 ), // XVGA+
//new ScreenSize( 1280, 1024 ), // SXGA
//new ScreenSize( 1400, 1050 ), // SXGA+
//new ScreenSize( 1600, 1200 ), // UXGA
};
Bitmap bmp = null;
try
{
foreach (ScreenSize p in pairs)
{
try
{
// the CLR's limit of allocation in the managed heap is sizeof(CLR_RT_HeapBlock) * (2^16) = 768432 bytes.
// To that one needs to subtract the size of an heap cluster (sizeof(CLR_RT_heapCluster)) and
// round to the number of heap blocks in the remaining amount, since the CLR allocated in heap blocks units.
// Thus some allocation (e.g. 800x600) must go in the unmanaged SimpleHeap if supported.
bmp = new Bitmap(p.width, p.height);
}
catch (OutOfMemoryException)
{
//SimpleHeap has no legitimate API to distinguish between no implementation
//or implemented but out-of-memory condition occurred. If OOM is thrown, assume
//it is because no SimpleHeap was provided.
// On the emulator though, we know it is implemented
if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3)
{
return MFTestResults.Fail;
}
}
bmp.DrawLine(Color.White, 5, 0, 0, bmp.Width, bmp.Height);
bmp.DrawEllipse(Color.White, 4, 50, 50, 40, 11, Color.White, 0, 0, Color.Black, bmp.Width, bmp.Height, 5);
window.StretchImage(0, 0, bmp, width, height, 0xFF);
window.Flush();
bmp.Dispose(); bmp = null; // this is particlarly needed for the allocation in the non-managed heap
}
result = MFTestResults.Pass;
}
finally
{
if (bmp != null)
{
bmp.Dispose();
}
Debug.GC(true);
System.Threading.Thread.Sleep(500);
}
return result;
}