kopia lustrzana https://github.com/pimoroni/pimoroni-pico
				
				
				
			Inky 7.3: Dither pixel spans, move RGB flag out of RGB888.
							rodzic
							
								
									80fab77270
								
							
						
					
					
						commit
						a5b0633469
					
				| 
						 | 
				
			
			@ -10,22 +10,28 @@ namespace pimoroni {
 | 
			
		|||
    color = c;
 | 
			
		||||
  }
 | 
			
		||||
  void PicoGraphics_PenInky7::set_pen(uint8_t r, uint8_t g, uint8_t b) {
 | 
			
		||||
    color = RGB(r, g, b).to_rgb888() | 0x010101;
 | 
			
		||||
    color = RGB(r, g, b).to_rgb888() | 0x7f000000;
 | 
			
		||||
  }
 | 
			
		||||
  int PicoGraphics_PenInky7::create_pen(uint8_t r, uint8_t g, uint8_t b) {
 | 
			
		||||
    return RGB(r, g, b).to_rgb888() | 0x010101;
 | 
			
		||||
    return RGB(r, g, b).to_rgb888() | 0x7f000000;
 | 
			
		||||
  }
 | 
			
		||||
  int PicoGraphics_PenInky7::create_pen_hsv(float h, float s, float v) {
 | 
			
		||||
    return RGB::from_hsv(h, s, v).to_rgb888() | 0x010101;
 | 
			
		||||
    return RGB::from_hsv(h, s, v).to_rgb888() | 0x7f000000;
 | 
			
		||||
  }
 | 
			
		||||
  void PicoGraphics_PenInky7::set_pixel(const Point &p) {
 | 
			
		||||
    if ((color & 0x010101) == 0x010101) {
 | 
			
		||||
    if ((color & 0x7f000000) == 0x7f000000) {
 | 
			
		||||
      set_pixel_dither(p, RGB(color));
 | 
			
		||||
    } else {
 | 
			
		||||
      driver.write_pixel(p, color & 0x07);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  void PicoGraphics_PenInky7::set_pixel_span(const Point &p, uint l) {
 | 
			
		||||
    if ((color & 0x7f000000) == 0x7f000000) {
 | 
			
		||||
      for(auto x = 0u; x < l; x++) {
 | 
			
		||||
        set_pixel_dither(p + Point(x, 0), RGB(color));
 | 
			
		||||
      }
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    driver.write_pixel_span(p, l, color);
 | 
			
		||||
  }
 | 
			
		||||
  void PicoGraphics_PenInky7::get_dither_candidates(const RGB &col, const RGB *palette, size_t len, std::array<uint8_t, 16> &candidates) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue