• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Upside down text in a flipped view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Upside down text in a flipped view


  • Subject: Upside down text in a flipped view
  • From: Jason Swain <email@hidden>
  • Date: Mon, 4 Jul 2005 15:45:37 +0100

I'm drawing text into a flipped image, and then drawing the image into a flipped view, but the text is coming out upside down. Here is the sequence of what I do

I am drawing into a flipped view. iconImageBuffer is also flipped. count is a string, this is the one that comes out upside down.

NSSize numSize = [count sizeWithAttributes:countAttributes];
NSSize iconSize = [iconImageBuffer size];
[iconImageBuffer lockFocus];
float max = (numSize.width > numSize.height) ? numSize.width : numSize.height;
max += 16;
NSRect circleRect = NSMakeRect(iconSize.width - max, 0, max, max);
[[NSGraphicsContext currentContext] setShouldAntialias: YES];
NSBezierPath *bp = [NSBezierPath bezierPathWithOvalInRect:circleRect];
[[NSColor colorWithCalibratedWhite:0.55 alpha:1.0] set];
[bp fill];


[count drawAtPoint:NSMakePoint(NSMidX(circleRect) - numSize.width / 2.0f,
NSMidY(circleRect) - numSize.height / 2.0f + 2.0f)
withAttributes:countAttributes];


    [iconImageBuffer unlockFocus];

// Now show the image
[controlView lockFocus];
[iconImageBuffer drawInRect:NSMakeRect( cellFrame.origin.x + 6, (cellFrame.origin.y + 3), 28, 28 )
fromRect:NSMakeRect(0.0f, 0.0f, [iconImageBuffer size].width, [iconImageBuffer size].height)
operation:NSCompositeSourceOver
fraction:1.0f];
[controlView unlockFocus];


The icon paints up the right way, but the text is upside down. I've tried mucking with all sorts of things to get this working, but in every case the text still comes out upside down. Can anyone see what it the problem here?

Jason



Jason Swain
email@hidden
mobile +44 7917 524 192

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: [NSOutlineView rowForItem] giving me a different result than expected
  • Next by Date: date issue
  • Previous by thread: [NSOutlineView rowForItem] giving me a different result than expected
  • Next by thread: date issue
  • Index(es):
    • Date
    • Thread