Working on improving qrcodes
This commit is contained in:
parent
7040590341
commit
6618dd11ed
2 changed files with 36 additions and 1 deletions
|
|
@ -304,7 +304,39 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
return destImage;
|
||||
}
|
||||
|
||||
public bool ConvertBitmapToImage(ImageBuffer destImage, System.Drawing.Bitmap bitmap)
|
||||
public static System.Drawing.Bitmap ConvertImageToBitmap(ImageBuffer sourceImage)
|
||||
{
|
||||
var bitmap = new System.Drawing.Bitmap(sourceImage.Width, sourceImage.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
|
||||
var bitmapData = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, bitmap.PixelFormat);
|
||||
|
||||
int destIndex = 0;
|
||||
unsafe
|
||||
{
|
||||
byte[] sourceBuffer = sourceImage.GetBuffer();
|
||||
byte* pDestBuffer = (byte*)bitmapData.Scan0;
|
||||
int scanlinePadding = bitmapData.Stride - bitmapData.Width * 4;
|
||||
for (int y = 0; y < sourceImage.Height; y++)
|
||||
{
|
||||
int sourceIndex = sourceImage.GetBufferOffsetXY(0, sourceImage.Height - 1 - y);
|
||||
for (int x = 0; x < sourceImage.Width; x++)
|
||||
{
|
||||
pDestBuffer[destIndex++] = sourceBuffer[sourceIndex++];
|
||||
pDestBuffer[destIndex++] = sourceBuffer[sourceIndex++];
|
||||
pDestBuffer[destIndex++] = sourceBuffer[sourceIndex++];
|
||||
pDestBuffer[destIndex++] = sourceBuffer[sourceIndex++];
|
||||
}
|
||||
|
||||
destIndex += scanlinePadding;
|
||||
}
|
||||
}
|
||||
|
||||
bitmap.UnlockBits(bitmapData);
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public static bool ConvertBitmapToImage(ImageBuffer destImage, System.Drawing.Bitmap bitmap)
|
||||
{
|
||||
if (bitmap != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ Translated:{0} should be greater than or equal to 1/2 the {1}.
|
|||
English:\"{0}\" already exists.\nDo you want to replace it?
|
||||
Translated:\"{0}\" already exists.\nDo you want to replace it?
|
||||
|
||||
English:# Upgrade to [{0}](https://www.matterhackers.com/admin/product-preview/ag1zfm1oLXBscy1wcm9kchsLEg5Qcm9kdWN0TGlzdGluZxiAgIC_65WICww)
|
||||
Translated:# Upgrade to [{0}](https://www.matterhackers.com/admin/product-preview/ag1zfm1oLXBscy1wcm9kchsLEg5Qcm9kdWN0TGlzdGluZxiAgIC_65WICww)
|
||||
|
||||
English:%
|
||||
Translated:%
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue