Exemple #1
0
            public void Draw(Cairo.Context cr)
            {
                double x = this.Position.X;
                double y = this.Position.Y;

                if (this.IsSiteTag)
                {
                    // right align
                    x -= this.Width;
                }

                cr.DrawStringAt(x, y, this.Text, COLOR_BLACK, this.Color);
            }
Exemple #2
0
 void DrawInfoString(Cairo.Context cr, Image image)
 {
     cr.SelectTagOverlayFont();
     cr.DrawStringAt(8, 8 + cr.FontExtents.Height, this.infoString, COLOR_BLACK, COLOR_IMAGE_INFO);
 }
Exemple #3
0
        protected override bool OnDrawn(Cairo.Context cr)
        {
            if (this.Controls != null && this.Controls.PlayerPocess != null)
            {
                return(true);
            }

            bool baseDrawnResult = base.OnDrawn(cr);

            var scaledPixbuf = this.ScaledPixbuf;

            if (scaledPixbuf == null)
            {
                this.hasFrameBeenQueued = false;
                return(baseDrawnResult);
            }

            // black background in fullscreen mode
            if (BooruApp.BooruApplication.MainWindow.IsFullscreen)
            {
                cr.SetSourceRGB(0, 0, 0);
                cr.Rectangle(new Rectangle(0, 0, this.Allocation.Width, this.Allocation.Height));
                cr.Fill();
            }

            cr.Rectangle(this.TargetRect);
            Gdk.CairoHelper.SetSourcePixbuf(cr, scaledPixbuf, TargetRect.X, TargetRect.Y);
            if (this.fadeAlpha < 1.0)
            {
                cr.PaintWithAlpha(this.fadeAlpha);
                cr.NewPath();
            }
            else
            {
                cr.Fill();
            }

            cr.SelectFontFace("Noto Mono", FontSlant.Normal, FontWeight.Normal);
            cr.SetFontSize(12.0);
            cr.LineWidth = 3.5;

            if (this.fadeAlpha < 1.0)
            {
                var ext          = cr.TextExtents("Loading...");
                var center       = new Point2D(this.Allocation.Width / 2 - (int)ext.Width / 2, this.Allocation.Height / 2 - (int)ext.Height / 2);
                var whiteInverse = new Color(1, 1, 1, 1 - this.fadeAlpha);
                var blackInverse = new Color(0, 0, 0, 1 - this.fadeAlpha);
                cr.DrawStringAt(center.X, center.Y, "Loading...", blackInverse, whiteInverse);
            }

            var white = new Cairo.Color(1, 1, 1, this.fadeAlpha);
            var black = new Cairo.Color(0, 0, 0, this.fadeAlpha);

            // cr.DrawStringAt (4, 4 + cr.FontExtents.Height, System.IO.Path.GetFileName (this.image.Details.Path), black, white);

            if (this.image.MaxImage > -1)
            {
                string text;
                if (this.image.SubImage < 0)
                {
                    text = string.Format("{0:D} images in file", this.image.MaxImage);
                }
                else
                {
                    text = string.Format("{0:D3}/{1:D3} {2}", this.image.SubImage, this.image.MaxImage, this.image.SubImageName);
                }
                cr.DrawStringAt(4, this.Allocation.Height - cr.FontExtents.Height - 4, text, black, white);
            }

            this.hasFrameBeenQueued = false;
            return(baseDrawnResult);
        }