Last active
          August 29, 2015 14:02 
        
      - 
      
- 
        Save cwensley/162ca757311d22787a31 to your computer and use it in GitHub Desktop. 
    Set pixels directly in Eto.Drawing.Bitmap
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var bitmap = new Bitmap(100, 100, PixelFormat.Format32bppRgb); | |
| using (var bd = bitmap.Lock()) unsafe | |
| { | |
| int* val = (int*)bd.Data; | |
| var pos = new Point(50, 50); // pixel we want to set | |
| val += pos.X + (pos.Y * bd.ScanWidth / 4); // scanwidth is in bytes | |
| *val = bd.TranslateArgbToData(Colors.Blue.ToArgb()); // translate argb to data format (may be different RGB order per platform) | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment