SVGRect.m 844 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #import "SVGRect.h"
  2. #import "SVGKDefine_Private.h"
  3. BOOL SVGRectIsInitialized( SVGRect rect )
  4. {
  5. return rect.x != -1 || rect.y != -1 || rect.width != -1 || rect.height != -1;
  6. }
  7. SVGRect SVGRectUninitialized( void )
  8. {
  9. return SVGRectMake( -1, -1, -1, -1 );
  10. }
  11. SVGRect SVGRectMake( float x, float y, float width, float height )
  12. {
  13. SVGRect result = { x, y, width, height };
  14. return result;
  15. }
  16. CGRect CGRectFromSVGRect( SVGRect rect )
  17. {
  18. CGRect result = CGRectMake(rect.x, rect.y, rect.width, rect.height);
  19. return result;
  20. }
  21. CGSize CGSizeFromSVGRect( SVGRect rect )
  22. {
  23. CGSize result = CGSizeMake( rect.width, rect.height );
  24. return result;
  25. }
  26. NSString * NSStringFromSVGRect( SVGRect rect ) {
  27. CGRect cgRect = CGRectFromSVGRect(rect);
  28. #if SVGKIT_MAC
  29. return NSStringFromRect(cgRect);
  30. #else
  31. return NSStringFromCGRect(cgRect);
  32. #endif
  33. }