Example #1
0
 /// <summary>
 /// 获取24位BMP位图数据
 /// </summary>
 /// <param oldName="width">图片的宽度</param>
 /// <param oldName="height">图片的高度</param>
 /// <returns>实际二进制数据</returns>
 public byte[] bitmap24Data(int width, int height)
 {
     try
     {
         String       picFile = Path.Combine(SVProData.IconPath, ImageFileName);
         SVPixmapFile file    = new SVPixmapFile();
         file.readPixmapFile(picFile);
         Bitmap       bitmap = file.getBitmapObject(width, height, 24);
         SVBitmapHead head   = new SVBitmapHead(bitmap);
         return(head.data());
     }
     catch
     {
         return(null);
     }
 }
Example #2
0
        public Bitmap bitmap()
        {
            Bitmap result = null;

            try
            {
                String       file       = Path.Combine(SVProData.IconPath, ImageFileName);
                SVPixmapFile pixmapFile = new SVPixmapFile();
                pixmapFile.readPixmapFile(file);
                result = pixmapFile.getBitmapFromData();
            }
            catch
            {
                return(result);
            }

            return(result);
        }
Example #3
0
        //将文件转换为bmp 256色
        void convertBitmap(String fileName, String outFile)
        {
            Bitmap bitmap       = new Bitmap(fileName);
            Bitmap bitmapResult = bitmap;
            //Bitmap bitmapResult = bitmap.Clone(new Rectangle(0, 0, bitmap.Width, bitmap.Height), PixelFormat.Format8bppIndexed);

            String outName     = Path.GetFileNameWithoutExtension(fileName);
            String outFileName = Path.Combine(SVProData.IconPath, outFile);

            MemoryStream outStream = new MemoryStream();

            bitmapResult.Save(outStream, ImageFormat.Bmp);

            //保存文件
            SVPixmapFile pixFile = new SVPixmapFile();

            pixFile.ShowName = outName;
            pixFile.Pixmap   = outStream;
            ///执行写文件过程
            pixFile.writePixmapFile(outFileName);
            _picManager.insertItemByClass(this.classlistView.SelectedValue as String, outName, outFile);
        }