bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #34742] NSAffineTransform ignored in most cases


From: julian
Subject: [bug #34742] NSAffineTransform ignored in most cases
Date: Thu, 03 Nov 2011 22:30:32 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22

URL:
  <http://savannah.gnu.org/bugs/?34742>

                 Summary: NSAffineTransform ignored in most cases
                 Project: GNUstep
            Submitted by: julian_
            Submitted on: Do 03 Nov 2011 22:30:31 GMT
                Category: Gui/AppKit
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

i am using NSAffineTransform in two cases in my application and in both cases
gnustep completely ignores it.

first case - drawing into a NSImage flipped - since it doesn't work on gnustep
i must produce the flipping through coordinate modification:

    NSImage *theImage = [[NSImage alloc] initWithSize:NSMakeSize(size,
size)];
    [theImage lockFocus];
    NSAffineTransform *t = [NSAffineTransform transform];
           [t scaleXBy:1.0 yBy:-1.0];
           [t translateXBy:0.0 yBy:-size];
           [t concat];
        [[NSColor blackColor] setStroke];
        NSBezierPath* aPath = [NSBezierPath bezierPath];
        [aPath setLineJoinStyle:NSRoundLineJoinStyle];
        [aPath setLineWidth:size / 25.0f];
        [aPath moveToPoint:NSMakePoint(10, 10)];
        [aPath lineToPoint:NSMakePoint(20, 20)];
        [aPath lineToPoint:NSMakePoint(10, 30)];
        [aPath stroke];
      
    [theImage unlockFocus];


second case - getting the flipped contents of a NSImage - since the flipping
doesn't work i must copy the data row by row in reverse instead:


            NSImage *theImg = [[NSImage alloc] initWithContentsOfURL:_url];
            NSBitmapImageRep *bitmap = [NSBitmapImageRep alloc];
            NSImageRep *rep = [theImg bestRepresentationForDevice: nil];
            [theImg lockFocus];
            NSAffineTransform *t = [NSAffineTransform transform];
            [t scaleXBy:1.0 yBy:-1.0];
            [t translateXBy:0.0 yBy:-imgSize.height];
            [t concat];
            [rep drawInRect:NSMakeRect(0,0,[theImg size].width, [theImg
size].height)];
            [bitmap initWithFocusedViewRect:NSMakeRect(0.0, 0.0, [theImg
size].width, [theImg size].height)];
            [theImg unlockFocus];
            int bpp = [bitmap bitsPerPixel] / 8;
            int bpp = 4;
            const int rowsize = [theImg size].width * bpp;
            _data = (char *)calloc( rowsize * [theImg size].height, 1);
            memcpy(_data, [bitmap bitmapData], [theImg size].width * bpp *
[theImg size].height);





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34742>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]