コード例 #1
0
        protected void ShowGlyphs(IntPtr glyphs, IntPtr positions, nuint glyphCount, IntPtr font, CGAffineTransform textMatrix, IntPtr attributes, IntPtr graphicsContext)
        {
            if (ForegroundBrush is SolidBrush)
            {
                // attributes can be null, Xamarin.Mac doesn't allow that when calling base. ugh.
                Messaging.void_objc_msgSendSuper_IntPtr_IntPtr_nuint_IntPtr_CGAffineTransform_IntPtr_IntPtr(SuperHandle, selShowCGGlyphs_Positions_Count_Font_Matrix_Attributes_InContext_Handle, glyphs, positions, glyphCount, font, textMatrix, attributes, graphicsContext);
                //base.ShowGlyphs(glyphs, positions, glyphCount, font, textMatrix, attributes, graphicsContext);
            }
            else if (glyphCount > 0)
            {
                // draw manually so we can use a custom brush/fill.
                var ctx = NSGraphicsContext.CurrentContext.GraphicsPort;
                ctx.SaveState();
                ctx.SetTextDrawingMode(CGTextDrawingMode.Clip);

                // what to do with the attributes?? needed?
                var m = CTFontGetMatrix(font);
                m.Translate(textMatrix.x0, textMatrix.y0);
                m.Scale(1, -1);
                ctx.TextMatrix = m;
                CTFontDrawGlyphs(font, glyphs, positions, glyphCount, ctx.Handle);

                ForegroundBrush.Draw(CurrentGraphics, false, FillMode.Winding, false);
                ctx.RestoreState();
            }
        }
コード例 #2
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         components.Dispose();
         ForegroundBrush.Dispose();
     }
     base.Dispose(disposing);
 }
コード例 #3
0
 public void Draw(GraphicsHandler graphics, Pango.Layout layout, Cairo.Context context, PointF location)
 {
     Setup(layout);
     context.Save();
     ForegroundBrush.Apply(graphics);
     context.MoveTo(location.X, location.Y);
     Pango.CairoHelper.LayoutPath(context, layout);
     context.Fill();
     context.Restore();
 }
コード例 #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Typeface != null ? Typeface.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ FontRenderingEmSize.GetHashCode();
         hashCode = (hashCode * 397) ^ (TextDecorations != null ? TextDecorations.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ForegroundBrush != null ? ForegroundBrush.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BackgroundBrush != null ? BackgroundBrush.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CultureInfo != null ? CultureInfo.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #5
0
        protected void DisposeDirectXResources()
        {
            PreDestroyDirectXResources();
            SharedBrush.Dispose();
            BackgroundBrush.Dispose();
            ForegroundBrush.Dispose();
            CorrectColorBrush.Dispose();
            WrongColorBrush.Dispose();

            InputTextFormat.Dispose();
            ButtonLabelTextFormat.Dispose();
            SubtitleTextFormat.Dispose();
            CueTextFormat.Dispose();

            DwFactory.Dispose();
            RenderTarget.Dispose();
            RenderTargetView.Dispose();
            D2DFactory.Dispose();
            SwapChain.Dispose();
            D3DDeviceContext.Dispose();
            D3DDevice.Dispose();
        }