Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > OOP Powerplant for Mac > Re: Hot to rora...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 7 Topic 453 of 484
Post > Topic >>

Re: Hot to rorate text using QuickTime API

by David Phillip Oster <oster@[EMAIL PROTECTED] > May 18, 2006 at 02:35 PM

In article <1147957749.691701.225960@[EMAIL PROTECTED]
>,
 "Neel" <nilesh_ibmr@[EMAIL PROTECTED]
> wrote:

> Hi,
> One of the module of my project of Landscap Re****t needs, where text is
> shown rotated by 90 degrees/ exactly vertically. I donīt know, how to
> rotate this text.  I have seen past threads related to the same, also
> found CCapionPlus class has been written to resolve the same issue,but
> could not locate the same. Can anyone tell me which API should i use to
> put /draw text vertically. Can i use MacDrawText(...) ?
> 
> Can anyone help me to solve.
> 
> This is the code which draw text horizontally.
> 
> //  Prints the Text at the specified position
> virtual void DrawString(int f nX, int f nY, char *f cpStr)
> {
> 	::RGBForeColor(&m sRGB Text);
> 	MoveTo(f nX, f nY + 12);
> 	::DrawText((void *) f cpStr, 0, strlen(f cpStr));
> 
> 	if ( m bLandScapeMode )
> 	{
> 		// Here want to draw text vertically / rotate to 90 degree.
> 	}
> }

I'd privately sent you CCaptionPlus, but it doesn't include sup****t for 
high quality printing. _That_ was previously discussed in this newsgroup:

From: "Ilja A. Iwas" <iwas@[EMAIL PROTECTED]
>
Subject: Re: printing problem
Date: Mon, 14 Feb 2000 13:51:56 +0100

....
In article <davep-1302000936460001@[EMAIL PROTECTED]
>, Dave Polaschek
<davep@[EMAIL PROTECTED]
> wrote:
.....
> Thanks to Daves help I was able to put together a pane that prints
> rotated text (90 or -90 degrees rotated) on screen and on postscript
> printers. I wasn't able to see what happens on QuickDraw printers,
> since I don't have access to one.


you can do a search using http://groups.google.com
to find it.

A more modern way to do this would be to use code similiar to Apple's 
CircleView.m from their CircleView sample code, condensed here:

NSGraphicsContext *context = [NSGraphicsContext currentContext];
NSRect lineFragmentRect = [layoutManager 
lineFragmentRectForGlyphAtIndex:glyphIndex effectiveRange:NULL];

layoutLocation = [layoutManager locationForGlyphAtIndex:glyphIndex];

NSAffineTransform *transform = [NSAffineTransform transform];

[transform translateXBy:viewLocation.x yBy:viewLocation.y];
[transform rotateByRadians:-angle];

[context saveGraphicsState];
[transform concat];

// drawGlyphsForGlyphRange: draws the glyph at its laid-out location in 
container coordinates.
// Since we are using the transform to place the glyph, we subtract the 
laid-out location here.
[layoutManager drawGlyphsForGlyphRange:NSMakeRange(glyphIndex, 1) 
atPoint:NSMakePoint(-layoutLocation.x, -layoutLocation.y)];
[context restoreGraphicsState];


Naturally, this omits critical details. See the original sample code, on 
Apple's web site.

And, the above would involve re-writing your program to use Objective-C, 
at least in part.

The idea of using a transformation matrix and letting the text system 
rotate the text should also work with QuicktimeGraphicIm****ters.
 




 7 Posts in Topic:
Hot to rorate text using QuickTime API
"Neel" <nile  2006-05-18 06:09:09 
Re: Hot to rorate text using QuickTime API
David Phillip Oster <o  2006-05-18 14:35:01 
Re: Hot to rorate text using QuickTime API
david ralley <ralley.2  2006-05-18 10:39:28 
Re: How to rotate text using QuickTime API
David Phillip Oster <o  2006-05-20 02:46:20 
Re: Hot to rorate text using QuickTime API
"Neel" <nile  2006-05-19 02:26:50 
Re: Hot to rorate text using QuickTime API
"Neel" <nile  2006-05-19 03:34:01 
Re: How to rotate text using QuickTime API
David Phillip Oster <o  2006-05-20 03:43:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 15:59:42 CST 2008.