public static createBitmap ( int width, int height ) : |
||
width | int | |
height | int | |
Résultat |
/**************************************************/ /* constructors */ /**************************************************/ public ColorDlgPicker() { SetStyle(ControlStyles.UserMouse, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); bmpDisplay = Render.createBitmap(256, 256); Cursor = Cursors.Cross; }
private unsafe void paint(Graphics g) { const int BLACK = unchecked ((int)0xFF000000); g.PixelOffsetMode = PixelOffsetMode.Half; g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; Bitmap bmp = Render.createBitmap(16, 16); using (pr2.IRenderImage img = pr2.RenderImage.LockBitmap(bmp)) { if (TileSourceType == SourceType.Vsp) { if (active_tile != null) { if (!bAnimate) { Render.render(img, 0, 0, active_tile.Image, true); } else { int frame = Global.FrameCalc.getframe(atx); Render.render(img, 0, 0, Global.ActiveMap.vsp.GetTile(frame).Image, true); } } else { img.Clear(BLACK); } } else { if (active_obstile != null) { Render.renderObsTile(img, 0, 0, active_obstile.Image, true, Preferences.Current.ObsColor); } else { img.Clear(BLACK); } } } g.DrawImage(bmp, 0, 0, Width, Height); bmp.Dispose(); }