Re: PDFMarkupAnnotations not showing when drawing PDFPage
Re: PDFMarkupAnnotations not showing when drawing PDFPage
- Subject: Re: PDFMarkupAnnotations not showing when drawing PDFPage
- From: John Calhoun <email@hidden>
- Date: Fri, 16 Feb 2007 11:33:26 -0800
On Feb 16, 2007, at 6:32 AM, Antonio Nunes wrote:
From the snippet of code you showed I gleaned you were thinking
PDFAnnotationMarkup subclass, which I think is a great idea, so I
changed my test project slightly to accomodate for that paradigm:
That was unintentional. It was really a cut/paste from the actual
class (in Leopard).
So if I have this straight:
Both annotations display on a PDFView.
Only the Circle annotation displays in your NSView.
So what else peculiar does the Highlight do? It draws with a multiply
compositing mode. How that would affect a vanilla NSView I don't
know....
Try (on your NSView) a StrikeThrough annotation (no multiply
compositing involved).
Worst case scenario, you could subclass PDFAnnotationMarkup and
implement your own:
- (void) drawWithBox: (PDFDisplayBox) box
john calhoun—
We now have a new class ANAnnotationMarkup which is a subclass of
PDFAnnotationMarkup. All it does is overriding the initWithBounds
initializer to adjust the quadriliteral points array:
- (id) initWithBounds:(NSRect)bounds {
self = [super initWithBounds:bounds];
if (self != nil) {
[self setQuadrilateralPoints: [NSArray arrayWithObjects:
[NSValue valueWithPoint: NSMakePoint(0.0,
NSHeight(bounds))],
[NSValue valueWithPoint: NSMakePoint(NSWidth(bounds),
NSHeight(bounds))],
[NSValue valueWithPoint: NSMakePoint(0.0, 0.0)],
[NSValue valueWithPoint: NSMakePoint(NSWidth(bounds),
0.0)],
NULL]];
}
return self;
}
Which allows us to simplify the test code a bit further to:
- (IBAction)createNewAnnotation:(id)sender
{
#pragma unused (sender)
PDFPage *page = [_pdfView currentPage];
NSRect bounds = NSMakeRect(20, 100, 550,
300);
PDFAnnotationMarkup *markup = [[[ANAnnotationMarkup alloc]
initWithBounds:bounds] autorelease];
[markup setColor:[NSColor yellowColor]];
[page addAnnotation:markup];
PDFAnnotationSquare *square = [[[PDFAnnotationSquare alloc]
initWithBounds:bounds] autorelease];
[page addAnnotation:square];
[_pdfView setNeedsDisplay:YES];
[_slaveView setNeedsDisplay:YES];
}
Which looks and works great, except no better than before. I.e. the
markup draws in the PDFView but not in the 'normal' NSView.
So this still leaves us with how to get the markup to show up in
views that are not subclasses of PDFView. (Unfortunately it is
rather unlikely I could switch to using PDFView in Tiger.)
António
-----------------------------------------------------------
And you would accept the seasons of your
heart, even as you have always accepted
the seasons that pass over your field.
--Kahlil Gibran
-----------------------------------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden