91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 71KB
    文件類型: .cs
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-04
  • 語言: C#
  • 標簽: c#??gif??制作??如何????

資源簡介

c# 使用圖片制作 gif 的時候,需要用到一個類,那就是 AnimatedGifEncoder,使用的時候,把這個類復制進工程中,就可以使用相關類了。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections;
using?System.Drawing;
using?System.IO;

namespace?你自己的命名空間
{
????//我使用的是?vs2017?.net?framework?4.0
????internal?class?AnimatedGifEncoder
????{


????????protected?int?width;?//?image?size
????????protected?int?height;
????????protected?Color?transparent?=?Color.Empty;?//?transparent?color?if?given
????????protected?int?transIndex;?//?transparent?index?in?color?table
????????protected?int?repeat?=?-1;?//?no?repeat
????????protected?int?delay?=?0;?//?frame?delay?(hundredths)
????????protected?bool?started?=?false;?//?ready?to?output?frames
????????????????????????????????????????//??????protected?BinaryWriter?bw;
????????protected?FileStream?fs;

????????protected?Image?image;?//?current?frame
????????protected?byte[]?pixels;?//?BGR?byte?array?from?frame
????????protected?byte[]?indexedPixels;?//?converted?frame?indexed?to?palette
????????protected?int?colorDepth;?//?number?of?bit?planes
????????protected?byte[]?colorTab;?//?RGB?palette
????????protected?bool[]?usedEntry?=?new?bool[256];?//?active?palette?entries
????????protected?int?palSize?=?7;?//?color?table?size?(bits-1)
????????protected?int?dispose?=?-1;?//?disposal?code?(-1?=?use?default)
????????protected?bool?closeStream?=?false;?//?close?stream?when?finished
????????protected?bool?firstframe?=?true;
????????protected?bool?sizeSet?=?false;?//?if?false?get?size?from?first?frame
????????protected?int?sample?=?10;?//?default?sample?interval?for?quantizer

????????/**
?????????*?Sets?the?delay?time?between?each?frame?or?changes?it
?????????*?for?subsequent?frames?(applies?to?last?frame?added).
?????????*
?????????*?@param?ms?int?delay?time?in?milliseconds
?????????*/
????????public?void?SetDelay(int?ms)
????????{
????????????delay?=?(int)System.Math.Round(ms?/?10.0f);
????????}

????????/**
?????????*?Sets?the?GIF?frame?disposal?code?for?the?last?added?frame
?????????*?and?any?subsequent?frames.??Default?is?0?if?no?transparent
?????????*?color?has?been?set?otherwise?2.
?????????*?@param?code?int?disposal?code.
?????????*/
????????public?void?SetDispose(int?code)
????????{
????????????if?(code?>=?0)
????????????{
????????????????dispose?=?code;
????????????}
????????}

????????/**
?????????*?Sets?the?number?of?times?the?set?of?GIF?frames
?????????*?should?be?played.??Default?is?1;?0?means?play
?????????*?indefinitely.??Must?be?invoked?before?the?first
?????????*?image?is?added.
?????????*
?????????*?@param?iter?int?number?of?iterations.
?????????*?@return
?????????*/
????????public?void?SetRepeat(int?iter)
????????{
????????????if?(iter?>=?0)
????????????{
????????????????repeat?=?iter;
????????????}
????????}

????????/**
?????????*?Sets?the?transparent?color?for?the?last?added?frame
?????????*?and?any?subsequent?frames.
?????????*?Since?all?colors?are?subject?to?modification
?????????*?in?the?quantization?process?the?color?in?the?final
?????????*?palette?for?each?fram

評論

共有 條評論