Transmission format should be per frame
This commit is contained in:
parent
4623f580b9
commit
481cebbd29
@ -34,7 +34,7 @@ func add_frame(imgd *image_data, img image.Image, is_opaque bool) {
|
||||
rgb = &images.NRGB{Pix: m.Slice(), Stride: 3 * f.width, Rect: dest_rect}
|
||||
f.shm = m
|
||||
}
|
||||
imgd.format_uppercase = "RGB"
|
||||
f.transmission_format_uppercase = "RGB"
|
||||
f.in_memory_bytes = rgb.Pix
|
||||
final_img = rgb
|
||||
} else {
|
||||
@ -46,7 +46,7 @@ func add_frame(imgd *image_data, img image.Image, is_opaque bool) {
|
||||
rgba = &image.NRGBA{Pix: m.Slice(), Stride: 4 * f.width, Rect: dest_rect}
|
||||
f.shm = m
|
||||
}
|
||||
imgd.format_uppercase = "RGBA"
|
||||
f.transmission_format_uppercase = "RGBA"
|
||||
f.in_memory_bytes = rgba.Pix
|
||||
final_img = rgba
|
||||
}
|
||||
|
||||
@ -137,11 +137,12 @@ func (self *opened_input) Release() {
|
||||
}
|
||||
|
||||
type image_frame struct {
|
||||
filename string
|
||||
shm shm.MMap
|
||||
in_memory_bytes []byte
|
||||
filename_is_temporary bool
|
||||
width, height int
|
||||
filename string
|
||||
shm shm.MMap
|
||||
in_memory_bytes []byte
|
||||
filename_is_temporary bool
|
||||
width, height int
|
||||
transmission_format_uppercase string
|
||||
}
|
||||
|
||||
type image_data struct {
|
||||
@ -190,6 +191,7 @@ func make_output_from_input(imgd *image_data, f *opened_input) {
|
||||
imgd.frames = append(imgd.frames, &frame)
|
||||
frame.width = imgd.canvas_width
|
||||
frame.height = imgd.canvas_height
|
||||
frame.transmission_format_uppercase = imgd.format_uppercase
|
||||
if ok {
|
||||
frame.in_memory_bytes = bb.data
|
||||
} else {
|
||||
|
||||
@ -32,13 +32,15 @@ func gc_for_image(imgd *image_data, frame_num int, frame *image_frame) *graphics
|
||||
if imgd.image_number != 0 {
|
||||
gc.SetImageNumber(imgd.image_number)
|
||||
}
|
||||
switch imgd.format_uppercase {
|
||||
switch frame.transmission_format_uppercase {
|
||||
case "PNG":
|
||||
gc.SetFormat(graphics.GRT_format_png)
|
||||
default:
|
||||
case "RGB":
|
||||
gc.SetFormat(graphics.GRT_format_rgb)
|
||||
case "RGBA":
|
||||
gc.SetFormat(graphics.GRT_format_rgba)
|
||||
default:
|
||||
panic(fmt.Sprintf("Unknown transmission format: %s", frame.transmission_format_uppercase))
|
||||
}
|
||||
|
||||
return &gc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user