Esempio n. 1
0
        SolidBrush GetOrCreateBrush(FastColour col)
        {
            int        key = col.ToArgb();
            SolidBrush brush;

            if (brushCache.TryGetValue(key, out brush))
            {
                return(brush);
            }

            brush           = new SolidBrush(col);
            brushCache[key] = brush;
            return(brush);
        }
Esempio n. 2
0
        SolidBrush GetOrCreateBrush(FastColour col)
        {
            int argb = col.ToArgb();

            for (int i = 0; i < brushes.Count; i++)
            {
                if (brushes[i].ARGB == argb)
                {
                    return(brushes[i].Brush);
                }
            }

            CachedBrush b; b.ARGB = argb; b.Brush = new SolidBrush(col);

            brushes.Add(b);
            return(b.Brush);
        }
        void DrawUnderline(FastBitmap fastBmp, FastColour textCol, int startX, int endX,
                           int yOffset, ref DrawTextArgs args)
        {
            int height = PtToPx(args.Font.Size, boxSize);
            int offset = ShadowOffset(args.Font.Size);
            int col    = textCol.ToArgb();

            if (args.UseShadow)
            {
                height += offset;
            }

            for (int yy = height - offset; yy < height; yy++)
            {
                int *dstRow = fastBmp.GetRowPtr(yy + yOffset);
                for (int xx = startX; xx < endX; xx++)
                {
                    dstRow[xx] = col;
                }
            }
        }
        void DrawUnderline( FastBitmap fastBmp, FastColour textCol, int startX, int endX,
            int yOffset, ref DrawTextArgs args)
        {
            int height = PtToPx( args.Font.Size, boxSize );
            int offset = ShadowOffset( args.Font.Size );
            if( args.UseShadow )
                height += offset;

            for( int yy = height - offset; yy < height; yy++ ) {
                int* dstRow = fastBmp.GetRowPtr( yy + yOffset );
                for( int xx = startX; xx < endX; xx++ )
                    dstRow[xx] = textCol.ToArgb();
            }
        }
        SolidBrush GetOrCreateBrush( FastColour col )
        {
            int key = col.ToArgb();
            SolidBrush brush;
            if( brushCache.TryGetValue( key, out brush ) )
                return brush;

            brush = new SolidBrush( col );
            brushCache[key] = brush;
            return brush;
        }
        public static unsafe void FastClear( FastBitmap dst, Rectangle dstRect, FastColour col )
        {
            int dstX, dstY, dstWidth, dstHeight;
            if( !CheckCoords( dst, dstRect, out dstX, out dstY, out dstWidth, out dstHeight ) )
                return;
            int pixel = col.ToArgb();

            for( int yy = 0; yy < dstHeight; yy++ ) {
                int* row = dst.GetRowPtr( dstY + yy );
                for( int xx = 0; xx < dstWidth; xx++ )
                    row[dstX + xx] = pixel;
            }
        }