Professional Web Applications Themes

Problems drawing ATSUI with CGContext in QuickDraw Ports - Mac Programming

I'm currently trying to draw text using ATSUI with a CGContext in a Quickdraw port. Before, in my application ATSUI text was drawn using Quickdraw, but this way the text antialiasing doesn't look good. This is why I try to use a CGContext under MacOSX now. Other drawing operations are still Quickdraw calls. My code uses QDBeginCGContext() and QDEndCGContext() around the ATSUDrawText() call. In general everything works well. That means when I draw the text (ATSUI/CGContext) and all the rest (Quickdraw), everything looks as expected. But each time another window is brought to the front or my own window is ...

  1. #1

    Default Problems drawing ATSUI with CGContext in QuickDraw Ports

    I'm currently trying to draw text using ATSUI with a CGContext in a
    Quickdraw port. Before, in my application ATSUI text was drawn using
    Quickdraw, but this way the text antialiasing doesn't look good. This is
    why I try to use a CGContext under MacOSX now. Other drawing operations
    are still Quickdraw calls.

    My code uses QDBeginCGContext() and QDEndCGContext() around the
    ATSUDrawText() call.

    In general everything works well. That means when I draw the text
    (ATSUI/CGContext) and all the rest (Quickdraw), everything looks as
    expected. But each time another window is brought to the front or my own
    window is brought to the front again, it looks like the text is drawn
    again over the already existing text. This looks really ugly because the
    antialiasing is done by transparencies in the letters and so the text is
    getting darker and darker each time the window stack order is changed.
    My application doesn't get any redraw events when I switch windows
    (windows have an internal offscreen buffer, so MacOSX can update the
    window itself).

    The whole thing looks like the MacOSX doesn't just use the offscreen
    buffer to update the screen, instead the text seems to be cached and
    drawn again by the system when updating the window, without drawing the
    background (that was drawn by Quickdraw calls) before.

    Why is this happening? Is there a way to prevent this?



    --
    Alexander
    Alexander Guest

  2. #2

    Default Re: Problems drawing ATSUI with CGContext in QuickDraw Ports

    In article <1gemgan.1pn4fht19kg4cqN%tu-darmstadt.de>,
    Alexander Clauss <tu-darmstadt.de> wrote:
     

    I assume this is a non-compositing window? Try adding
    CGContextSynchronize(CGPort) before the QDEndCGContext() call.
    Chris Guest

  3. #3

    Default Re: Problems drawing ATSUI with CGContext in QuickDraw Ports

    Chris Baum <net> wrote:
     

    Unfortunately this doesn't help.

    But I've now found out that the problem seems to be related to the
    clipping region. If I use the call ClipCGContextToRegion() to set the
    clipping, the problem occurs, if I don't use this call, the problem
    vanishes (but there's no clipping then). Using CGContextClipToRect()
    instead seems to work much better (though I can't pass the Quickdraw
    clipping region to the GContext anymore).


    --
    Alexander
    Alexander Guest

  4. #4

    Default Re: Problems drawing ATSUI with CGContext in QuickDraw Ports

    In article <1gengpd.163qwfj8t16m6N%tu-darmstadt.de>,
    tu-darmstadt.de (Alexander Clauss) wrote:
     

    I guess you could try to use QDRegionToRects() or whatever it was called
    to split your Quickdraw clipping region into a couple of rects, then
    build a path from those and clip to that?

    Cheers,
    -- Uli
    Uli Guest

  5. #5

    Default Re: Problems drawing ATSUI with CGContext in QuickDraw Ports

    Uli Kusterer <de> wrote:
     

    Thanks for the hint. I'll try this.

    --
    Alexander
    Alexander Guest

Similar Threads

  1. AS400 Connection problems - Configuring ports?
    By ZaneyFellow in forum Coldfusion Database Access
    Replies: 1
    Last Post: December 28th, 10:36 PM
  2. Ports and Packages: Updating problems
    By Gerry in forum FreeBSD
    Replies: 2
    Last Post: March 17th, 01:53 PM
  3. HIViews and Quickdraw
    By Eric VERGNAUD in forum Mac Programming
    Replies: 1
    Last Post: August 2nd, 09:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139