API  1.0.0
CPImage.j
Go to the documentation of this file.
1 /*
2  * CPImage.j
3  * AppKit
4  *
5  * Created by Francisco Tolmasky.
6  * Copyright 2008, 280 North, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 
24 
25 
26 @protocol CPImageDelegate <CPObject>
27 
28 @optional
29 - (void)imageDidLoad:(CPImage)anImage;
30 - (void)imageDidError:(CPImage)anImage;
31 - (void)imageDidAbort:(CPImage)anImage;
32 
33 @end
34 
38 
46 
47 CPImageDidLoadNotification = @"CPImageDidLoadNotification";
48 
49 // Image Names
50 CPImageNameColorPanel = @"CPImageNameColorPanel";
51 CPImageNameColorPanelHighlighted = @"CPImageNameColorPanelHighlighted";
52 
53 var imagesForNames = { },
55  ImageDescriptionFormat = "%s {\n filename: \"%s\",\n size: { width:%f, height:%f }\n}";
56 
57 AppKitImageForNames[CPImageNameColorPanel] = CGSizeMake(26.0, 29.0);
58 AppKitImageForNames[CPImageNameColorPanelHighlighted] = CGSizeMake(26.0, 29.0);
59 
72 function CPImageInBundle()
73 {
74  var filename = arguments[0],
75  size = nil,
76  bundle = nil;
77 
78  if (typeof(arguments[1]) === "number")
79  {
80  if (arguments[1] !== nil && arguments[1] !== undefined)
81  size = CGSizeMake(arguments[1], arguments[2]);
82 
83  bundle = arguments[3];
84  }
85  else if (typeof(arguments[1]) === "object")
86  {
87  size = arguments[1];
88  bundle = arguments[2];
89  }
90 
91  if (!bundle)
92  bundle = [CPBundle mainBundle];
93 
94  if (size)
95  return [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:filename] size:size];
96 
97  return [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:filename]];
98 }
99 
100 function CPAppKitImage(aFilename, aSize)
101 {
102  return CPImageInBundle(aFilename, aSize, [CPBundle bundleForClass:[CPView class]]);
103 }
104 
125 @implementation CPImage : CPObject
126 {
127  CGSize _size;
128  CPString _filename;
129  CPString _name;
130 
131  id <CPImageDelegate> _delegate;
132  unsigned _loadStatus;
133  unsigned _implementedDelegateMethods;
134 
135  Image _image;
136 }
137 
138 - (id)init
139 {
140  return [self initByReferencingFile:@"" size:CGSizeMake(-1, -1)];
141 }
142 
152 - (id)initByReferencingFile:(CPString)aFilename size:(CGSize)aSize
153 {
154  // Quietly return nil like in Cocoa, rather than crashing later.
155  if (aFilename === undefined || aFilename === nil)
156  return nil;
157 
158  self = [super init];
159 
160  if (self)
161  {
162  _size = CGSizeMakeCopy(aSize);
163  _filename = aFilename;
164  _loadStatus = CPImageLoadStatusInitialized;
165  }
166 
167  return self;
168 }
169 
176 - (id)initWithContentsOfFile:(CPString)aFilename size:(CGSize)aSize
177 {
178  self = [self initByReferencingFile:aFilename size:aSize];
179 
180  if (self)
181  [self load];
182 
183  return self;
184 }
185 
192 - (id)initWithContentsOfFile:(CPString)aFilename
193 {
194  self = [self initByReferencingFile:aFilename size:CGSizeMake(-1, -1)];
195 
196  if (self)
197  [self load];
198 
199  return self;
200 }
201 
207 - (id)initWithData:(CPData)someData
208 {
209  var base64 = [someData base64],
210  type = [base64 hasPrefix:@"/9j/4AAQSkZJRgABAQEASABIAAD/"] ? @"jpg" : @"png",
211  dataURL = "data:image/" + type + ";base64," + base64;
212 
213  return [self initWithContentsOfFile:dataURL];
214 }
215 
219 - (CPString)filename
220 {
221  return _filename;
222 }
223 
228 - (CPData)data
229 {
230 #if PLATFORM(DOM)
231  var dataURL;
232 
233  if ([_filename hasPrefix:@"data:image"])
234  dataURL = _filename;
236  {
237  var canvas = document.createElement("canvas"),
238  ctx = canvas.getContext("2d");
239 
240  canvas.width = _image.width;
241  canvas.height = _image.height;
242 
243  ctx.drawImage(_image, 0, 0);
244 
245  dataURL = canvas.toDataURL("image/png");
246  }
247  else
248  return nil;
249 
250  var base64 = dataURL.replace(/^data:image\/png;base64,/, "");
251  return [CPData dataWithBase64:base64];
252 #endif
253 }
254 
259 - (void)setSize:(CGSize)aSize
260 {
261  _size = CGSizeMakeCopy(aSize);
262 }
263 
267 - (CGSize)size
268 {
269  return CGSizeMakeCopy(_size);
270 }
271 
272 + (id)imageNamed:(CPString)aName
273 {
274  var image = imagesForNames[aName];
275 
276  if (image)
277  return image;
278 
279  var imageOrSize = AppKitImageForNames[aName];
280 
281  if (!imageOrSize)
282  return nil;
283 
284  if (!imageOrSize.isa)
285  {
286  imageOrSize = CPAppKitImage("CPImage/" + aName + ".png", imageOrSize);
287 
288  [imageOrSize setName:aName];
289 
290  AppKitImageForNames[aName] = imageOrSize;
291  }
292 
293  return imageOrSize;
294 }
295 
296 - (BOOL)setName:(CPString)aName
297 {
298  if (_name === aName)
299  return YES;
300 
301  if (imagesForNames[aName])
302  return NO;
303 
304  _name = aName;
305 
306  imagesForNames[aName] = self;
307 
308  return YES;
309 }
310 
312 {
313  return _name;
314 }
315 
319 - (Image)image
320 {
321  return _image;
322 }
323 
328 - (void)setDelegate:(id <CPImageDelegate>)aDelegate
329 {
330  if (_delegate === aDelegate)
331  return;
332 
333  _delegate = aDelegate;
334  _implementedDelegateMethods = 0;
335 
336  if ([_delegate respondsToSelector:@selector(imageDidLoad:)])
337  _implementedDelegateMethods |= CPImageDelegate_imageDidLoad_;
338 
339  if ([_delegate respondsToSelector:@selector(imageDidError:)])
340  _implementedDelegateMethods |= CPImageDelegate_imageDidError_;
341 
342  if ([_delegate respondsToSelector:@selector(imageDidAbort:)])
343  _implementedDelegateMethods |= CPImageDelegate_imageDidAbort_;
344 }
345 
349 - (id)delegate
350 {
351  return _delegate;
352 }
353 
357 - (unsigned)loadStatus
358 {
359  return _loadStatus;
360 }
361 
368 - (void)load
369 {
370  if (_loadStatus == CPImageLoadStatusLoading || _loadStatus == CPImageLoadStatusCompleted)
371  return;
372 
373  _loadStatus = CPImageLoadStatusLoading;
374 
375 #if PLATFORM(DOM)
376  _image = new Image();
377 
378  var isSynchronous = YES;
379 
380  // FIXME: We need a better/performance way of doing this.
381  _image.onload = function ()
382  {
383  if (isSynchronous)
384  window.setTimeout(function() { [self _imageDidLoad]; }, 0);
385  else
386  {
387  [self _imageDidLoad];
388  [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
389  }
390  [self _derefFromImage];
391  };
392 
393  _image.onerror = function ()
394  {
395  if (isSynchronous)
396  window.setTimeout(function() { [self _imageDidError]; }, 0);
397  else
398  {
399  [self _imageDidError];
400  [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
401  }
402  [self _derefFromImage];
403  };
404 
405  _image.onabort = function ()
406  {
407  if (isSynchronous)
408  window.setTimeout(function() { [self _imageDidAbort]; }, 0);
409  else
410  {
411  [self _imageDidAbort];
412  [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
413  }
414  [self _derefFromImage];
415  };
416 
417  _image.src = _filename;
418 
419  // onload and friends may fire after this point but BEFORE the end of the run loop,
420  // crazy, I know. So don't set isSynchronous here, rather wait a bit longer.
421  window.setTimeout(function() { isSynchronous = NO; }, 0);
422 #endif
423 }
424 
425 - (BOOL)isSingleImage
426 {
427  return YES;
428 }
429 
430 - (BOOL)isThreePartImage
431 {
432  return NO;
433 }
434 
435 - (BOOL)isNinePartImage
436 {
437  return NO;
438 }
439 
441 {
442  var filename = [self filename],
443  size = [self size];
444 
445  if (filename.indexOf("data:") === 0)
446  {
447  var index = filename.indexOf(",");
448 
449  if (index > 0)
450  filename = [CPString stringWithFormat:@"%s,%s...%s", filename.substr(0, index), filename.substr(index + 1, 10), filename.substr(filename.length - 10)];
451  else
452  filename = "data:<unknown type>";
453  }
454 
455  return [CPString stringWithFormat:ImageDescriptionFormat, [super description], filename, size.width, size.height];
456 }
457 
458 /* @ignore */
459 - (void)_derefFromImage
460 {
461  _image.onload = null;
462  _image.onerror = null;
463  _image.onabort = null;
464 }
465 
466 /* @ignore */
467 - (void)_imageDidLoad
468 {
469  _loadStatus = CPImageLoadStatusCompleted;
470 
471  // FIXME: IE is wrong on image sizes????
472  if (!_size || (_size.width == -1 && _size.height == -1))
473  _size = CGSizeMake(_image.width, _image.height);
474 
476  postNotificationName:CPImageDidLoadNotification
477  object:self];
478 
479  if (_implementedDelegateMethods & CPImageDelegate_imageDidLoad_)
480  [_delegate imageDidLoad:self];
481 }
482 
483 /* @ignore */
484 - (void)_imageDidError
485 {
486  _loadStatus = CPImageLoadStatusReadError;
487 
488  if (_implementedDelegateMethods & CPImageDelegate_imageDidError_)
489  [_delegate imageDidError:self];
490 }
491 
492 /* @ignore */
493 - (void)_imageDidAbort
494 {
495  _loadStatus = CPImageLoadStatusCancelled;
496 
497  if (_implementedDelegateMethods & CPImageDelegate_imageDidAbort_)
498  [_delegate imageDidAbort:self];
499 }
500 
501 @end
502 
503 #pragma mark -
504 #pragma mark CSS Theming
505 
506 // The code below adds support for CSS theming with 100% compatibility with current theming system.
507 // The idea is to extend CPImage (and CPColor) with CSS components and adapt low level UI components to
508 // support this new kind of CPColor/CPImage. See CPImageView, CPView and _CPImageAndTextView.
509 //
510 // To create a CPImage that uses CSS, simply use the new class method :
511 // + (CPImage)imageWithCSSDictionary:(CPDictionary)aDictionary beforeDictionary:(CPDictionary)beforeDictionary afterDictionary:(CPDictionary)afterDictionary size:(CGSize)aSize
512 // where beforeDictionary & afterDictionary are related to ::before & ::after pseudo-elements.
513 // If you don't need them, just use the simplified class method :
514 // + (CPImage)imageWithCSSDictionary:(CPDictionary)aDictionary size:(CGSize)aSize
515 //
516 // Examples :
517 // regularImageNormal = [CPImage imageWithCSSDictionary:@{
518 // @"border-color": A3ColorActiveBorder,
519 // @"border-style": @"solid",
520 // @"border-width": @"1px",
521 // @"border-radius": @"50%",
522 // @"box-sizing": @"border-box",
523 // @"background-color": A3ColorBackgroundWhite,
524 // @"transition-duration": @"0.35s",
525 // @"transition-property": @"all",
526 // @"transition-timing-function": @"ease"
527 // }
528 // size:CGSizeMake(16,16)];
529 //
530 // imageSearch = [CPImage imageWithCSSDictionary:@{
531 // @"background-image": @"url(%%packed.png)",
532 // @"background-position": @"-16px -32px",
533 // @"background-repeat": @"no-repeat",
534 // @"background-size": @"100px 400px"
535 // }
536 // size:CGSizeMake(16,16)];
537 //
538 // Remark : Please note the special URL of the background image used in this example : url(%%packed.png)
539 // During theme loading, "%%" will be replaced by the path to the theme blend resources folder.
540 // Typically, a CSS theme will use some (rare) images all packed together in a single image resource (see packed.png in Aristo3 theme)
541 //
542 // Also, please note that if you don't use one of the CSS components, you can either set it to nil (best solution) or to an empty dictionary, like :
543 // aCssImage = [CPImage imageWithCSSDictionary:@{} beforeDictionary:nil afterDictionary:@{ ... }];
544 //
545 // You can use -(BOOL)isCSSBased to determine how to cope with it in your code.
546 // -(BOOL)hasCSSDictionary, -(BOOL)hasCSSBeforeDictionary and -(BOOL)hasCSSAfterDictionary are convience methods you can use.
547 //
548 // Remark : -(DOMElement)applyCSSImageForView is meant to be used by low level UI widgets (like CPImageView and _CPImageAndTextView) to implement CSS theme support.
549 //
550 // In some circumstances, you may have to clear a CSS image. You can do this easily by replacing your current image with the special dummy empty CSS image :
551 // [CPImage dummyCSSImageOfSize:CGSizeMake(someWidth, someHeight)]
552 
553 @implementation CPImage (CSSTheming)
554 {
555  CPDictionary _cssDictionary;
556  CPDictionary _cssBeforeDictionary;
557  CPDictionary _cssAfterDictionary;
558 }
559 
560 + (CPImage)imageWithCSSDictionary:(CPDictionary)aDictionary size:(CGSize)aSize
561 {
562  return [[CPImage alloc] initWithCSSDictionary:aDictionary beforeDictionary:nil afterDictionary:nil size:aSize];
563 }
564 
565 + (CPImage)imageWithCSSDictionary:(CPDictionary)aDictionary beforeDictionary:(CPDictionary)beforeDictionary afterDictionary:(CPDictionary)afterDictionary size:(CGSize)aSize
566 {
567  return [[CPImage alloc] initWithCSSDictionary:aDictionary beforeDictionary:beforeDictionary afterDictionary:afterDictionary size:aSize];
568 }
569 
570 + (CPImage)dummyCSSImageOfSize:(CGSize)aSize
571 {
572  // This is used to clear a previous CSS image
573  return [[CPImage alloc] initWithCSSDictionary:@{} beforeDictionary:nil afterDictionary:nil size:aSize];
574 }
575 
576 - (id)initWithCSSDictionary:(CPDictionary)aDictionary beforeDictionary:(CPDictionary)beforeDictionary afterDictionary:(CPDictionary)afterDictionary size:(CGSize)aSize
577 {
578  self = [super init];
579 
580  if (self)
581  {
582  _size = CGSizeMakeCopy(aSize);
583  _filename = @"CSS image";
584  _loadStatus = CPImageLoadStatusCompleted;
585  _cssDictionary = aDictionary;
586  _cssBeforeDictionary = beforeDictionary;
587  _cssAfterDictionary = afterDictionary;
588  }
589 
590  return self;
591 }
592 
593 - (BOOL)isCSSBased
594 {
595  return !!(_cssDictionary || _cssBeforeDictionary || _cssAfterDictionary);
596 }
597 
598 - (BOOL)hasCSSDictionary
599 {
600  return ([_cssDictionary count] > 0);
601 }
602 
603 - (BOOL)hasCSSBeforeDictionary
604 {
605  return ([_cssBeforeDictionary count] > 0);
606 }
607 
608 - (BOOL)hasCSSAfterDictionary
609 {
610  return ([_cssAfterDictionary count] > 0);
611 }
612 
613 - (DOMElement)applyCSSImageForView:(CPView)aView onDOMElement:(DOMElement)aDOMElement styleNode:(DOMElement)aStyleNode previousState:(CPArrayRef)aPreviousStateRef
614 {
615 #if PLATFORM(DOM)
616  // First, restore previous CSS styling before applying the new one
617 
618  var aPreviousState = @deref(aPreviousStateRef);
619 
620  for (var i = 0, count = aPreviousState.length; i < count; i++)
621  aDOMElement.style[aPreviousState[i][0]] = aPreviousState[i][1];
622 
623  aPreviousState = @[];
624 
625  // Then apply new CSS styling
626 
627  [_cssDictionary enumerateKeysAndObjectsUsingBlock:function(aKey, anObject, stop)
628  {
629  [aPreviousState addObject:@[aKey, aDOMElement.style[aKey]]];
630  aDOMElement.style[aKey] = anObject;
631  }];
632 
633  if (_cssBeforeDictionary || _cssAfterDictionary)
634  {
635  // We need to create a unique class name
636 
637  var styleClassName = @".CP" + [aView UID],
638  styleContent = @"";
639 
640  if (_cssBeforeDictionary)
641  {
642  styleContent += styleClassName + @"::before { ";
643 
644  [_cssBeforeDictionary enumerateKeysAndObjectsUsingBlock:function(aKey, anObject, stop)
645  {
646  styleContent += aKey + ": " + anObject + "; ";
647  }];
648 
649  styleContent += "} ";
650  }
651 
652  if (_cssAfterDictionary)
653  {
654  styleContent += styleClassName + @"::after { ";
655 
656  [_cssAfterDictionary enumerateKeysAndObjectsUsingBlock:function(aKey, anObject, stop)
657  {
658  styleContent += aKey + ": " + anObject + "; ";
659  }];
660 
661  styleContent += "} ";
662  }
663 
664  var styleDescription = document.createTextNode(styleContent);
665 
666  if (!aStyleNode)
667  {
668  aStyleNode = document.createElement("style");
669 
670  aView._DOMElement.insertBefore(aStyleNode, aView._DOMElement.firstChild);
671 
672  aStyleNode.appendChild(styleDescription);
673  }
674  else
675  {
676  aStyleNode.replaceChild(styleDescription, aStyleNode.firstChild);
677  }
678 
679  [aView setDOMClassName:@"CP"+[aView UID]];
680  }
681  else
682  {
683  // no before/after so remove aStyleNode if existing
684 
685  if (aStyleNode)
686  {
687  aView._DOMElement.removeChild(aStyleNode);
688  aStyleNode = nil;
689  }
690  }
691 
692 
693  // Return actualised values
694 
695  @deref(aPreviousStateRef) = aPreviousState;
696 
697  return aStyleNode;
698 #endif
699 }
700 
701 @end
702 
703 var CPImageCSSDictionaryKey = @"CPImageCSSDictionaryKey",
704  CPImageCSSBeforeDictionaryKey = @"CPImageCSSBeforeDictionaryKey",
705  CPImageCSSAfterDictionaryKey = @"CPImageCSSAfterDictionaryKey";
706 
707 #pragma mark -
708 
709 @implementation CPImage (CPCoding)
710 
716 - (id)initWithCoder:(CPCoder)aCoder
717 {
718  if ([aCoder containsValueForKey:CPImageCSSDictionaryKey])
719  return [self initWithCSSDictionary:[aCoder decodeObjectForKey:CPImageCSSDictionaryKey] beforeDictionary:[aCoder decodeObjectForKey:CPImageCSSBeforeDictionaryKey] afterDictionary:[aCoder decodeObjectForKey:CPImageCSSAfterDictionaryKey] size:[aCoder decodeSizeForKey:@"CPSize"]];
720  else
721  return [self initWithContentsOfFile:[aCoder decodeObjectForKey:@"CPFilename"] size:[aCoder decodeSizeForKey:@"CPSize"]];
722 }
723 
728 - (void)encodeWithCoder:(CPCoder)aCoder
729 {
730  [aCoder encodeObject:_filename forKey:@"CPFilename"];
731  [aCoder encodeSize:_size forKey:@"CPSize"];
732 
733  // CSS Styling
734  if ([self isCSSBased])
735  {
736  [aCoder encodeObject:_cssDictionary forKey:CPImageCSSDictionaryKey];
737  [aCoder encodeObject:_cssBeforeDictionary forKey:CPImageCSSBeforeDictionaryKey];
738  [aCoder encodeObject:_cssAfterDictionary forKey:CPImageCSSAfterDictionaryKey];
739  }
740 }
741 
742 @end
743 
744 @implementation CPThreePartImage : CPObject
745 {
746  CPArray _imageSlices;
747  BOOL _isVertical;
748 }
749 
750 - (id)initWithImageSlices:(CPArray)imageSlices isVertical:(BOOL)isVertical
751 {
752  self = [super init];
753 
754  if (self)
755  {
756  _imageSlices = imageSlices;
757  _isVertical = isVertical;
758  }
759 
760  return self;
761 }
762 
763 - (CPString)filename
764 {
765  return @"";
766 }
767 
768 - (CPArray)imageSlices
769 {
770  return _imageSlices;
771 }
772 
773 - (BOOL)isVertical
774 {
775  return _isVertical;
776 }
777 
778 - (BOOL)isSingleImage
779 {
780  return NO;
781 }
782 
783 - (BOOL)isThreePartImage
784 {
785  return YES;
786 }
787 
788 - (BOOL)isNinePartImage
789 {
790  return NO;
791 }
792 
793 @end
794 
795 var CPThreePartImageImageSlicesKey = @"CPThreePartImageImageSlicesKey",
796  CPThreePartImageIsVerticalKey = @"CPThreePartImageIsVerticalKey";
797 
799 
800 - (id)initWithCoder:(CPCoder)aCoder
801 {
802  self = [super init];
803 
804  if (self)
805  {
806  _imageSlices = [aCoder decodeObjectForKey:CPThreePartImageImageSlicesKey];
807  _isVertical = [aCoder decodeBoolForKey:CPThreePartImageIsVerticalKey];
808  }
809 
810  return self;
811 }
812 
813 - (void)encodeWithCoder:(CPCoder)aCoder
814 {
815  [aCoder encodeObject:_imageSlices forKey:CPThreePartImageImageSlicesKey];
816  [aCoder encodeBool:_isVertical forKey:CPThreePartImageIsVerticalKey];
817 }
818 
819 @end
820 
821 
822 @implementation CPNinePartImage : CPObject
823 {
824  CPArray _imageSlices;
825 }
826 
827 - (id)initWithImageSlices:(CPArray)imageSlices
828 {
829  self = [super init];
830 
831  if (self)
832  _imageSlices = imageSlices;
833 
834  return self;
835 }
836 
837 - (CPString)filename
838 {
839  return @"";
840 }
841 
842 - (CPArray)imageSlices
843 {
844  return _imageSlices;
845 }
846 
847 - (BOOL)isSingleImage
848 {
849  return NO;
850 }
851 
852 - (BOOL)isThreePartImage
853 {
854  return NO;
855 }
856 
857 - (BOOL)isNinePartImage
858 {
859  return YES;
860 }
861 
862 @end
863 
864 var CPNinePartImageImageSlicesKey = @"CPNinePartImageImageSlicesKey";
865 
867 
868 - (id)initWithCoder:(CPCoder)aCoder
869 {
870  self = [super init];
871 
872  if (self)
873  _imageSlices = [aCoder decodeObjectForKey:CPNinePartImageImageSlicesKey];
874 
875  return self;
876 }
877 
878 - (void)encodeWithCoder:(CPCoder)aCoder
879 {
880  [aCoder encodeObject:_imageSlices forKey:CPNinePartImageImageSlicesKey];
881 }
882 
883 @end
CPImageLoadStatusUnexpectedEOF
Definition: CPImage.j:44
function CPImageInBundle()
Definition: CPImage.j:72
var AppKitImageForNames
Definition: CPImage.j:54
id init()
Definition: CALayer.j:126
CPImageLoadStatusLoading
Definition: CPImage.j:40
var CPThreePartImageIsVerticalKey
Definition: CPImage.j:796
CGSize size()
Definition: CPImage.j:267
The main run loop for the application.
Definition: CPRunLoop.h:2
var ImageDescriptionFormat
Definition: CPImage.j:55
CPImageNameColorPanelHighlighted
Definition: CPImage.j:51
CPImageLoadStatusCompleted
Definition: CPImage.j:41
id delegate()
Definition: CALayer.j:965
var CPNinePartImageImageSlicesKey
Definition: CPImage.j:864
A Cappuccino wrapper for any data type.
Definition: CPData.h:2
void postNotificationName:object:(CPString aNotificationName, [object] id anObject)
var CPImageDelegate_imageDidError_
Definition: CPImage.j:36
CPImageLoadStatusInvalidData
Definition: CPImage.j:43
CPImageNameColorPanel
Definition: CPImage.j:50
CPString description()
Definition: CPObject.j:358
CPNotificationCenter defaultCenter()
A mutable key-value pair collection.
Definition: CPDictionary.h:2
CPRunLoop currentRunLoop()
Definition: CPRunLoop.j:232
var CPImageCSSBeforeDictionaryKey
Definition: CPImage.j:704
An immutable string (collection of characters).
Definition: CPString.h:2
CPBundle mainBundle()
Definition: CPBundle.j:82
var CPThreePartImageImageSlicesKey
Definition: CPImage.j:795
CPData dataWithBase64:(CPString aString)
Definition: CPData.j:73
Definition: CPImage.h:2
function CPFeatureIsCompatible(aFeature)
CPImageDidLoadNotification
Definition: CPImage.j:47
id initWithContentsOfFile:size:(CPString aFilename, [size] CGSize aSize)
Definition: CPImage.j:176
function CPAppKitImage(aFilename, aSize)
Definition: CPImage.j:100
CPImageLoadStatusReadError
Definition: CPImage.j:45
id initWithContentsOfFile:(CPString aFilename)
Definition: CPImage.j:192
CPHTMLCanvasFeature
CPDate limitDateForMode:(CPString aMode)
Definition: CPRunLoop.j:342
CPString name
Definition: CPException.j:47
CPString filename()
Definition: CPImage.j:219
void setDOMClassName:(CPString aClassName)
Definition: CPView.j:3457
CPImageLoadStatusCancelled
Definition: CPImage.j:42
Defines methods for use when archiving & restoring (enc/decoding).
Definition: CPCoder.h:2
void load()
Definition: CPImage.j:368
id init()
Definition: CPObject.j:145
Sends messages (CPNotification) between objects.
var CPImageCSSDictionaryKey
Definition: CPImage.j:703
CPImageLoadStatusInitialized
Definition: CPImage.j:39
var CPImageDelegate_imageDidAbort_
Definition: CPImage.j:37
var imagesForNames
Definition: CPImage.j:53
id initByReferencingFile:size:(CPString aFilename, [size] CGSize aSize)
Definition: CPImage.j:152
CPString base64()
Definition: CPData.j:141
id initWithCSSDictionary:beforeDictionary:afterDictionary:size:(CPDictionary aDictionary, [beforeDictionary] CPDictionary beforeDictionary, [afterDictionary] CPDictionary afterDictionary, [size] CGSize aSize)
Definition: CPImage.j:576
id alloc()
Definition: CPObject.j:130
var CPImageDelegate_imageDidLoad_
Definition: CPImage.j:35
Definition: CPView.j:137
var CPImageCSSAfterDictionaryKey
Definition: CPImage.j:705
id stringWithFormat:(CPString format, [,] ...)
Definition: CPString.j:166
FrameUpdater prototype description