Changeset 5798


Ignore:
Timestamp:
May 10, 2008, 2:05:25 PM (14 years ago)
Author:
livings124
Message:

(1.2x) revert the upgrade of CTGradient

Location:
branches/1.2x/macosx/CTGradient
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2x/macosx/CTGradient/CTGradient.h

    r5785 r5798  
    33//
    44//  Created by Chad Weider on 2/14/07.
    5 //  Writtin by Chad Weider.
     5//  Copyright (c) 2007 Chad Weider.
     6//  Some rights reserved: <http://creativecommons.org/licenses/by/2.5/>
    67//
    7 //  Released into public domain on 4/10/08.
    8 // 
    9 //  Version: 1.8
     8//  Version: 1.6
    109
    1110#import <Cocoa/Cocoa.h>
     
    5453- (CTGradient *)gradientWithAlphaComponent:(float)alpha;
    5554
     55- (void)addElement:(CTGradientElement*)newElement;
     56
    5657- (CTGradient *)addColorStop:(NSColor *)color atPosition:(float)position;       //positions given relative to [0,1]
    5758- (CTGradient *)removeColorStopAtIndex:(unsigned)index;
  • branches/1.2x/macosx/CTGradient/CTGradient.m

    r5785 r5798  
    33//
    44//  Created by Chad Weider on 2/14/07.
    5 //  Writtin by Chad Weider.
     5//  Copyright (c) 2007 Chad Weider.
     6//  Some rights reserved: <http://creativecommons.org/licenses/by/2.5/>
    67//
    7 //  Released into public domain on 4/10/08.
    8 //
    9 //  Version: 1.8
     8//  Version: 1.6
    109
    1110#import "CTGradient.h"
     
    609608 
    610609 
    611   return [NSColor colorWithCalibratedRed:components[0]/components[3]    //undo premultiplication that CG requires
    612                                                                    green:components[1]/components[3]
    613                                                                     blue:components[2]/components[3]
     610  return [NSColor colorWithCalibratedRed:components[0]
     611                                                                   green:components[1]
     612                                                                    blue:components[2]
    614613                                                                   alpha:components[3]];
    615614  }
     
    687686  CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
    688687  CGContextSaveGState(currentContext);
    689           #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4
     688          #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
    690689                CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
    691690          #else
     
    704703- (void)radialFillRect:(NSRect)rect
    705704  {
    706   CGPoint startPoint, endPoint;
     705  CGPoint startPoint , endPoint;
    707706  float startRadius, endRadius;
    708707  float scalex, scaley, transx, transy;
     
    810809
    811810- (void)addElement:(CTGradientElement *)newElement
    812   {
     811{
    813812  if(elementList == nil || newElement->position < elementList->position)        //inserting at beginning of list
    814813        {
     
    10091008        out[2] = (color2->blue  - color1->blue )*position + color1->blue;
    10101009        out[3] = (color2->alpha - color1->alpha)*position + color1->alpha;
    1011         }
    1012  
    1013   //Premultiply the color by the alpha.
    1014   out[0] *= out[3];
    1015   out[1] *= out[3];
    1016   out[2] *= out[3];
     1010        }
    10171011  }
    10181012
     
    11031097   
    11041098  transformHSV_RGB(out);
    1105  
    1106   //Premultiply the color by the alpha.
    1107   out[0] *= out[3];
    1108   out[1] *= out[3];
    1109   out[2] *= out[3];
    11101099  }
    11111100
     
    11901179   
    11911180  transformHSV_RGB(out);
    1192  
    1193   //Premultiply the color by the alpha.
    1194   out[0] *= out[3];
    1195   out[1] *= out[3];
    1196   out[2] *= out[3];
    1197   }
     1181  }
     1182
    11981183
    11991184
Note: See TracChangeset for help on using the changeset viewer.