Changeset 394

Show
Ignore:
Timestamp:
04/14/07 18:57:14 (1 year ago)
Author:
kcathey2
Message:

Fixed LTBufferedRenderer subdivide line method

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/LaserTools/FlashInspector/FlashInspector.xcodeproj/project.pbxproj

    r387 r394  
    4040                        proxyType = 2; 
    4141                        remoteGlobalIDString = 8DC2EF5B0486A6940098B216; 
     42                        remoteInfo = LaserTools; 
     43                }; 
     44                DEBB6C1F0BD186B2004DAE1B /* PBXContainerItemProxy */ = { 
     45                        isa = PBXContainerItemProxy; 
     46                        containerPortal = D45A5EA80BCCA05600368A33 /* LaserTools.xcodeproj */; 
     47                        proxyType = 1; 
     48                        remoteGlobalIDString = 8DC2EF4F0486A6940098B216 /* LaserTools */; 
    4249                        remoteInfo = LaserTools; 
    4350                }; 
     
    190197                        ); 
    191198                        dependencies = ( 
     199                                DEBB6C200BD186B2004DAE1B /* PBXTargetDependency */, 
    192200                        ); 
    193201                        name = FlashInspector; 
     
    258266                }; 
    259267/* End PBXSourcesBuildPhase section */ 
     268 
     269/* Begin PBXTargetDependency section */ 
     270                DEBB6C200BD186B2004DAE1B /* PBXTargetDependency */ = { 
     271                        isa = PBXTargetDependency; 
     272                        name = LaserTools; 
     273                        targetProxy = DEBB6C1F0BD186B2004DAE1B /* PBXContainerItemProxy */; 
     274                }; 
     275/* End PBXTargetDependency section */ 
    260276 
    261277/* Begin PBXVariantGroup section */ 
     
    299315                                INSTALL_PATH = "$(HOME)/Applications"; 
    300316                                OBJROOT = ../../Build; 
     317                                OTHER_CFLAGS = ""; 
    301318                                PRODUCT_NAME = FlashInspector; 
    302319                                SYMROOT = ../../Build; 
  • trunk/LaserTools/FlashInspector/LTRenderedContextView.h

    r224 r394  
    1212NSPoint LTOffsetPoint(NSPoint point, float x, float y); 
    1313NSPoint LTScaledPoint(NSPoint point, float w, float h); 
     14 
     15#define LTRenderSegments        0 
     16#define LTOvalPointRadius       1 
    1417 
    1518// -------------------------------------------------------------------------- // 
  • trunk/LaserTools/FlashInspector/LTRenderedContextView.m

    r227 r394  
    7878        // it after we have drawn each color. 
    7979        NSBezierPath *segments = [[NSBezierPath alloc] init]; 
     80        NSBezierPath *dots = [[NSBezierPath alloc] init]; 
     81         
    8082        LTPoint *firstPoint = [[self points] objectAtIndex:0]; 
    8183        float xScale = rect.size.width/2.0F; 
     
    8385        float yScale = xScale; 
    8486        [segments moveToPoint:LTOffsetPoint(LTScaledPoint([firstPoint nsPoint], xScale, yScale), 0.0F, 0.0F)]; 
     87        [dots moveToPoint:LTScaledPoint([firstPoint nsPoint], xScale, yScale)]; 
    8588         
    8689        // Now we set the starting line width and color 
    8790        [segments setLineWidth:[firstPoint pixelLineWidth]]; 
     91        [dots setLineWidth:1.0F]; 
     92         
    8893        [[firstPoint nsColor] set]; 
    8994        LTColor *currColor = [firstPoint color]; 
     
    101106                LTPoint *curr = [[self points] objectAtIndex:i]; 
    102107                NSPoint scaledPoint = LTScaledPoint([curr nsPoint], xScale, yScale); 
    103                 [segments lineToPoint:LTOffsetPoint(scaledPoint, 0.0F, 0.0F)]; 
     108                //[segments lineToPoint:LTOffsetPoint(scaledPoint, 0.0F, 0.0F)]; 
     109                 
     110                // LTRenderSegments tells us whether or not we are going to render the 
     111                // line segment in between the given point (YES), or if we are just going 
     112                // to draw an oval around the point (NO). 
     113                if (LTRenderSegments) 
     114                { 
     115                        [segments lineToPoint:scaledPoint]; 
     116                } 
     117                else 
     118                { 
     119                        NSRect ovalRect = NSMakeRect(scaledPoint.x - LTOvalPointRadius, 
     120                                scaledPoint.y - LTOvalPointRadius, 
     121                                LTOvalPointRadius, LTOvalPointRadius); 
     122                                 
     123                        [dots appendBezierPathWithOvalInRect:ovalRect]; 
     124                } 
    104125                [segments setLineWidth:[curr pixelLineWidth]]; 
     126                 
     127                // If we have a color change 
    105128                if (![currColor isEqualToColor:[curr color]]) 
    106129                { 
    107                         [segments stroke]; 
    108                         [segments release]; 
     130                        [segments stroke]; [segments release]; 
     131                        [dots stroke]; [dots release]; 
    109132                         
    110133                        currColor = [curr color]; 
    111134                        segments = [[NSBezierPath alloc] init]; 
    112                         [segments moveToPoint:LTOffsetPoint(scaledPoint, 0.0F, 0.0F)]; 
     135                        dots = [[NSBezierPath alloc] init]; 
     136                        //[segments moveToPoint:LTOffsetPoint(scaledPoint, 0.0F, 0.0F)]; 
     137                        [segments moveToPoint:scaledPoint]; 
     138                        [dots moveToPoint:scaledPoint]; 
    113139                } 
    114140                [[curr nsColor] set]; 
     
    117143        } 
    118144         
    119         [segments stroke]; 
     145        if (LTRenderSegments) 
     146                [segments stroke]; 
     147        else 
     148                [dots stroke]; 
     149                 
    120150        [segments release]; 
     151        [dots release]; 
    121152} 
    122153 
  • trunk/LaserTools/LaserTools.xcodeproj/project.pbxproj

    r387 r394  
    575575                                INFOPLIST_FILE = Info.plist; 
    576576                                INSTALL_PATH = "@executable_path/../Frameworks/"; 
     577                                OTHER_CFLAGS = "-D__LTSUBDIVIDESTRAIGHTS__=1"; 
    577578                                PRODUCT_NAME = LaserTools; 
    578579                                WRAPPER_EXTENSION = framework; 
  • trunk/LaserTools/_DataStructures/LTShapeWithStyle.m

    r387 r394  
    494494                                absoluteX = absoluteX + [shapeRecord delta].x; 
    495495                                absoluteY = absoluteY + [shapeRecord delta].y; 
     496                                NSPoint endPoint = NSMakePoint(absoluteX, absoluteY); 
    496497                                 
    497498                                // Copy the color into the palette, and then using that and the 
    498499                                // start and end points we just computed, subdivide the line 
    499500                                // segments up 
     501                                //#if __LTSUBDIVIDESTRAIGHTS__ 
    500502                                LTColor *copiedColor = [palette addAndCopyColor:[previousPoint color]]; 
    501503                                NSArray *subdividedPoints = 
    502                                         [LTBufferedRenderer subdivideLineBetweenPoints:[previousPoint nsPoint] 
    503                                                 end:NSMakePoint(absoluteX, absoluteY) color:copiedColor]; 
     504                                        [LTBufferedRenderer subdivideLineBetweenPoints:[previousPoint reversedNsPoint] 
     505                                                end:endPoint color:copiedColor]; 
     506                                                 
     507                                [points addObjectsFromArray:subdividedPoints]; 
     508                                previousPoint = [subdividedPoints lastObject]; 
     509                                [points addObject:[LTPoint pointFromNSPoint:endPoint]]; 
    504510                                 
    505511                                // create the point relative to the previous point 
    506                                 /*LTPoint *newPoint = [LTPoint point]; 
     512                                /*#else 
     513                                LTPoint *newPoint = [LTPoint point]; 
    507514                                [newPoint setX:absoluteX]; 
    508515                                [newPoint setY:absoluteY]; 
    509                                 [newPoint setColor:[palette addAndCopyColor:[previousPoint color]]];*/ 
     516                                [newPoint setColor:[palette addAndCopyColor:[previousPoint color]]]; 
    510517                                 
    511518                                // add the point save the point as the previous point 
    512                                 //[points addObject:newPoint]; 
    513                                 NSLog(@"here"); 
    514                                 [points addObjectsFromArray:subdividedPoints]; 
    515                                 previousPoint = [subdividedPoints lastObject]; 
     519                                [points addObject:newPoint]; 
     520                                #endif*/ 
    516521                        } 
    517522                        else 
  • trunk/LaserTools/_Runtime/LTBufferedRenderer.m

    r387 r394  
    2222@implementation LTBufferedRenderer 
    2323 
    24 // ----------------------------------------------------------------------------------------------------------------------------------------------------------------- // 
     24// -------------------------------------------------------------------------- // 
    2525//              Core 
    26 // ----------------------------------------------------------------------------------------------------------------------------------------------------------------- // 
     26// -------------------------------------------------------------------------- // 
    2727+ (LTBufferedRenderer *)renderer 
    2828{ 
     
    4444} 
    4545 
    46 // ----------------------------------------------------------------------------------------------------------------------------------------------------------------- // 
     46// -------------------------------------------------------------------------- // 
    4747//              Rendering movie frames 
    48 // ----------------------------------------------------------------------------------------------------------------------------------------------------------------- // 
     48// -------------------------------------------------------------------------- // 
    4949// renders a single frame of the given flash movie. 
    5050// What is does is go through each frame instance and obtain points for 
     
    315315        float deltaY = end.y - start.y; 
    316316        float lineDistance = sqrt(pow(deltaX, 2) + pow(deltaY, 2)); 
     317        float signX = (signbit(deltaX) == 0) ? 1.0 : -1.0; 
     318        float signY = (signbit(deltaY) == 0) ? 1.0 : -1.0; 
    317319         
    318320        // Get the number of points by dividing the line distance by the points per 
     
    325327        // instead of: 
    326328        //      .  .  .  .  .  .  .  . (which is off!) 
    327         signed numberOfPoints = floor(lineDistance/LTPointsPerUnitLength); 
     329        float numberOfPoints = floor(lineDistance/LTPointsPerUnitLength); 
    328330        float deltaXPerPoint = deltaX / numberOfPoints; 
    329331        float deltaYPerPoint = deltaY / numberOfPoints; 
     
    343345                LTPoint *point = [[LTPoint alloc] initWithNSPoint:next color:color]; 
    344346                [points addObject:point]; 
     347                //NSLog(NSStringFromPoint(next)); 
    345348        } 
    346349         
    347350        // Now make the last point and add it to the array 
    348351        LTPoint *lastPoint = [LTPoint pointFromNSPoint:end]; 
    349         NSLog([lastPoint description]); 
     352        //NSLog([lastPoint description]); 
    350353        [lastPoint setColor:color]; 
    351354        [points addObject:lastPoint];