private byte[][] RenderLCM(byte[][] vpmFrame) { var frame_count = LCMBufferPlanes.Count; byte[][] outplanes; outplanes = new byte[frame_count][]; if (SwitchMode == SwitchMode.LayeredColorMask) { for (int i = 0; i < vpmFrame.Length; i++) { outplanes[i] = vpmFrame[i]; } for (int i = vpmFrame.Length; i < frame_count; i++) { outplanes[i] = LCMBufferPlanes[i]; } } if (SwitchMode == SwitchMode.MaskedReplace) { if (LCMBufferPlanes[0].Length == vpmFrame[0].Length * 4) { if (ScalerMode == ScalerMode.Doubler) { vpmFrame = FrameUtil.Scale2(Width, Height, vpmFrame); } else { vpmFrame = FrameUtil.Scale2x(Width, Height, vpmFrame); } } for (int i = 0; i < frame_count; i++) { if (i < vpmFrame.Length) { outplanes[i] = FrameUtil.CombinePlaneWithMask(LCMBufferPlanes[i], vpmFrame[i], ReplaceMask); } else { outplanes[i] = LCMBufferPlanes[i]; } } } return(outplanes); }
private void OutputFrame(byte[][] vpmFrame) { switch (SwitchMode) { case SwitchMode.ColorMask: case SwitchMode.Follow: RenderColorMask(vpmFrame); break; case SwitchMode.FollowReplace: case SwitchMode.Replace: case SwitchMode.MaskedReplace: byte[][] outplanes; var animplanes = Frames[_frameIndex].PlaneData; if (SwitchMode != SwitchMode.MaskedReplace) { outplanes = animplanes; } else { var planecount = animplanes.Length; outplanes = new byte[planecount][]; for (int i = 0; i < planecount; i++) { if (i < vpmFrame.Length) { outplanes[i] = FrameUtil.CombinePlaneWithMask(animplanes[i], vpmFrame[i], FollowMask); } else { outplanes[i] = animplanes[i]; } } } _currentRender(outplanes); break; case SwitchMode.LayeredColorMask: RenderLCM(vpmFrame); break; } }