Browse Source
Also: * Move stuff around to a builtin/ folder * Separate out classes to follow my one-class-per-file convention * Samples are renamed to the underscore convention I just like the word "sprue", and it's more descriptive than our original choice of "template". If I had to start Squib all over again, I would probably name it "Sprue" :Pdev
35 changed files with 127 additions and 285 deletions
@ -1,42 +0,0 @@
|
||||
--- |
||||
sheet_width: 210mm |
||||
sheet_height: 297mm |
||||
card_width: 59.0mm |
||||
card_height: 92.0mm |
||||
cards: |
||||
- x: 16.5mm |
||||
y: 10.0mm |
||||
- x: 75.5mm |
||||
y: 10.0mm |
||||
- x: 134.5mm |
||||
y: 10.0mm |
||||
- x: 16.5mm |
||||
y: 102.0mm |
||||
- x: 75.5mm |
||||
y: 102.0mm |
||||
- x: 134.5mm |
||||
y: 102.0mm |
||||
- x: 16.5mm |
||||
y: 194.0mm |
||||
- x: 75.5mm |
||||
y: 194.0mm |
||||
- x: 134.5mm |
||||
y: 194.0mm |
||||
crop_line: |
||||
lines: |
||||
- type: :vertical |
||||
position: 16.5mm |
||||
- type: :vertical |
||||
position: 75.5mm |
||||
- type: :vertical |
||||
position: 134.5mm |
||||
- type: :vertical |
||||
position: 193.5mm |
||||
- type: :horizontal |
||||
position: 10.0mm |
||||
- type: :horizontal |
||||
position: 102.0mm |
||||
- type: :horizontal |
||||
position: 194.0mm |
||||
- type: :horizontal |
||||
position: 286.0mm |
||||
@ -1,40 +0,0 @@
|
||||
--- |
||||
sheet_width: 297mm |
||||
sheet_height: 210mm |
||||
card_width: 63.0mm |
||||
card_height: 88.0mm |
||||
cards: |
||||
- x: 22.5mm |
||||
y: 10.0mm |
||||
- x: 85.5mm |
||||
y: 10.0mm |
||||
- x: 148.5mm |
||||
y: 10.0mm |
||||
- x: 211.5mm |
||||
y: 10.0mm |
||||
- x: 22.5mm |
||||
y: 98.0mm |
||||
- x: 85.5mm |
||||
y: 98.0mm |
||||
- x: 148.5mm |
||||
y: 98.0mm |
||||
- x: 211.5mm |
||||
y: 98.0mm |
||||
crop_line: |
||||
lines: |
||||
- type: :vertical |
||||
position: 22.5mm |
||||
- type: :vertical |
||||
position: 85.5mm |
||||
- type: :vertical |
||||
position: 148.5mm |
||||
- type: :vertical |
||||
position: 211.5mm |
||||
- type: :vertical |
||||
position: 274.5mm |
||||
- type: :horizontal |
||||
position: 10.0mm |
||||
- type: :horizontal |
||||
position: 98.0mm |
||||
- type: :horizontal |
||||
position: 186.0mm |
||||
@ -1,42 +0,0 @@
|
||||
--- |
||||
sheet_width: 210mm |
||||
sheet_height: 297mm |
||||
card_width: 63.0mm |
||||
card_height: 88.0mm |
||||
cards: |
||||
- x: 10.5mm |
||||
y: 10.0mm |
||||
- x: 73.5mm |
||||
y: 10.0mm |
||||
- x: 136.5mm |
||||
y: 10.0mm |
||||
- x: 10.5mm |
||||
y: 98.0mm |
||||
- x: 73.5mm |
||||
y: 98.0mm |
||||
- x: 136.5mm |
||||
y: 98.0mm |
||||
- x: 10.5mm |
||||
y: 186.0mm |
||||
- x: 73.5mm |
||||
y: 186.0mm |
||||
- x: 136.5mm |
||||
y: 186.0mm |
||||
crop_line: |
||||
lines: |
||||
- type: :vertical |
||||
position: 10.5mm |
||||
- type: :vertical |
||||
position: 73.5mm |
||||
- type: :vertical |
||||
position: 136.5mm |
||||
- type: :vertical |
||||
position: 199.5mm |
||||
- type: :horizontal |
||||
position: 10.0mm |
||||
- type: :horizontal |
||||
position: 98.0mm |
||||
- type: :horizontal |
||||
position: 186.0mm |
||||
- type: :horizontal |
||||
position: 274.0mm |
||||
@ -1,42 +0,0 @@
|
||||
--- |
||||
sheet_width: 210mm |
||||
sheet_height: 297mm |
||||
card_width: 56.0mm |
||||
card_height: 87.0mm |
||||
cards: |
||||
- x: 21.0mm |
||||
y: 10.0mm |
||||
- x: 77.0mm |
||||
y: 10.0mm |
||||
- x: 133.0mm |
||||
y: 10.0mm |
||||
- x: 21.0mm |
||||
y: 97.0mm |
||||
- x: 77.0mm |
||||
y: 97.0mm |
||||
- x: 133.0mm |
||||
y: 97.0mm |
||||
- x: 21.0mm |
||||
y: 184.0mm |
||||
- x: 77.0mm |
||||
y: 184.0mm |
||||
- x: 133.0mm |
||||
y: 184.0mm |
||||
crop_line: |
||||
lines: |
||||
- type: :vertical |
||||
position: 21.0mm |
||||
- type: :vertical |
||||
position: 77.0mm |
||||
- type: :vertical |
||||
position: 133.0mm |
||||
- type: :vertical |
||||
position: 189.0mm |
||||
- type: :horizontal |
||||
position: 10.0mm |
||||
- type: :horizontal |
||||
position: 97.0mm |
||||
- type: :horizontal |
||||
position: 184.0mm |
||||
- type: :horizontal |
||||
position: 271.0mm |
||||
@ -0,0 +1,28 @@
|
||||
module Squib |
||||
module Sprues |
||||
class CropLine |
||||
attr_reader :x1, :y1, :x2, :y2 |
||||
|
||||
def initialize(type, position, sheet_width, sheet_height, dpi) |
||||
method = "parse_#{type}" |
||||
send method, position, sheet_width, sheet_height, dpi |
||||
end |
||||
|
||||
def parse_horizontal(position, sheet_width, _, dpi) |
||||
position = Args::UnitConversion.parse(position, dpi) |
||||
@x1 = 0 |
||||
@y1 = position |
||||
@x2 = sheet_width |
||||
@y2 = position |
||||
end |
||||
|
||||
def parse_vertical(position, _, sheet_height, dpi) |
||||
position = Args::UnitConversion.parse(position, dpi) |
||||
@x1 = position |
||||
@y1 = 0 |
||||
@x2 = position |
||||
@y2 = sheet_height |
||||
end |
||||
end |
||||
end |
||||
end |
||||
@ -0,0 +1,35 @@
|
||||
module Squib |
||||
module Sprues |
||||
class CropLineDash |
||||
VALIDATION_REGEX = /%r{ |
||||
^(\d*[.])?\d+(in|cm|mm) |
||||
\s+ |
||||
(\d*[.])?\d+(in|cm|mm)$ |
||||
}x/ |
||||
|
||||
attr_reader :pattern |
||||
|
||||
def initialize(value, dpi) |
||||
if value == :solid |
||||
@pattern = nil |
||||
elsif value == :dotted |
||||
@pattern = [ |
||||
Args::UnitConversion.parse('0.2mm', dpi), |
||||
Args::UnitConversion.parse('0.5mm', dpi) |
||||
] |
||||
elsif value == :dashed |
||||
@pattern = [ |
||||
Args::UnitConversion.parse('2mm', dpi), |
||||
Args::UnitConversion.parse('2mm', dpi) |
||||
] |
||||
elsif value.is_a? String |
||||
@pattern = value.split(' ').map do |val| |
||||
Args::UnitConversion.parse val, dpi |
||||
end |
||||
else |
||||
raise ArgumentError, 'Unsupported dash style' |
||||
end |
||||
end |
||||
end |
||||
end |
||||
end |
||||
Loading…
Reference in new issue