mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 09:15:57 +02:00
...
This commit is contained in:
@@ -438,15 +438,3 @@ func NewNRGBWithContiguousRGBPixels(p []byte, width, height int) (*NRGB, error)
|
||||
Rect: image.Rectangle{image.Point{}, image.Point{width, height}},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewNRGBAWithContiguousRGBAPixels(p []byte, width, height int) (*image.NRGBA, error) {
|
||||
const bpp = 4
|
||||
if expected := bpp * width * height; expected != len(p) {
|
||||
return nil, fmt.Errorf("the image width and height dont match the size of the specified pixel data: width=%d height=%d sz=%d != %d", width, height, len(p), expected)
|
||||
}
|
||||
return &image.NRGBA{
|
||||
Pix: p,
|
||||
Stride: bpp * width,
|
||||
Rect: image.Rectangle{image.Point{}, image.Point{width, height}},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -405,3 +405,15 @@ func FitImage(width, height, pwidth, pheight int) (final_width int, final_height
|
||||
|
||||
return width, height
|
||||
}
|
||||
|
||||
func NewNRGBAWithContiguousRGBAPixels(p []byte, width, height int) (*image.NRGBA, error) {
|
||||
const bpp = 4
|
||||
if expected := bpp * width * height; expected != len(p) {
|
||||
return nil, fmt.Errorf("the image width and height dont match the size of the specified pixel data: width=%d height=%d sz=%d != %d", width, height, len(p), expected)
|
||||
}
|
||||
return &image.NRGBA{
|
||||
Pix: p,
|
||||
Stride: bpp * width,
|
||||
Rect: image.Rectangle{image.Point{}, image.Point{width, height}},
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user