• 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
Drawing when dragging/flipping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drawing when dragging/flipping


  • Subject: Drawing when dragging/flipping
  • From: Mark Dawson <email@hidden>
  • Date: Mon, 18 Apr 2005 16:14:18 -0700

I've got drag moving working for all my objects, except for text. For all other objects, I need to [mImage setFilipped:YES] for the image to be drawn correctly. However, doing this for text flips the text (to upside down). All the drawing that works goes through NSBeizerPath ( [path stroke]); however, I'm using code for the text drawing from the Sketch example. Is there some reason its drawing flipped? I assume that my NSBeizerPath code needs to be flipped is because the drawing origin is top (left, top) while the image origin is (left, bottom). Does text draw the same way as images?

	NSTextStorage *contents = [self mContents];
	if ([contents length] > 0)
	{
		NSLayoutManager *lm = sharedDrawingLayoutManager();
		NSTextContainer *tc = [[lm textContainers] objectAtIndex:0];
		NSRange glyphRange;

[tc setContainerSize:bounds.size];
[contents addLayoutManager:lm];
// Force layout of the text and find out how much of it fits in the container.
glyphRange = [lm glyphRangeForTextContainer:tc];


		if (glyphRange.length > 0) {
			[lm drawBackgroundForGlyphRange:glyphRange atPoint:bounds.origin];
			[lm drawGlyphsForGlyphRange:glyphRange atPoint:bounds.origin];
		}
		[contents removeLayoutManager:lm];
	}

_______________________________________________
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: Re: NSDocument-based architecture suiting my NSBundle-based documents case?
  • Next by Date: Re: Permissions problem after NSTask application launch
  • Previous by thread: NSUserDefaults and application preferences
  • Next by thread: Category or Protocol? (objc newbie)
  • Index(es):
    • Date
    • Thread