当前位置: 首页 > news >正文

江门住房城乡建设厅网站企业官网与公开财报

江门住房城乡建设厅网站,企业官网与公开财报,wordpress图片模糊加载,云南做商城网站多少钱最终效果#xff1a; V1.8.2 20230419 文字生成单色BMP图片4.exe 默认1280*720 如果显示不全#xff0c;请把宽和高加大 字体加大。 首先#xff0c;用windows画板生成一张1*1白色单色图作为标准#xff0c;数据如下#xff1a; 数据解析参考#xff1a;BMP图像文件完…最终效果 V1.8.2 20230419 文字生成单色BMP图片4.exe 默认1280*720  如果显示不全请把宽和高加大  字体加大。 首先用windows画板生成一张1*1白色单色图作为标准数据如下 数据解析参考BMP图像文件完全解析 - 知乎 但单色图有点不一样的是像数数据部分是1bit一个点0黑1白。4字节对齐是一样的。 比如上面是8000 0000   80即二进制1000 0000。因为是1*1只有一个点有效其它是4字节对齐。 再建一个2*1变成C0    即二进制1100 0000 再建一个2*1变成C0    即二进制1100 0000 再建一个1*2变成8个数据变成8000 0000 8000 0000 每一列都需要凑4字节的倍数 用C#生成单色图 private void Form1_Load(object sender, EventArgs e){Bitmap bmp2 new Bitmap(1, 1, PixelFormat.Format1bppIndexed);//其它bmp格式的画图数据//Graphics _Graphics Graphics.FromImage(bmp2);//_Graphics.Clear(Color.Red);//_Graphics.Dispose();//bmp2.SetResolution( 72,72);//单色图数据Rectangle rect new Rectangle(0, 0, bmp2.Width, bmp2.Height);System.Drawing.Imaging.BitmapData bmpData bmp2.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, bmp2.PixelFormat);// Get the address of the first line.IntPtr ptr bmpData.Scan0;// Declare an array to hold the bytes of the bitmap.int bytes Math.Abs(bmpData.Stride) * bmp2.Height;//error if bmpData.Widthbyte[] rgbValues new byte[bytes];// Copy the RGB values into the array.System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);//Generate dots in random cells and show imagefor (int i 0; i bmp2.Height; i){for (int j 0; j bmp2.Width; j 8){byte b 0;b (byte)(b | ((byte)(1) 7));//b (byte)(b | ((byte)(1) 6));//b (byte)(b | ((byte)(1) 5));//b (byte)(b | ((byte)(1) 4));//b (byte)(b | ((byte)(1) 3));//b (byte)(b | ((byte)(1) 2));//b (byte)(b | ((byte)(1) 1));//b (byte)(b | ((byte)(1) 0));rgbValues[i * bmpData.Stride j / 8] (byte)b;}}// Copy back values into the array.System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr, bytes);// Unlock the bits.bmp2.UnlockBits(bmpData);//save bmpbmp2.Save(Test.bmp,ImageFormat.Bmp);} 任意语言完全用字节拼一张图 JAVA C# Zxing生成的二维码数据转换为1bit的bmp下发到点阵终端。QRCode去白边以bmp格式字节流发送BMP图片解析_java图片转点阵_小黄人软件的博客-CSDN博客 谁有空帮填一下就行。JAVA写的部分。  final int[] pixels new int[width * height]; //假设有这么多图像数据比如二维码矩阵final byte[] pixelsByte new byte[ pixels.length/8 ]; //8个pixels合并到一个pixelsByte字节final byte[] bmpFile new byte[ 0x3Epixels.length/8 ]; //图片存储的位置像素数据大小 整个文件buffArrays.fill(bmpFile, (byte) 0); //默认为0//0~1字节42、4d为B、M字符表示BMP文件//2~5字节表示整个BMP文件的大小小端模式即0x0000003a58字节//6~9字节是保留数据一般都是0//10~13字节表示图片存储的位置//14~17字节为位图信息数据头一般是40即0x00000028。//18~21字节表示图像宽度即0x00000001//22~25字节表示图像高度。//26~27字节表示色彩平面数量必须为1即0x0001//28~29字节表示每个像素存储的位数蓝色部分0x0018即24位。//30~33字节为压缩方式0表示不压缩//34~37字节表示原始位图数据的大小即0x00000004即4字节//38~41字节表示横向分辨率//42~45字节表示纵向分辨率//46~49字节表示调色板颜色数//50~53字节表示重要颜色数//54~57字节红色部分即原始的像素数据这些才是最终需要显示到屏幕上的数据bmpFile[0]0x42; //‘B’ bmpFile[1]0x4d; //MbmpFile[10]0x3E; //图片存储的位置System.arraycopy(pixelsBit,0,bmpFile,bmpFile[10],pixelsBit.length); //图像数据复制到buf位置WriteToFile(bmpFile,bmpFile.length);//二进制写入到文件 其它图片转为单色图 public void generateBMP(string contents, int width 1280, int height 720){if (contents.Length 0){using (Bitmap bmp GetStrBMPALL(contents, width, height)) // 获取待分析的字符位图{pictureBox2.Image ConvertTo24bppTo1bpp(bmp);}}else{pictureBox2.Image null;}pictureBox2.BringToFront(); //最前显示System.GC.Collect();//清内存 不然图片一直增加内存}//白底黑字public static Bitmap GetStrBMPALL(string str, int bmpWidth 1280, int bmpHeight 720) //str字符串 width单个宽度 height单个高度{str str.Replace(\r, );string[] lineList str.Split(\n);Bitmap bmp new Bitmap(bmpWidth, bmpHeight); // 新建位图变量Graphics g Graphics.FromImage(bmp);Brush backgroud Brushes.White; //点阵分隔线颜色g.FillRectangle(backgroud, new Rectangle(0, 0, bmpWidth, bmpHeight));//实心正方形 背景int y 0;foreach (string line in lineList){int widthTemp 0;foreach (char ch in line){g.DrawString(ch.ToString(), p.myFont, Brushes.Black, new PointF(widthTemp p.xOffset, y p.yOffset 0.0F)); //new Font(宋体, 10)if ((int)ch 127) { widthTemp p.width / 2; } else { widthTemp p.width; } //如果是字符ASCII宽度为8 如果是汉字宽度为16}y p.height;}//bmp.Save(out32.bmp);return bmp;}public static Bitmap ConvertTo24bppTo1bpp(Bitmap bmp, int pixelSize1, int jg0,int width1280,int height720) //bmp要显示的图 pixelSize单个点大小 jg点与点间隔 返回转换后的图{Bitmap bmp2 new Bitmap(width, height, PixelFormat.Format1bppIndexed); //Bitmap bmp2 new Bitmap(Test.bmp, true);Rectangle rect new Rectangle(0, 0, bmp2.Width, bmp2.Height);System.Drawing.Imaging.BitmapData bmpData bmp2.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, bmp2.PixelFormat);// Get the address of the first line.IntPtr ptr bmpData.Scan0;// Declare an array to hold the bytes of the bitmap.int bytes Math.Abs(bmpData.Stride) * bmp2.Height;//error if bmpData.Widthbyte[] rgbValues new byte[bytes];// Copy the RGB values into the array.System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);//Generate dots in random cells and show imagefor (int i 0; i bmp.Height; i){for (int j 0; j bmp.Width; j 8){byte b 0;b (byte)(b | ((byte)((bmp.GetPixel(j 0, i) Color.FromArgb(0x0, 0, 0)) ? 1 : 0) 7));b (byte)(b | ((byte)((bmp.GetPixel(j 1, i) Color.FromArgb(0x0, 0, 0)) ? 1 : 0) 6));b (byte)(b | ((byte)((bmp.GetPixel(j 2, i) Color.FromArgb(0x0, 0, 0)) ? 1 : 0) 5));b (byte)(b | ((byte)((bmp.GetPixel(j 3, i) Color.FromArgb(0x0, 0, 0)) ? 1 : 0) 4));b (byte)(b | ((byte)((bmp.GetPixel(j 4, i) Color.FromArgb(0x0, 0, 0)) ? 1 : 0) 3));b (byte)(b | ((byte)((bmp.GetPixel(j 5, i) Color.FromArgb(0x0, 0, 0)) ? 1 : 0) 2));b (byte)(b | ((byte)((bmp.GetPixel(j 6, i) Color.FromArgb(0x0, 0, 0)) ? 1 : 0) 1));b (byte)(b | ((byte)((bmp.GetPixel(j 7, i) Color.FromArgb(0x0, 0, 0)) ? 1 : 0) 0));rgbValues[i * bmpData.Stride j / 8] (byte)b;}}// Copy back values into the array.System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr, bytes);// Unlock the bits.bmp2.UnlockBits(bmpData);bmp2.Save(out.bmp, ImageFormat.Bmp);return bmp2;}private void button1_Click(object sender, EventArgs e){p.xOffset Convert.ToInt32(textBox5.Text);p.yOffset Convert.ToInt32(textBox6.Text);p.width Convert.ToInt32(textBox3.Text);p.height Convert.ToInt32(textBox4.Text);generateBMP(textBox1.Text);}
http://www.dnsts.com.cn/news/107130.html

相关文章:

  • 提供营销单页网站在技校计算机网站建设
  • 用vs2010做网站做暧暧小视频有声音的网站
  • 建设银行辽宁分行报名网站重庆档案馆建设网站
  • 手机在线做ppt模板下载网站有哪些装修网站合作平台有哪些
  • 深圳网站建设专业乐云seo网络维护工作内容及心得体会
  • 杭州网站制作多少钱网站设计方案谁写
  • 吉林大学建设工程学院 旧网站自己做的视频网站上传电影
  • 专注网站搭建的公司搭建网站做财务系统
  • 深圳建网建网站福州网站建设方案咨询
  • 团队建设游戏网站dell网站设计特色
  • 深圳网站域名注册安卓游戏开发软件
  • 建立个人网站流程智林东莞网站建设公司
  • 网站推广关键词工具网站建设的知识产权归属
  • 建筑工程招标网站深圳市公司网站建设价格
  • 江苏怎么做网站排名优化如何使用开源程序做网站
  • 在线生成手机网站水墨背景风格企业网站模板
  • vs2015 建设微网站wordpress超级编辑器
  • 重庆免费做网站社交平台网站建设预算
  • 游戏平台网站建设青岛网站空间
  • 中山企业网站优化弄一个电影网站怎么做
  • wordpress授权登录seo网站优化做什么
  • 如何建设网站接收数据珠宝网站模版
  • 新手做网站最简单流程wordpress怎装模板
  • 新光途网站建设哪些经营范围可以开网站建设费用
  • 更改网站模板冒用公司名做网站
  • 北京推广网站网站制作ppt
  • 建设一个下载网站dede的网站地图
  • php 开源 建站樱花动漫imomoe官网入口
  • 网站底部悬浮导航社交app开发
  • html格式网站网站开店前的四项基本建设