private void addCell(Loop loop, int pos, int loopNo, int celNo) { byte width = fileData[pos]; byte height = fileData[pos + 1]; byte mirror = getLeftSide(fileData[pos + 2]); byte transparentColor = getRightSide(fileData[pos + 2]); bool isMirrored = mirror >> 3 == 1; if (isMirrored) isMirrored = (mirror - 8) != loopNo; Cel cel = new Cel(width, height, transparentColor, isMirrored); int i = 3; while (!cel.IsFinished()) { byte c = fileData[pos + i++]; if (c == 0) { cel.NextLine(); } else { byte color = getLeftSide(c); byte runLength = getRightSide(c); cel.AddChunk(color, runLength); } } loop.AddCell(cel, celNo); }
private void addLoop(int pos, int loopNo) { byte celCount = fileData[pos]; Loop loop = new Loop(celCount); loops[loopNo] = loop; for (int i = 0; i < celCount; i++) { int celPosition = fileData[pos + (i * 2) + 2] * 256 + fileData[pos + (i * 2) + 1]; addCell(loop, pos + celPosition, loopNo, i); } viewWidth = Math.Max(viewWidth, loop.width); viewHeight += loop.height; }