Пример #1
0
        public virtual void DrawAnnotation(Cairo.Context context, Cdn.AnnotationInfo info)
        {
            var uw    = context.LineWidth;
            var alloc = AnnotationAllocation(1 / uw, context);

            alloc.Offset(-Allocation.X / uw, -Allocation.Y / uw);

            context.Save();
            context.Scale(context.LineWidth, context.LineWidth);
            context.LineWidth = 1;

            context.Rectangle(alloc.X, alloc.Y, alloc.Width, alloc.Height);
            context.SetSourceRGBA(1, 1, 1, 0.75);
            context.Fill();

            context.Rectangle(alloc.X + 2, alloc.Y + 2, alloc.Width - 4, alloc.Height - 4);
            context.SetSourceRGB(0.95, 0.95, 0.95);
            context.SetDash(new double[] { 5, 5 }, 0);
            context.Stroke();

            Pango.Layout layout = Pango.CairoHelper.CreateLayout(context);
            Pango.CairoHelper.UpdateLayout(context, layout);
            layout.FontDescription = Settings.Font;

            layout.SetText(info.Text.Trim());

            context.MoveTo(alloc.X + 2, alloc.Y + 2);
            context.SetSourceRGB(0.5, 0.5, 0.5);
            Pango.CairoHelper.ShowLayout(context, layout);

            context.Restore();
        }
Пример #2
0
        public Cdn.AnnotationInfo ParseAnnotation()
        {
            IntPtr raw_ret = cdn_annotatable_parse_annotation(Handle);

            Cdn.AnnotationInfo ret = raw_ret == IntPtr.Zero ? null : (Cdn.AnnotationInfo)GLib.Opaque.GetOpaque(raw_ret, typeof(Cdn.AnnotationInfo), false);
            return(ret);
        }