From: <ho...@us...> - 2007-03-07 18:32:14
|
Revision: 10108 http://svn.sourceforge.net/bibdesk/?rev=10108&view=rev Author: hofman Date: 2007-03-07 10:32:15 -0800 (Wed, 07 Mar 2007) Log Message: ----------- Draw markup annotation ourselves. This way we can draw the full rect, so it also works for multiple lines. Modified Paths: -------------- skim/SKPDFAnnotationNote.m Modified: skim/SKPDFAnnotationNote.m =================================================================== --- skim/SKPDFAnnotationNote.m 2007-03-07 18:11:08 UTC (rev 10107) +++ skim/SKPDFAnnotationNote.m 2007-03-07 18:32:15 UTC (rev 10108) @@ -407,6 +407,8 @@ // fix a bug in PDFKit, the color space sometimes is not correct - (void)drawWithBox:(CGPDFBox)box inContext:(CGContextRef)context { + CGContextSaveGState(context); + CMProfileRef profile; CMGetDefaultProfileBySpace(cmRGBData, &profile); CGColorSpaceRef colorSpace = CGColorSpaceCreateWithPlatformColorSpace(profile); @@ -416,7 +418,37 @@ CGContextSetFillColorSpace(context, colorSpace); CGColorSpaceRelease(colorSpace); - [super drawWithBox:box inContext:context]; + CGContextSetBlendMode(context, kCGBlendModeMultiply); + + NSColor *c = [self color]; + float color[4] = { [c redComponent], [c greenComponent], [c blueComponent], [c alphaComponent] }; + CGContextSetFillColor(context, color); + + PDFPage *page = [self page]; + NSRect bounds = [page boundsForBox:box]; // CGPDFBox corresponds identically to PDFDisplayBox + + switch ([page rotation]) { + case 0: + CGContextTranslateCTM(context, -NSMinX(bounds), -NSMinY(bounds)); + break; + case 90: + CGContextRotateCTM(context, -M_PI / 2); + CGContextTranslateCTM(context, -NSMaxX(bounds), -NSMinY(bounds)); + break; + case 180: + CGContextRotateCTM(context, M_PI); + CGContextTranslateCTM(context, -NSMaxX(bounds), -NSMaxY(bounds)); + break; + case 270: + CGContextRotateCTM(context, M_PI / 2); + CGContextTranslateCTM(context, -NSMinX(bounds), -NSMaxY(bounds)); + break; + } + + bounds = [self bounds]; + CGContextFillRect(context, *(CGRect*)&bounds); + + CGContextRestoreGState(context); } @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |