Drawing when dragging/flipping
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