sugarcube 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,2 +1,3 @@
1
1
  language: objective-c
2
2
  before_install: rvm use ruby-1.9.3-p392
3
+ before_script: sudo chown -R travis ~/Library/RubyMotion
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sugarcube (1.0.1)
4
+ sugarcube (1.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -331,7 +331,7 @@ module SugarCube
331
331
  if self == item || $sugarcube_view == item
332
332
  print "\033[1m"
333
333
  end
334
- if item.is_a? UIView
334
+ if item.is_a?(UIView) && item.method(:to_s).arity == -1
335
335
  puts item.to_s superview: false
336
336
  else
337
337
  puts item.to_s
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '1.0.1'
2
+ Version = '1.0.2'
3
3
  end
@@ -31,6 +31,21 @@ class UIImage
31
31
  return new_image
32
32
  end
33
33
 
34
+ # Returns a cropped UIImage
35
+ def crop(rect)
36
+ if self.scale > 1.0
37
+ rect = CGRectMake(rect.origin.x * self.scale,
38
+ rect.origin.y * self.scale,
39
+ rect.size.width * self.scale,
40
+ rect.size.height * self.scale)
41
+ end
42
+
43
+ cgimage = CGImageCreateWithImageInRect(self.CGImage, rect)
44
+ result = UIImage.imageWithCGImage(cgimage, scale:self.scale, orientation:self.imageOrientation)
45
+
46
+ return result
47
+ end
48
+
34
49
  ##|
35
50
  ##| image scaling
36
51
  ##|
data/sugarcube.gemspec CHANGED
@@ -4,6 +4,7 @@ require File.expand_path('../lib/sugarcube/version.rb', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = 'sugarcube'
6
6
  gem.version = SugarCube::Version
7
+ gem.licenses = ['BSD']
7
8
 
8
9
  gem.authors = ['Colin T.A. Gray', 'Thom Parkin', 'Katsuyoshi Ito', 'Michael Erasmus']
9
10
  gem.email = ['colinta@gmail.com']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-07-24 00:00:00.000000000 Z
15
+ date: 2013-07-29 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description: ! '== Description
18
18
 
@@ -245,7 +245,8 @@ files:
245
245
  - spec/unholy_spec.rb
246
246
  - sugarcube.gemspec
247
247
  homepage: https://github.com/rubymotion/sugarcube
248
- licenses: []
248
+ licenses:
249
+ - BSD
249
250
  post_install_message:
250
251
  rdoc_options: []
251
252
  require_paths: