public static Bitmap GenBMPQRfromMatrix(CPointsMatrix matrix, SViewState viewState) { Bitmap bmp; if (matrix == null) { CLogger.WriteLine("FataL bug : matrix is null", true); } try { bmp = new Bitmap(matrix.Width, matrix.Height, PixelFormat.Format32bppArgb); } catch (Exception e) { CLogger.WriteLine("6.3 : " + e.Message, true); if (e.InnerException != null) { CLogger.WriteLine("6.3 inner: " + e.InnerException.Message, true); } return(new Bitmap(1, 1)); } using (Graphics gr = Graphics.FromImage(bmp)) { gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; gr.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; gr.FillRectangle(new SolidBrush(CCoder.GetColorFor(PointType.Logo)), 0, 0, matrix.Width, matrix.Height); DrawBorderBackground(gr, matrix, viewState); DrawBytes(gr, matrix, viewState); DrawLogo(gr, matrix, viewState); DrawPoints(gr, matrix, viewState); //DrawLogoPoints(gr, matrix, viewState); //Отрисовка места под логотип //gr.FillPolygon(new SolidBrush(Color.WhiteSmoke), Vector.ToSystemPointsF(matrix.LogoBorderPoints.ToArray())); #if DEBUG //DEBUG // вывод на экран окружения конкретной точки if (false) { for (int i = 0; i < matrix.Points.Count; i++) { if (i != 5) { continue; } int[] points = matrix.sixNearest(i); for (int jj = 0; jj < points.Length; jj++) { try { gr.DrawLine(new Pen(new SolidBrush(Color.Green)), (int)matrix.VectorAt(points[jj]).x + 2, (int)(int)matrix.VectorAt(points[jj]).y + 2, (int)matrix.VectorAt(points[jj]).x + 4, (int)(int)matrix.VectorAt(points[jj]).y + 4); gr.DrawString(jj.ToString(), new Font("Sans Serif", 16f), new SolidBrush(Color.Green), (int)matrix.VectorAt(points[jj]).x + 5, (int)(int)matrix.VectorAt(points[jj]).y - 5); } catch (Exception e) { // do nothing } } } } //END DEBUG #endif } Bitmap fullimage = new Bitmap(Path.GetDirectoryName(Application.ExecutablePath) + @"/img/HexFrame.jpg"); CLogger.WriteLine("Succes HexFrame loading"); using (Graphics gr = Graphics.FromImage(fullimage)) { gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; double resize = (596.0 - 16 * 2.0) / (bmp.Width); Bitmap resizedBmp = new Bitmap(bmp, new Size((int)(bmp.Width * resize), (int)(bmp.Height * resize))); //CLogger.WriteLine("Succes qr resize to HexFrame"); gr.DrawImage(resizedBmp, new Point(16, 16)); CLogger.WriteLine("Succes drawing exist qr bitmap on hexframe"); } return(fullimage); }