コード例 #1
0
        void ILcdBoostElement.Render(
            LcdBoostVideoCache cache,
            LcdBoostRect container
            )
        {
            //gets the global cache point where the character
            //has to be written
            int xd = System.Math.Max(0, this.X) + container.Left;
            int yd = System.Math.Max(0, this.Y) + container.Top;

            /**
             * hard-copy the local cache onto the global
             **/

            var face = (int)this.Face;

            if (face != LcdBoostElementTextArea.Transparent)
            {
                //it assumes that the whole area is opaque
                //thus the copy is much simpler (and faster)
                if (container.Contains(xd, yd))
                {
                    cache.Data[yd][xd] = (byte)face;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Dump the entire local cache to the physical LCD module
        /// </summary>
        /// <param name="cache">The logical video-cache to be dumped</param>
        public void Dump(LcdBoostVideoCache cache)
        {
            //physical row #0 (always present)
            int row = this._physicalRow0;

            int address = 0x80;

            WriteCommand(address);

            this.DumpPhysicalRow(
                cache,
                (short)row,
                (row >> 16));

            //physical row #1
            if ((row = this._physicalRow1) != 0)
            {
                address += AddressStep;
                WriteCommand(address);

                this.DumpPhysicalRow(
                    cache,
                    (short)row,
                    (row >> 16));
            }
        }
コード例 #3
0
        /// <summary>
        /// Performs a dump of single physical row
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="block0"></param>
        /// <param name="block1"></param>
        private void DumpPhysicalRow(
            LcdBoostVideoCache cache,
            int block0,
            int block1
            )
        {
            this.DumpPhysicalBlock(
                cache.Data[block0 >> 8],
                (byte)block0);

            if (block1 != 0)
            {
                this.DumpPhysicalBlock(
                    cache.Data[block1 >> 8],
                    (byte)block1);
            }

            this.Send();
        }
コード例 #4
0
        void ILcdBoostElement.Render(
            LcdBoostVideoCache cache,
            LcdBoostRect container
            )
        {
            //rebuild the local cache when something has been changed
            if (this._changed ||
                this.Bounds.WidthHeightChanged)
            {
                this.Recalc();
            }

            /**
             * calculate actual rect bounds to be used
             **/

            //gets the upper-left point from where the
            //data of the local cache have to be read from
            int xs = System.Math.Max(0, -this.Bounds.Left);
            int ys = System.Math.Max(0, -this.Bounds.Top);

            //gets the upper-left point from where the
            //data of the global cache have to be written to
            int xd = System.Math.Max(0, this.Bounds.Left) + container.Left;
            int yd = System.Math.Max(0, this.Bounds.Top) + container.Top;

            //gets the actual box size to be considered
            int w = System.Math.Min(container.Right, container.Left + this.Bounds.Right) - xd + 1;
            int h = System.Math.Min(container.Bottom, container.Top + this.Bounds.Bottom) - yd + 1;

            /**
             * hard-copy the local cache onto the global
             **/

            if (this._background == Transparent)
            {
                //must take in account every single byte
                //to check whether is transparent
                for (int iy = 0; iy < h; iy++)
                {
                    byte[] src_row  = this._cache[iy + ys];
                    byte[] dest_row = cache.Data[iy + yd];

                    for (int ix = 0; ix < w; ix++)
                    {
                        byte code = src_row[ix + xs];
                        if (code != Transparent)
                        {
                            dest_row[ix + xd] = code;
                        }
                    }
                }
            }
            else
            {
                //it assumes that the whole area is opaque
                //thus the copy is much simpler (and faster)
                for (int iy = 0; iy < h; iy++)
                {
                    byte[] src_row  = this._cache[iy + ys];
                    byte[] dest_row = cache.Data[iy + yd];
                    Array.Copy(
                        src_row,
                        xs,
                        dest_row,
                        xd,
                        w);
                }
            }
        }