Totemsoft.SDK.Framework4.Graphics.Image.Serialized 命名空间

Totemsoft.SDK.Framework4.Graphics.Image.Serialized 命名空间

提供图像的序列化处理支持

说明 Introduction

将位图 System.Drawing.Bitmap 结构数据序列化处理类,该类可以在 Bitmap 结构与字节数组间的通用转换。


成员 Members

  • Totemsoft.SDK.Framework4.Graphics.Image.Serialized 命名空间
    • Totemsoft.SDK.Framework4.Graphics.Image.Serialized.SerializeImage
    • Totemsoft.SDK.Framework4.Graphics.Image.Serialized.Exceptions 命名空间
      • Totemsoft.SDK.Framework4.Graphics.Image.Serialized.Exceptions.ImageOverFlowException

版本信息 Version Information

Created date: 2017年04月17日
Last modify date: 2017年05月09日
Programmer: Eddie Chan
Version: 1.01.03


Copyright © 2017 Totemsoft Inc. All rights reserved.
Totemsoft is a trademark of Imago organization.


SerializeImage 类

方法 Methods

名称说明
FromBitmap (Bitmap) Byte()将通用位图格式数据转换为一维字节数组。
FromBitmap (Bitmap, Rectangle) Byte()将通用位图格式的指定区域数据转换为一维字节数组。
FromBytes(Byte(), Size) Bitmap将一维字节数组数据转换为通用位图格式。

异常 Exceptions

名称说明
ImageOverFlowException缓冲出超出限制时触发。
ImagePixelFormatException图像不是32位 (ARGB) 格式时触发。

ImagePixelFormatException 位于 Totemsoft.SDK.Framework4.Graphics.Image.Exceptions 命名空间。


示例 Examples

Visual C Sharp Code

using System.Drawing;
using System.Drawing.Imaging;
using Totemsoft.SDK.Framework4.Graphics.Serialized;

public class TestSerializeImageClass
{
    public void CloneBitmap()
    {
        Bitmap objBitmap = Bitmap.FromFile("D:\\TestSerialized.png");
        Size objSize = objBitmap.Size;
        try
        {
            byte[] objBytes = SerializeImage.FromBitmap(objBitmap);
            Bitmap objNewBitmap = SerializeImage.FromBytes(objBytes, objSize);
            objNewBitmap.Save("D:\\SerializedClone.png", ImageFormat.Png);
        }
        catch
        {
            //TODO: Any exception code.
        }
    }
}

Visual Basic Code

Imports System.Drawing
Imports System.Drawing.Imaging
Imports Totemsoft.SDK.Framework4.Graphics.Image.Serialized

Public Class TestSerializeImageClass
    Public Sub CloneBitmap()
        Dim objBitmap As Bitmap = Bitmap.FromFile("D:\TestSerialized.png")
        Dim objSize As Size = objBitmap.Size
        Try
            Dim objBytes As Byte() = SerializeImage.FromBitmap(objBitmap)
            Dim objNewBitmap As Bitmap = SerializeImage.FromBytes(objBytes, objSize)
            objNewBitmap.Save("D:\SerializedClone.png", ImageFormat.Png)
        Catch
            ' TODO: Any exception code.
        End Try
    End Sub
End Class

Copyright © 2017 Totemsoft Inc. All rights reserved.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值