pixelart 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +2 -0
- data/lib/pixelart/base.rb +2 -0
- data/lib/pixelart/circle.rb +46 -0
- data/lib/pixelart/image.rb +11 -0
- data/lib/pixelart/ukraine.rb +33 -0
- data/lib/pixelart/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfdb6f457e12b2e76af0f8ad601d884e763b111a42031cb4ca687026e26fec9d
|
4
|
+
data.tar.gz: 920c3d4d76effc32b6b37c865f960bd1d9b2a5711d5355a5ec681f2d0d38778f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a584e986e1ada98617770a43979bd0f808105aac525e947e23549c5ad2dc89cfd3445380dce8773cbf8a9682c49e0ffba35642270c27db33ac76315c744ef203
|
7
|
+
data.tar.gz: c427b35da5186c6505af7364c64c71992174b8f5c3c7ea4330d8599caa55d6d7ef7554f0e154401eb8602c924be6045249af8212c76be37b7da60ca930c8a49c
|
data/Manifest.txt
CHANGED
@@ -5,6 +5,7 @@ Rakefile
|
|
5
5
|
lib/pixelart.rb
|
6
6
|
lib/pixelart/base.rb
|
7
7
|
lib/pixelart/blur.rb
|
8
|
+
lib/pixelart/circle.rb
|
8
9
|
lib/pixelart/color.rb
|
9
10
|
lib/pixelart/composite.rb
|
10
11
|
lib/pixelart/gradient.rb
|
@@ -17,5 +18,6 @@ lib/pixelart/silhouette.rb
|
|
17
18
|
lib/pixelart/sketch.rb
|
18
19
|
lib/pixelart/spots.rb
|
19
20
|
lib/pixelart/transparent.rb
|
21
|
+
lib/pixelart/ukraine.rb
|
20
22
|
lib/pixelart/vector.rb
|
21
23
|
lib/pixelart/version.rb
|
data/lib/pixelart/base.rb
CHANGED
@@ -38,10 +38,12 @@ require 'pixelart/misc' ## misc helpers
|
|
38
38
|
|
39
39
|
#########################
|
40
40
|
# (special) effects / filters / etc
|
41
|
+
require 'pixelart/circle'
|
41
42
|
require 'pixelart/led'
|
42
43
|
require 'pixelart/sketch'
|
43
44
|
require 'pixelart/transparent'
|
44
45
|
require 'pixelart/silhouette'
|
46
|
+
require 'pixelart/ukraine'
|
45
47
|
|
46
48
|
|
47
49
|
## (special) effects / filters that require imagemagick
|
@@ -0,0 +1,46 @@
|
|
1
|
+
###
|
2
|
+
#
|
3
|
+
# add more circle aliases
|
4
|
+
# e.g. circular / round or such - why? why not?
|
5
|
+
|
6
|
+
|
7
|
+
module Pixelart
|
8
|
+
|
9
|
+
class Image
|
10
|
+
def circle
|
11
|
+
### for radius use min of width / height
|
12
|
+
r = [@img.width, @img.height].min / 2
|
13
|
+
|
14
|
+
center_x = width / 2
|
15
|
+
center_y = height / 2
|
16
|
+
|
17
|
+
################
|
18
|
+
# try with 96x96
|
19
|
+
# center_x: 96 / 2 = 48
|
20
|
+
# center_y: 96 / 2 = 48
|
21
|
+
#
|
22
|
+
# r: 96 / 2 = 48
|
23
|
+
|
24
|
+
img = Image.new( @img.width, @img.height )
|
25
|
+
|
26
|
+
@img.width.times do |x|
|
27
|
+
@img.height.times do |y|
|
28
|
+
|
29
|
+
## change to float calcuation (instead of ints) - why? why not?
|
30
|
+
xx, yy, rr = x - center_x,
|
31
|
+
y - center_y,
|
32
|
+
r
|
33
|
+
|
34
|
+
img[ x, y] = if xx*xx+yy*yy < rr*rr
|
35
|
+
@img[ x, y ]
|
36
|
+
else
|
37
|
+
0 ## transparent - alpha(0)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
img
|
43
|
+
end
|
44
|
+
end # class Image
|
45
|
+
|
46
|
+
end # module Pixelart
|
data/lib/pixelart/image.rb
CHANGED
@@ -121,6 +121,17 @@ alias_method :flip_vertically, :mirror
|
|
121
121
|
alias_method :flop, :mirror
|
122
122
|
|
123
123
|
|
124
|
+
def rotate_counter_clockwise # 90 degrees
|
125
|
+
img = @img.rotate_counter_clockwise
|
126
|
+
Image.new( img.width, img.height, img )
|
127
|
+
end
|
128
|
+
alias_method :rotate_left, :rotate_counter_clockwise
|
129
|
+
|
130
|
+
def rotate_clockwise # 90 degrees
|
131
|
+
img = @img.rotate_clockwise
|
132
|
+
Image.new( img.width, img.height, img )
|
133
|
+
end
|
134
|
+
alias_method :rotate_right, :rotate_clockwise
|
124
135
|
|
125
136
|
|
126
137
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#######
|
2
|
+
#
|
3
|
+
# Glory To Ukraine! Fuck (Vladimir) Putin! Stop the War!
|
4
|
+
# Send A Stop The War Message To The World With Your Pixel Art Images
|
5
|
+
#
|
6
|
+
|
7
|
+
|
8
|
+
module Pixelart
|
9
|
+
|
10
|
+
class Image
|
11
|
+
def ukraine
|
12
|
+
### move colors to (reusable) constants e.g.
|
13
|
+
### UKRAINE_BLUE
|
14
|
+
### UKRAINE_YELLOW - why? why not?
|
15
|
+
ukraine_blue = Color.parse( '#0057b7' )
|
16
|
+
ukraine_yellow = Color.parse( '#ffdd00' )
|
17
|
+
|
18
|
+
img = Image.new( @img.width, @img.height )
|
19
|
+
|
20
|
+
@img.height.times do |y|
|
21
|
+
color = (y < @img.height/2) ? ukraine_blue : ukraine_yellow
|
22
|
+
@img.width.times do |x|
|
23
|
+
img[x,y] = color
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
img.compose!( self ) ## paste/compose image onto backgorund
|
28
|
+
img
|
29
|
+
end
|
30
|
+
end # class Image
|
31
|
+
|
32
|
+
end # module Pixelart
|
33
|
+
|
data/lib/pixelart/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixelart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/pixelart.rb
|
104
104
|
- lib/pixelart/base.rb
|
105
105
|
- lib/pixelart/blur.rb
|
106
|
+
- lib/pixelart/circle.rb
|
106
107
|
- lib/pixelart/color.rb
|
107
108
|
- lib/pixelart/composite.rb
|
108
109
|
- lib/pixelart/gradient.rb
|
@@ -115,6 +116,7 @@ files:
|
|
115
116
|
- lib/pixelart/sketch.rb
|
116
117
|
- lib/pixelart/spots.rb
|
117
118
|
- lib/pixelart/transparent.rb
|
119
|
+
- lib/pixelart/ukraine.rb
|
118
120
|
- lib/pixelart/vector.rb
|
119
121
|
- lib/pixelart/version.rb
|
120
122
|
homepage: https://github.com/pixelartexchange/pixel
|