本文整理汇总了C#中DDW.Swf.SwfWriter.AppendBytes方法的典型用法代码示例。如果您正苦于以下问题:C# SwfWriter.AppendBytes方法的具体用法?C# SwfWriter.AppendBytes怎么用?C# SwfWriter.AppendBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDW.Swf.SwfWriter
的用法示例。
在下文中一共展示了SwfWriter.AppendBytes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToSwf
public void ToSwf(SwfWriter w)
{
uint start = (uint)w.Position;
w.AppendTagIDAndLength(this.TagType, 0, true);
w.AppendUI16(SampleCount);
w.AppendBytes(SoundData);
w.ResetLongTagLength(this.TagType, start);
}
示例2: ToSwf
public void ToSwf(SwfWriter w)
{
uint start = (uint)w.Position;
w.AppendTagIDAndLength(this.TagType, 0, true);
if(JpegTable.Length > 0)
{
w.AppendByte(0xFF);
w.AppendByte(0xD8);
w.AppendBytes(JpegTable);
w.AppendByte(0xFF);
w.AppendByte(0xD9);
}
w.ResetLongTagLength(this.TagType, start, true);
}
示例3: ToSwf
public void ToSwf(SwfWriter w)
{
uint start = (uint)w.Position;
w.AppendTagIDAndLength(this.TagType, 0, true);
w.AppendUI16(CharacterId);
w.AppendByte((byte)BitmapFormat);
w.AppendUI16(Width);
w.AppendUI16(Height);
if (BitmapFormat == BitmapFormat.Colormapped8Bit) // 8-bit colormapped image
{
w.AppendByte((byte)(ColorCount - 1));
uint colorBytes = HasAlpha ? (uint)4 : (uint)3;
uint padWidth = this.Width + (4 - (this.Width % 4));
uint unzippedSize = (this.ColorCount * colorBytes) + (padWidth * this.Height);
byte[] mapData = new byte[unzippedSize];
for (int i = 0; i < this.ColorCount; i++)
{
mapData[i * colorBytes + 0] = ColorTable[i].R;
mapData[i * colorBytes + 1] = ColorTable[i].G;
mapData[i * colorBytes + 2] = ColorTable[i].B;
if (HasAlpha)
{
mapData[i * colorBytes + 3] = ColorTable[i].A;
}
}
int index = 0;
int st = (int)(this.ColorCount * colorBytes);
for (int i = st; i < unzippedSize; i++)
{
if (((i - st) % padWidth) < this.Width)// exclude padding
{
mapData[i] = (byte)this.ColorData[index++];
}
else
{
mapData[i] = 0;
}
}
byte[] zipped = SwfWriter.ZipBytes(mapData);
if(OrgBitmapData != null)
{
w.AppendBytes(OrgBitmapData);
}
else
{
w.AppendBytes(zipped);
}
}
else if (BitmapFormat == BitmapFormat.RGB15Bit) // rbg 15
{
// todo: find a test file for rgb555
uint colorBytes = 2;
uint padWidth = this.Width * colorBytes;
padWidth += (4 - padWidth) % 4;
uint unzippedSize = (padWidth * this.Height) * colorBytes;
byte[] mapData = new byte[unzippedSize];
int index = 0;
uint byteCount = padWidth * this.Height;
for (uint i = 0; i < unzippedSize; i += colorBytes)
{
byte rd = this.BitmapData[index].R;
byte gr = this.BitmapData[index].G;
byte bl = this.BitmapData[index].B;
byte b0 = 0;
byte b1 = 0;
b0 |= (byte)((rd & 0x7C) << 1);
b0 |= (byte)((gr & 0x03) << 6);
b1 |= (byte)((gr & 0xE0) >> 2);
b1 |= (byte)((bl & 0x1F) << 3);
mapData[i + 0] = b0;
mapData[i + 1] = b1;
index++;
}
byte[] zipped = SwfWriter.ZipBytes(mapData);
if (OrgBitmapData != null)
{
w.AppendBytes(OrgBitmapData);
}
else
{
w.AppendBytes(zipped);
}
}
else if (BitmapFormat == BitmapFormat.RGB24Bit) // RGB 24
{
uint colorBytes = HasAlpha ? (uint)4 : (uint)3;
//.........这里部分代码省略.........
示例4: ToSwf
public void ToSwf(SwfWriter w)
{
uint start = (uint)w.Position;
w.AppendTagIDAndLength(this.TagType, 0, true);
w.AppendUI16(SoundId);
w.AppendBits((uint)SoundFormat, 4);
switch (SoundRate)
{
case 5512:
w.AppendBits(0, 2);
break;
case 11025:
w.AppendBits(1, 2);
break;
case 22050:
w.AppendBits(2, 2);
break;
case 44100:
w.AppendBits(3, 2);
break;
}
w.AppendBit(SoundSize == 16U);
w.AppendBit(IsStereo);
w.Align();
w.AppendUI32(SoundSampleCount);
w.AppendBytes(SoundData);
w.ResetLongTagLength(this.TagType, start);
}
示例5: ToSwf
public void ToSwf(SwfWriter w)
{
uint start = (uint)w.Position;
w.AppendTagIDAndLength(this.TagType, 0, true);
w.AppendUI16(CharacterId);
if (!HasAlphaData)
{
if (!HasOwnTable)
{
w.AppendByte(0xFF);
w.AppendByte(0xD8);
w.AppendBytes(JpegData);
w.AppendByte(0xFF);
w.AppendByte(0xD9);
}
else
{
w.AppendBytes(JpegData);
}
}
else
{
w.AppendUI32((uint)JpegData.Length);
w.AppendBytes(JpegData);
w.AppendBytes(CompressedAlphaData);
}
w.ResetLongTagLength(this.TagType, start, true);
}