private void LoadPixels() { if (mCharBuf == null) { throw new EhllapiExcp("LoadPixels failed. PresentationSpace buffer is empty."); } mPixels = new LinkedList <PresentationSpacePixel>(); DisplayLocation loc = new DisplayLocation(1, 1); // loop for every character in the character buffer. for (int ix = 0; ix < mCharBuf.Length; ix = ix + mPixelSx) { // create a pixel from the char and color byte buffers. PresentationSpacePixel pixel = null; if (mPixelSx == 2) { pixel = new PresentationSpacePixel( mCharBuf[ix], new CharAttrByte(mCharBuf[ix + 1]), new ColorAttrByte(mColorBuf[ix + 1])); } else { pixel = new PresentationSpacePixel(mCharBuf[ix]); } pixel.DisplayLocation = loc; mPixels.AddLast(pixel); // advance to the next display location in the presentation space. loc = Dim.IncDisplayLocation(loc); } }
public PresentationSpaceField( out LinkedListNode <PresentationSpacePixel> OutEndPixelNode, PresentationSpace InPs, LinkedListNode <PresentationSpacePixel> InPixelNode) { PresentationSpacePixel pixel = InPixelNode.Value; mPs = InPs; mLocation = pixel.DisplayLocation; this.FieldAttribute = new FieldAttribute(pixel.Byte1); // store the character attributes found in the first character pixel. if (pixel.CharAttrByte != null) { mCharAttrByte = pixel.CharAttrByte; } // length runs from pixel after the attribute pixel to the next // attribute pixel. mLength = 0; StringBuilder sb = new StringBuilder(); LinkedListNode <PresentationSpacePixel> node = InPixelNode; LinkedListNode <PresentationSpacePixel> endNode = InPixelNode; while (true) { node = node.Next; if (node == null) { break; } pixel = node.Value; if (pixel.IsFieldAttribute == true) { break; } endNode = node; ++mLength; sb.Append(pixel.CharValue); if (sb.Length == 1) { if (pixel.ColorAttrByte != null) { mColorAttrByte = pixel.ColorAttrByte; } } } mText = sb.ToString( ); OutEndPixelNode = endNode; }