Changeset 5795


Ignore:
Timestamp:
May 9, 2008, 9:12:53 PM (14 years ago)
Author:
livings124
Message:

CTGradient : remove unused built-in gradients; eliminate some warnings that cropped up because addElement: became private

Location:
trunk/macosx/CTGradient
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/CTGradient/CTGradient.h

    r5785 r5795  
    3737+ (id)gradientWithBeginningColor:(NSColor *)begin endingColor:(NSColor *)end;
    3838
    39 + (id)aquaSelectedGradient;
    40 + (id)aquaNormalGradient;
    41 + (id)aquaPressedGradient;
    42 
    43 + (id)unifiedSelectedGradient;
    44 + (id)unifiedNormalGradient;
    45 + (id)unifiedPressedGradient;
    46 + (id)unifiedDarkGradient;
    47 
    48 + (id)sourceListSelectedGradient;
    49 + (id)sourceListUnselectedGradient;
    50 
    51 + (id)rainbowGradient;
    52 + (id)hydrogenSpectrumGradient;
    53 
    5439- (CTGradient *)gradientWithAlphaComponent:(float)alpha;
    5540
     
    7156- (void)radialFillBezierPath:(NSBezierPath *)path;
    7257
     58- (void)addElement:(CTGradientElement*)newElement;
     59
    7360@end
  • trunk/macosx/CTGradient/CTGradient.m

    r5785 r5795  
    1414- (void)_commonInit;
    1515- (void)setBlendingMode:(CTGradientBlendingMode)mode;
    16 - (void)addElement:(CTGradientElement*)newElement;
    1716
    1817- (CTGradientElement *)elementAtIndex:(unsigned)index;
     
    157156  return [newInstance autorelease];
    158157  }
    159 
    160 + (id)aquaSelectedGradient
    161   {
    162   id newInstance = [[[self class] alloc] init];
    163  
    164   CTGradientElement color1;
    165   color1.red   = 0.58;
    166   color1.green = 0.86;
    167   color1.blue  = 0.98;
    168   color1.alpha = 1.00;
    169   color1.position = 0;
    170  
    171   CTGradientElement color2;
    172   color2.red   = 0.42;
    173   color2.green = 0.68;
    174   color2.blue  = 0.90;
    175   color2.alpha = 1.00;
    176   color2.position = 11.5/23;
    177  
    178   CTGradientElement color3;
    179   color3.red   = 0.64;
    180   color3.green = 0.80;
    181   color3.blue  = 0.94;
    182   color3.alpha = 1.00;
    183   color3.position = 11.5/23;
    184  
    185   CTGradientElement color4;
    186   color4.red   = 0.56;
    187   color4.green = 0.70;
    188   color4.blue  = 0.90;
    189   color4.alpha = 1.00;
    190   color4.position = 1;
    191  
    192   [newInstance addElement:&color1];
    193   [newInstance addElement:&color2];
    194   [newInstance addElement:&color3];
    195   [newInstance addElement:&color4];
    196  
    197   return [newInstance autorelease];
    198   }
    199 
    200 + (id)aquaNormalGradient
    201   {
    202   id newInstance = [[[self class] alloc] init];
    203  
    204   CTGradientElement color1;
    205   color1.red = color1.green = color1.blue  = 0.95;
    206   color1.alpha = 1.00;
    207   color1.position = 0;
    208  
    209   CTGradientElement color2;
    210   color2.red = color2.green = color2.blue  = 0.83;
    211   color2.alpha = 1.00;
    212   color2.position = 11.5/23;
    213  
    214   CTGradientElement color3;
    215   color3.red = color3.green = color3.blue  = 0.95;
    216   color3.alpha = 1.00;
    217   color3.position = 11.5/23;
    218  
    219   CTGradientElement color4;
    220   color4.red = color4.green = color4.blue  = 0.92;
    221   color4.alpha = 1.00;
    222   color4.position = 1;
    223  
    224   [newInstance addElement:&color1];
    225   [newInstance addElement:&color2];
    226   [newInstance addElement:&color3];
    227   [newInstance addElement:&color4];
    228  
    229   return [newInstance autorelease];
    230   }
    231 
    232 + (id)aquaPressedGradient
    233   {
    234   id newInstance = [[[self class] alloc] init];
    235  
    236   CTGradientElement color1;
    237   color1.red = color1.green = color1.blue  = 0.80;
    238   color1.alpha = 1.00;
    239   color1.position = 0;
    240  
    241   CTGradientElement color2;
    242   color2.red = color2.green = color2.blue  = 0.64;
    243   color2.alpha = 1.00;
    244   color2.position = 11.5/23;
    245  
    246   CTGradientElement color3;
    247   color3.red = color3.green = color3.blue  = 0.80;
    248   color3.alpha = 1.00;
    249   color3.position = 11.5/23;
    250  
    251   CTGradientElement color4;
    252   color4.red = color4.green = color4.blue  = 0.77;
    253   color4.alpha = 1.00;
    254   color4.position = 1;
    255  
    256   [newInstance addElement:&color1];
    257   [newInstance addElement:&color2];
    258   [newInstance addElement:&color3];
    259   [newInstance addElement:&color4];
    260  
    261   return [newInstance autorelease];
    262   }
    263 
    264 + (id)unifiedSelectedGradient
    265   {
    266   id newInstance = [[[self class] alloc] init];
    267  
    268   CTGradientElement color1;
    269   color1.red = color1.green = color1.blue  = 0.85;
    270   color1.alpha = 1.00;
    271   color1.position = 0;
    272  
    273   CTGradientElement color2;
    274   color2.red = color2.green = color2.blue  = 0.95;
    275   color2.alpha = 1.00;
    276   color2.position = 1;
    277  
    278   [newInstance addElement:&color1];
    279   [newInstance addElement:&color2];
    280  
    281   return [newInstance autorelease];
    282   }
    283 
    284 + (id)unifiedNormalGradient
    285   {
    286   id newInstance = [[[self class] alloc] init];
    287  
    288   CTGradientElement color1;
    289   color1.red = color1.green = color1.blue  = 0.75;
    290   color1.alpha = 1.00;
    291   color1.position = 0;
    292  
    293   CTGradientElement color2;
    294   color2.red = color2.green = color2.blue  = 0.90;
    295   color2.alpha = 1.00;
    296   color2.position = 1;
    297  
    298   [newInstance addElement:&color1];
    299   [newInstance addElement:&color2];
    300  
    301   return [newInstance autorelease];
    302   }
    303 
    304 + (id)unifiedPressedGradient
    305   {
    306   id newInstance = [[[self class] alloc] init];
    307  
    308   CTGradientElement color1;
    309   color1.red = color1.green = color1.blue  = 0.60;
    310   color1.alpha = 1.00;
    311   color1.position = 0;
    312  
    313   CTGradientElement color2;
    314   color2.red = color2.green = color2.blue  = 0.75;
    315   color2.alpha = 1.00;
    316   color2.position = 1;
    317  
    318   [newInstance addElement:&color1];
    319   [newInstance addElement:&color2];
    320  
    321   return [newInstance autorelease];
    322   }
    323 
    324 + (id)unifiedDarkGradient
    325   {
    326   id newInstance = [[[self class] alloc] init];
    327  
    328   CTGradientElement color1;
    329   color1.red = color1.green = color1.blue  = 0.68;
    330   color1.alpha = 1.00;
    331   color1.position = 0;
    332  
    333   CTGradientElement color2;
    334   color2.red = color2.green = color2.blue  = 0.83;
    335   color2.alpha = 1.00;
    336   color2.position = 1;
    337  
    338   [newInstance addElement:&color1];
    339   [newInstance addElement:&color2];
    340  
    341   return [newInstance autorelease];
    342   }
    343 
    344 + (id)sourceListSelectedGradient
    345   {
    346   id newInstance = [[[self class] alloc] init];
    347  
    348   CTGradientElement color1;
    349   color1.red   = 0.06;
    350   color1.green = 0.37;
    351   color1.blue  = 0.85;
    352   color1.alpha = 1.00;
    353   color1.position = 0;
    354  
    355   CTGradientElement color2;
    356   color2.red   = 0.30;
    357   color2.green = 0.60;
    358   color2.blue  = 0.92;
    359   color2.alpha = 1.00;
    360   color2.position = 1;
    361  
    362   [newInstance addElement:&color1];
    363   [newInstance addElement:&color2];
    364  
    365   return [newInstance autorelease];
    366   }
    367 
    368 + (id)sourceListUnselectedGradient
    369   {
    370   id newInstance = [[[self class] alloc] init];
    371  
    372   CTGradientElement color1;
    373   color1.red   = 0.43;
    374   color1.green = 0.43;
    375   color1.blue  = 0.43;
    376   color1.alpha = 1.00;
    377   color1.position = 0;
    378  
    379   CTGradientElement color2;
    380   color2.red   = 0.60;
    381   color2.green = 0.60;
    382   color2.blue  = 0.60;
    383   color2.alpha = 1.00;
    384   color2.position = 1;
    385  
    386   [newInstance addElement:&color1];
    387   [newInstance addElement:&color2];
    388  
    389   return [newInstance autorelease];
    390   }
    391 
    392 + (id)rainbowGradient
    393   {
    394   id newInstance = [[[self class] alloc] init];
    395  
    396   CTGradientElement color1;
    397   color1.red   = 1.00;
    398   color1.green = 0.00;
    399   color1.blue  = 0.00;
    400   color1.alpha = 1.00;
    401   color1.position = 0.0;
    402  
    403   CTGradientElement color2;
    404   color2.red   = 0.54;
    405   color2.green = 0.00;
    406   color2.blue  = 1.00;
    407   color2.alpha = 1.00;
    408   color2.position = 1.0;
    409    
    410   [newInstance addElement:&color1];
    411   [newInstance addElement:&color2];
    412  
    413   [newInstance setBlendingMode:CTChromaticBlendingMode];
    414  
    415   return [newInstance autorelease];
    416   }
    417 
    418 + (id)hydrogenSpectrumGradient
    419   {
    420   id newInstance = [[[self class] alloc] init];
    421  
    422   struct {float hue; float position; float width;} colorBands[4];
    423  
    424   colorBands[0].hue = 22;
    425   colorBands[0].position = .145;
    426   colorBands[0].width = .01;
    427  
    428   colorBands[1].hue = 200;
    429   colorBands[1].position = .71;
    430   colorBands[1].width = .008;
    431  
    432   colorBands[2].hue = 253;
    433   colorBands[2].position = .885;
    434   colorBands[2].width = .005;
    435  
    436   colorBands[3].hue = 275;
    437   colorBands[3].position = .965;
    438   colorBands[3].width = .003;
    439  
    440   int i;
    441   /////////////////////////////
    442   for(i = 0; i < 4; i++)
    443         {       
    444         float color[4];
    445         color[0] = colorBands[i].hue - 180*colorBands[i].width;
    446         color[1] = 1;
    447         color[2] = 0.001;
    448         color[3] = 1;
    449         transformHSV_RGB(color);
    450         CTGradientElement fadeIn;
    451         fadeIn.red   = color[0];
    452         fadeIn.green = color[1];
    453         fadeIn.blue  = color[2];
    454         fadeIn.alpha = color[3];
    455         fadeIn.position = colorBands[i].position - colorBands[i].width;
    456        
    457        
    458         color[0] = colorBands[i].hue;
    459         color[1] = 1;
    460         color[2] = 1;
    461         color[3] = 1;
    462         transformHSV_RGB(color);
    463         CTGradientElement band;
    464         band.red   = color[0];
    465         band.green = color[1];
    466         band.blue  = color[2];
    467         band.alpha = color[3];
    468         band.position = colorBands[i].position;
    469        
    470         color[0] = colorBands[i].hue + 180*colorBands[i].width;
    471         color[1] = 1;
    472         color[2] = 0.001;
    473         color[3] = 1;
    474         transformHSV_RGB(color);
    475         CTGradientElement fadeOut;
    476         fadeOut.red   = color[0];
    477         fadeOut.green = color[1];
    478         fadeOut.blue  = color[2];
    479         fadeOut.alpha = color[3];
    480         fadeOut.position = colorBands[i].position + colorBands[i].width;
    481        
    482        
    483         [newInstance addElement:&fadeIn];
    484         [newInstance addElement:&band];
    485         [newInstance addElement:&fadeOut];
    486         }
    487  
    488   [newInstance setBlendingMode:CTChromaticBlendingMode];
    489  
    490   return [newInstance autorelease];
    491   }
    492 
    493 #pragma mark -
    494 
    495 
    496158
    497159#pragma mark Modification
Note: See TracChangeset for help on using the changeset viewer.