예제 #1
0
 def draw_ga_pixel(self, pixel, x, y):
     sample_len = len(pixel)
     gray = int_from_bytes(pixel[0:sample_len])
     alpha = int_from_bytes(pixel[sample_len:sample_len * 2])
     color = QRgba64.fromRgba64(gray, gray, gray, alpha).toArgb32() \
         if sample_len == 2 else QColor(gray, gray, gray, alpha).rgba()
     self.image.setPixel(x, y, color)
예제 #2
0
 def draw_rgb_pixel(self, pixel, x, y):
     sample_len = len(pixel) // 3
     red = int_from_bytes(pixel[0:sample_len])
     green = int_from_bytes(pixel[sample_len:sample_len * 2])
     blue = int_from_bytes(pixel[sample_len * 2:sample_len * 3])
     color = QRgba64.fromRgba64(red, green, blue, 65535).toArgb32() \
         if sample_len == 2 else QColor(red, green, blue).rgba()
     self.image.setPixel(x, y, color)
예제 #3
0
 def draw_palette_pixel(self, pixel, x, y):
     index = int_from_bytes(pixel)
     color = self.get_palette_color(index)
     self.image.setPixel(x, y, QColor(*color).rgba())
예제 #4
0
 def draw_g_pixel(self, pixel, x, y):
     sample_len = len(pixel)
     gray = int_from_bytes(pixel)
     color = QRgba64.fromRgba64(gray, gray, gray, 65535).toArgb32()\
         if sample_len == 2 else QColor(gray, gray, gray).rgba()
     self.image.setPixel(x, y, color)