Click here to Skip to main content
15,881,757 members
Home / Discussions / Objective-C and Swift
   

Objective-C and Swift

 
QuestionNSPrintOperation graphic context affect my custom print view? Pin
Le@rner4-Feb-18 18:04
Le@rner4-Feb-18 18:04 
QuestionNSPrintOperation not print properly Landscape print Pin
Le@rner30-Jan-18 20:13
Le@rner30-Jan-18 20:13 
Questionmy application crashed with this message NSInternalInconsistencyException', reason: 'Printing failed because PMSessionEndDocumentNoDialog() returned -30871.' Pin
Le@rner17-Jan-18 0:50
Le@rner17-Jan-18 0:50 
AnswerRe: my application crashed with this message NSInternalInconsistencyException', reason: 'Printing failed because PMSessionEndDocumentNoDialog() returned -30871.' Pin
Jochen Arndt17-Jan-18 1:07
professionalJochen Arndt17-Jan-18 1:07 
GeneralRe: my application crashed with this message NSInternalInconsistencyException', reason: 'Printing failed because PMSessionEndDocumentNoDialog() returned -30871.' Pin
Le@rner17-Jan-18 1:40
Le@rner17-Jan-18 1:40 
GeneralRe: my application crashed with this message NSInternalInconsistencyException', reason: 'Printing failed because PMSessionEndDocumentNoDialog() returned -30871.' Pin
Jochen Arndt17-Jan-18 1:56
professionalJochen Arndt17-Jan-18 1:56 
GeneralRe: my application crashed with this message NSInternalInconsistencyException', reason: 'Printing failed because PMSessionEndDocumentNoDialog() returned -30871.' Pin
Le@rner30-Jan-18 20:10
Le@rner30-Jan-18 20:10 
QuestionNSImage become blurry after transfromation Pin
Le@rner7-Jul-17 20:27
Le@rner7-Jul-17 20:27 
i rotate an image using this

- (NSImage*)imageRotatedByDegrees_Angle:(CGFloat)degrees
{
    [[NSGraphicsContext
      currentContext] setImageInterpolation: NSImageInterpolationNone];
    
    // Calculate the bounds for the rotated image
    // We do this by affine-transforming the bounds rectangle
    NSRect imageBounds = {NSZeroPoint, [self size]};
    NSBezierPath* boundsPath = [NSBezierPath bezierPathWithRect:imageBounds];
    NSAffineTransform* transform = [NSAffineTransform transform];
    [transform rotateByDegrees:-1.0 * degrees];// we want clockwise angles
    [boundsPath transformUsingAffineTransform:transform];
    NSRect rotatedBounds = {NSZeroPoint, [boundsPath bounds].size};
    
    // Center the image within the rotated bounds
    imageBounds.origin.x = NSMidX(rotatedBounds) - (NSWidth(imageBounds) / 2);
    imageBounds.origin.y = NSMidY(rotatedBounds) - (NSHeight(imageBounds) / 2);
    
    NSImage* rotatedImage = [[NSImage alloc] initWithSize:rotatedBounds.size];
    //NSSize new_size=[self size];
    

            NSAffineTransform* transform1 = [NSAffineTransform transform];
       
            [transform1 translateXBy:+(NSWidth(rotatedBounds) / 2)
                                yBy:+(NSHeight(rotatedBounds) / 2)];
            // Do the rotation
            [transform1 rotateByDegrees:-1.0 * degrees];
            

            [transform1 translateXBy:-(NSWidth(rotatedBounds) / 2)
                                yBy:-(NSHeight(rotatedBounds) / 2)];
        
        

         [NSGraphicsContext saveGraphicsState];
     
        
        [[NSGraphicsContext currentContext]
         setImageInterpolation:NSImageInterpolationHigh];
        
        
        [rotatedImage lockFocus];
        
        
            [transform1 concat];
        
            [self drawInRect: imageBounds fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0];
        
        
         [rotatedImage unlockFocus];
        
        [NSGraphicsContext restoreGraphicsState];
        
            
    return rotatedImage;
    
}


image is rotated but the rotated image is so blurry.

Does anyone know how to solve it?

please help me for this.
QuestionNSMutableArray copy problem Pin
Le@rner26-Jun-17 21:19
Le@rner26-Jun-17 21:19 
SuggestionRe: NSMutableArray copy problem Pin
Richard MacCutchan26-Jun-17 23:02
mveRichard MacCutchan26-Jun-17 23:02 
GeneralRe: NSMutableArray copy problem Pin
Le@rner26-Jun-17 23:05
Le@rner26-Jun-17 23:05 
GeneralRe: NSMutableArray copy problem Pin
Richard MacCutchan26-Jun-17 23:14
mveRichard MacCutchan26-Jun-17 23:14 
GeneralRe: NSMutableArray copy problem Pin
gurdevs8013-Jul-17 18:46
gurdevs8013-Jul-17 18:46 
GeneralRe: NSMutableArray copy problem Pin
Richard MacCutchan13-Jul-17 22:20
mveRichard MacCutchan13-Jul-17 22:20 
QuestionHow to access webcam and capture image? Pin
Le@rner6-Jun-17 23:36
Le@rner6-Jun-17 23:36 
AnswerRe: How to access webcam and capture image? Pin
Pete O'Hanlon7-Jun-17 0:19
mvePete O'Hanlon7-Jun-17 0:19 
GeneralRe: How to access webcam and capture image? Pin
Le@rner7-Jun-17 0:42
Le@rner7-Jun-17 0:42 
SuggestionRe: How to access webcam and capture image? Pin
Jochen Arndt7-Jun-17 0:49
professionalJochen Arndt7-Jun-17 0:49 
GeneralRe: How to access webcam and capture image? Pin
Le@rner7-Jun-17 1:25
Le@rner7-Jun-17 1:25 
GeneralRe: How to access webcam and capture image? Pin
Jochen Arndt7-Jun-17 1:49
professionalJochen Arndt7-Jun-17 1:49 
Questionhow add control manually in NSBox? Pin
Le@rner15-May-17 20:36
Le@rner15-May-17 20:36 
QuestionCan i use scanline Flood Fill algorithm to apply gradient in UIImage?How to use? Pin
Member 1319561211-May-17 21:09
Member 1319561211-May-17 21:09 
AnswerRe: Can i use scanline Flood Fill algorithm to apply gradient in UIImage?How to use? Pin
Richard MacCutchan11-May-17 21:15
mveRichard MacCutchan11-May-17 21:15 
QuestionCrashing in printing Pin
Le@rner5-Apr-17 1:22
Le@rner5-Apr-17 1:22 
AnswerRe: Crashing in printing Pin
Surya_Narayan10-Apr-17 23:26
professionalSurya_Narayan10-Apr-17 23:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.