当前位置: 首页>>代码示例>>C#>>正文


C# Bitmap.Dispose方法代码示例

本文整理汇总了C#中Microsoft.SPOT.Bitmap.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.Dispose方法的具体用法?C# Bitmap.Dispose怎么用?C# Bitmap.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.SPOT.Bitmap的用法示例。


在下文中一共展示了Bitmap.Dispose方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClearSimple

        public static void ClearSimple(string stringtoclear, uint x, uint y)
        {
            int withString = 0;
            int heightString = 0;
            Font font = Resources.GetFont(Resources.FontResources.small);
            font.ComputeExtent(stringtoclear, out withString, out heightString);

            Bitmap textBmp = new Bitmap(withString, heightString);
            Screen.Draw(textBmp, x, y);
            textBmp.Dispose();
        }
开发者ID:Rhesos,项目名称:SDKGadgeteer,代码行数:11,代码来源:ConsoleDisplayN18.cs

示例2: DrawString

 static public void DrawString(Font font, String text, int x, int y, UInt32 text_color, UInt32 back_color)
 {
     int width = 0;
     for (int i = 0; i < text.Length; i++)
     {
         width+=font.CharWidth((char)(text[i]));
     }
     Bitmap bmp = new Bitmap(width, font.Height);
     bmp.DrawRectangle((Microsoft.SPOT.Presentation.Media.Color)back_color, 100, 0, 0, width, font.Height, 0, 0, (Microsoft.SPOT.Presentation.Media.Color)back_color, 0, 0, (Microsoft.SPOT.Presentation.Media.Color)back_color, 0, 0, 0);
     bmp.DrawText(text, font, (Microsoft.SPOT.Presentation.Media.Color)text_color, 0, 0);
     Image imge = new Image(bmp); // Note: Maybe out of memory here
     DrawImage(imge, x, y);
     bmp.Dispose();
     bmp = null;
     imge.Dispose();
     imge = null;
 }
开发者ID:richoxski,项目名称:netmf-community-ports,代码行数:17,代码来源:Display.cs

示例3: DrawPoly


//.........这里部分代码省略.........
                    br.X = (br.X < points[i].X) ? points[i].X : br.X;
                    br.Y = (br.Y < points[i].Y) ? points[i].Y : br.X;
                }

                // adjust binding box to fit thick border. Foê some reason SPOT.Bitmap double the border width (at least on emulator)
                if (borderWidth > 1)
                {
                    tl.X = (short)((tl.X > borderWidth) ? tl.X - borderWidth * 2 : 0);
                    tl.Y = (short)((tl.Y > borderWidth) ? tl.Y - borderWidth * 2 : 0);
                    br.X = (short)((br.X + borderWidth < (screen.Width - 1)) ? br.X + borderWidth * 1.5 : 0);
                    br.Y = (short)((br.Y + borderWidth < (screen.Width - 1)) ? br.Y + borderWidth * 1.5 : 0);
                }

                // we need separate bitmap to draw poly as one specififed can have some drawing already and we won't be able to detect border properly
                Bitmap buffer = new Bitmap((br.X - tl.X + 1), (br.Y - tl.Y + 1));

                // fill bitmap with color opposite to border color
                if (borderColor == Color.Black)
                    buffer.DrawRectangle(Color.White, 0, 0, 0, buffer.Width, buffer.Height, 0, 0, Color.White, 0, 0, Color.White, buffer.Width, buffer.Height, 0xFF);
                else
                    buffer.DrawRectangle(Color.Black, 0, 0, 0, buffer.Width, buffer.Height, 0, 0, Color.Black, 0, 0, Color.Black, buffer.Width, buffer.Height, 0xFF);

                _DrawUnfilledPoly(buffer, points, borderColor, borderWidth, tl);

                // scan created bitmap
                bool isInside = false, onBorder = false;
                int startX = -1, borderStart = -1;
                for (int y = 0; y < buffer.Height; ++y)
                {
                    isInside = false;
                    onBorder = false;
                    startX = -1;
                    borderStart = -1;
                    for (int x = 0; x < buffer.Width; ++x)
                    {
                        if (buffer.GetPixel(x, y) == borderColor)
                        {
                            if (onBorder)
                            {
                                // still on border
                                screen.SetPixel(x + tl.X, y + tl.Y, borderColor);
                            }
                            else
                            {
                                // we have reached border from inside/outside
                                if (isInside)
                                {
                                    //isInside = false;
                                    if (startX >= 0)
                                    {
                                        // draw pattern line
                                        for (int k = startX; k < x; ++k)
                                        {
                                            if (polyFill == PolyFill.POLYFILL_SOLID) screen.SetPixel(k + tl.X, y + tl.Y, fgColor);
                                            else if (polyFill == PolyFill.POLYFILL_HORIZONTAL)
                                                screen.SetPixel(k + tl.X, y + tl.Y, (polyfill_horizontal[k % 3 + 3 * (y % 3)] == 0xFF) ? fgColor : bgColor);
                                            else if (polyFill == PolyFill.POLYFILL_HORIZONTAL)
                                                screen.SetPixel(k + tl.X, y + tl.Y, (polyfill_horizontal[k % 3 + 3 * (y % 3)] == 0xFF) ? fgColor : bgColor);
                                            else if (polyFill == PolyFill.POLYFILL_VERTICAL)
                                                screen.SetPixel(k + tl.X, y + tl.Y, (polyfill_vertical[k % 3 + 3 * (y % 3)] == 0xFF) ? fgColor : bgColor);
                                            else if (polyFill == PolyFill.POLYFILL_DOTS)
                                                screen.SetPixel(k + tl.X, y + tl.Y, (polyfill_dots[k % 3 + 3 * (y % 3)] == 0xFF) ? fgColor : bgColor);
                                            else if (polyFill == PolyFill.POLYFILL_GRID)
                                                screen.SetPixel(k + tl.X, y + tl.Y, (polyfill_grid[k % 3 + 3 * (y % 3)] == 0xFF) ? fgColor : bgColor);
                                            else if (polyFill == PolyFill.POLYFILL_CROSS_LEFT)
                                                screen.SetPixel(k + tl.X, y + tl.Y, (polyfill_cross_left[k % 3 + 3 * (y % 3)] == 0xFF) ? fgColor : bgColor);
                                            else if (polyFill == PolyFill.POLYFILL_CROSS_RIGHT)
                                                screen.SetPixel(k + tl.X, y + tl.Y, (polyfill_cross_right[k % 3 + 3 * (y % 3)] == 0xFF) ? fgColor : bgColor);

                                        }
                                        startX = -1;
                                    }
                                }
                                onBorder = true;
                                borderStart = x;
                                screen.SetPixel(x + tl.X, y + tl.Y, borderColor);
                            }
                        }
                        else
                        {
                            if (onBorder)
                            {
                                // end of border
                                if (!((x - borderStart) > borderWidth * 4))
                                    // if long this is not border, this is poly edge - we are still on the same side
                                    isInside = !isInside;

                                onBorder = false;
                                borderStart = -1;
                                if (isInside)
                                    startX = x;
                            }

                        }
                    }
                }
                buffer.Dispose();
            }

        }
开发者ID:nothingmn,项目名称:WP8-Running.AGENT,代码行数:101,代码来源:Drawing.cs

示例4: WriteSimple

        public static void WriteSimple(string str, uint x, uint y)
        {
            int withString = 0;
            int heightString = 0;
            Font font = Resources.GetFont(Resources.FontResources.small);
            font.ComputeExtent(str, out withString, out heightString);

            Bitmap textBmp = new Bitmap(withString, heightString);
            //textBmp.DrawRectangle(GT.Color.White, 1, 0, 0, 75, 12, 0, 0, GT.Color.White, 0, 0, GT.Color.White, 75, 12, 0xFF);
            textBmp.DrawText(str, font, GT.Color.White, 0, 0);
            Screen.Draw(textBmp, x, y);
            textBmp.Dispose();
        }
开发者ID:Rhesos,项目名称:SDKGadgeteer,代码行数:13,代码来源:ConsoleDisplayN18.cs

示例5: WriteLine

 private void WriteLine(string str, uint x,uint y)
 {
     uint size = 15;
     Bitmap textBmp = new Bitmap((int)_Screen.Width, (int)size);
     //textBmp.DrawRectangle(GT.Color.White, 1, 0, 0, 75, 12, 0, 0, GT.Color.White, 0, 0, GT.Color.White, 75, 12, 0xFF);
     textBmp.DrawText(str, _FontItem, GT.Color.White, 0, 0);
     _Screen.Draw(textBmp, x, y);
     textBmp.Dispose();
 }
开发者ID:Rhesos,项目名称:SDKGadgeteer,代码行数:9,代码来源:Menu.cs

示例6: WriteLineSelected

 private void WriteLineSelected(string str, uint x, uint y)
 {
     int size = 15;
     Bitmap textBmp = new Bitmap((int)_Screen.Width, (int)size);
     textBmp.DrawRectangle(GT.Color.White, 0, 0, 0, (int)_Screen.Width, size, 0, 0, GT.Color.White, 0, 0, GT.Color.White, 0, 0, 0xFF);
     textBmp.DrawText(str, _FontTitle, GT.Color.Black, 0, 0);
     _Screen.Draw(textBmp, x, y);
     textBmp.Dispose();
 }
开发者ID:Rhesos,项目名称:SDKGadgeteer,代码行数:9,代码来源:Menu.cs


注:本文中的Microsoft.SPOT.Bitmap.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。