} //end SplitFromImage32 public bool SplitFromImage32(ref GBuffer gbSrc, int iCellWidth, int iCellHeight, int iRows, int iColumns, IPoint ipAsCellSpacing, IZone izoneAsMargins) { bool bGood = true; lFrames = (long)iRows * (long)iColumns; lFramesCached = lFrames; //so cached anim will be accessed string sVerbNow = "creating GBuffer array"; try { gbarrAnim = new GBuffer[lFrames]; sVerbNow = "creating internal Bitmap"; bmpLoaded = new Bitmap(iCellWidth, iCellHeight, PixelFormatNow()); sVerbNow = "creating frame buffers"; for (int lFrameX = 0; lFrameX < lFrames; lFrameX++) { sVerbNow = "creating frame buffer " + lFrameX.ToString(); gbarrAnim[lFrameX] = new GBuffer(iCellWidth, iCellHeight, 4); //assumes 32-bit } sVerbNow = "creating markers"; if (ipAsCellSpacing == null) { ipAsCellSpacing = new IPoint(); } if (izoneAsMargins == null) { izoneAsMargins = new IZone(); } long lFrameLoad = 0; GotoFrame(lFrameLoad); sVerbNow = "checking gbFrame"; gbFrame.pxarrData = gbFrame.pxarrData; sVerbNow = "calculating values for markers"; int iSrcOfCellTopLeft = izoneAsMargins.top * gbSrc.iWidth + izoneAsMargins.left; int iSrcOfCellNow; int iSrc; int iDest; int iHeight = gbFrame.iHeight; int iCellOffsetX = (iCellWidth + ipAsCellSpacing.X); int iCellOffsetY = gbSrc.iWidth * (iCellHeight + ipAsCellSpacing.Y); sVerbNow = "checking gbFrame"; bool bColor = (gbFrame.pxarrData != null && gbSrc.pxarrData != null); bool bMask = (gbFrame.rarrData != null && gbSrc.rarrData != null); sVerbNow = "starting first cell"; for (int yCell = 0; yCell < iRows; yCell++) { for (int xCell = 0; xCell < iColumns; xCell++) { iDest = 0; iSrcOfCellNow = iSrcOfCellTopLeft + yCell * iCellOffsetY + xCell * iCellOffsetX; iSrc = iSrcOfCellNow; sVerbNow = "Going to frame " + lFrameLoad.ToString(); GotoFrame(lFrameLoad); sVerbNow = "reading lines"; for (int iLine = 0; iLine < iHeight; iLine++) { int iDestNow = iDest; int iSrcNow = iSrc; for (int iNow = 0; iNow < gbFrame.iWidth; iNow++) //debug performance (eliminate iNow) { if (bColor) { sVerbNow = "accessing pixels"; //gbFrame.pxarrData[iDestNow]=gbSrc.pxarrData[iSrcNow];//debug performance--allow fast pointer copy (this commented line) gbFrame.pxarrData[iDestNow].Y = gbSrc.pxarrData[iSrcNow].Y; gbFrame.pxarrData[iDestNow].H = gbSrc.pxarrData[iSrcNow].H; gbFrame.pxarrData[iDestNow].S = gbSrc.pxarrData[iSrcNow].S; } if (bMask) { gbFrame.rarrData[iDestNow] = gbSrc.rarrData[iSrcNow]; } iDestNow++; iSrcNow++; } iDest += gbFrame.iWidth; iSrc += gbSrc.iWidth; } sVerbNow = "finished frame"; lFrameLoad++; } } bGood = true; lFramesCached = lFrames; } catch (Exception exn) { RReporting.ShowExn(exn, "SplitFromImage32", "splitting (" + ((gbSrc == null)?"null":"non-null " + gbSrc.Description()) + ") image with specified cell sizes (" + sVerbNow + ")"); } return(bGood); } //end SplitFromImage32