internal static void UpdateImage( FrameHolder frameHolder, IEditable itemsBase, Pixel[,] pixels, ImageEditor imageEditor) { BitmapData data = frameHolder.Image.LockBits( new Rectangle(0, 0, frameHolder.Image.Width, frameHolder.Image.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); int stride = data.Stride; unsafe { for (int i = 0; i < itemsBase.FrameSize.FrameWidth; i++) { for (int j = 0; j < itemsBase.FrameSize.FrameHeight; j++) { Color col = PixelHelper.PixelColor(pixels[i, j]); if (frameHolder.Color[i, j] != col) { frameHolder.PreviewImage.SetPixel(i, j, col); frameHolder.Color[i, j] = col; imageEditor.DrawScaledPixel(i, j, col); } } } } frameHolder.Image.UnlockBits(data); }
internal Image GetFrame(int direction, int frame) { if (_frameHolder[direction, frame] == null) { _frameHolder[direction, frame] = new FrameHolder(_itemsBase.FrameSize); } if (_frameHolder[direction, frame].PreviewImage == null) { _frameHolder[direction, frame].PreviewImage = new Bitmap(64, 64); } return(_frameHolder[direction, frame].PreviewImage); }
private void CheckItem() { if (_frameHolder[_currentDirection, _currentFrame] != null) { _frameHolder[_currentDirection, _currentFrame].Check(_itemsBase.FrameSize); } else { _frameHolder[_currentDirection, _currentFrame] = new FrameHolder(_itemsBase.FrameSize); } if (FrameHolder.Image == null) { FrameHolder.Image = CreateDefaultImage(ImageWidth, ImageHeight); } if (FrameHolder.PreviewImage == null) { FrameHolder.PreviewImage = new Bitmap(64, 64); } }