mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-27 13:48:51 +08:00
Clamp grayscale values to 0..1 for g operator
This commit is contained in:
parent
606a271d00
commit
e7433e4125
@ -248,8 +248,11 @@ func (this *PdfColorspaceDeviceGray) ColorFromFloats(vals []float64) (PdfColor,
|
||||
|
||||
val := vals[0]
|
||||
|
||||
if val < 0.0 || val > 1.0 {
|
||||
return nil, errors.New("Range check")
|
||||
// Needed for ~/testdata/acl2017_hllz.pdf
|
||||
if val < 0.0 {
|
||||
val = 0.0
|
||||
} else if val > 1.0 {
|
||||
val = 1.0
|
||||
}
|
||||
|
||||
return NewPdfColorDeviceGray(val), nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user