parseQualityInt parses a quality integer option value (minQ-100)
( ctx context.Context, o *options.Options, key string, minQ int, args ...string, )
| 179 | |
| 180 | // parseQualityInt parses a quality integer option value (minQ-100) |
| 181 | func (p *Parser) parseQualityInt( |
| 182 | ctx context.Context, |
| 183 | o *options.Options, |
| 184 | key string, |
| 185 | minQ int, |
| 186 | args ...string, |
| 187 | ) error { |
| 188 | if err := p.ensureMaxArgs(ctx, key, args, 1); err != nil { |
| 189 | return err |
| 190 | } |
| 191 | |
| 192 | i, err := strconv.Atoi(args[0]) |
| 193 | if err != nil || i < minQ || i > 100 { |
| 194 | return newInvalidArgumentError(ctx, key, args[0], fmt.Sprintf("number in range %d-100", minQ)) |
| 195 | } |
| 196 | |
| 197 | o.Set(key, i) |
| 198 | |
| 199 | return nil |
| 200 | } |
| 201 | |
| 202 | // parseOpacityFloat parses an opacity float option value (0-1) |
| 203 | func (p *Parser) parseOpacityFloat( |
no test coverage detected