本文整理汇总了C#中NewTOAPIA.BufferChunk类的典型用法代码示例。如果您正苦于以下问题:C# BufferChunk类的具体用法?C# BufferChunk怎么用?C# BufferChunk使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BufferChunk类属于NewTOAPIA命名空间,在下文中一共展示了BufferChunk类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Pack
public static void Pack(BufferChunk aChunk, int left, int top, int right, int bottom)
{
aChunk += left;
aChunk += top;
aChunk += right;
aChunk += bottom;
}
示例2: CopyPixels
public virtual void CopyPixels(int x, int y, int width, int height, PixelBuffer24 pixBuff)
{
// Create a buffer
// It has to be big enough for the bitmap data, as well as the x,y, and command
int dataSize = (width) * (height) * pixBuff.Pixels.BytesPerPixel;
BufferChunk chunk = new BufferChunk(dataSize + 128);
// now put the basic command and simple components in
chunk += SpaceControlChannel.SC_CopyPixels;
CodecUtils.Pack(chunk, x, y, width, height);
chunk += dataSize;
// Finally, copy in the data
int numBytesPerRow = pixBuff.Pixels.BytesPerPixel * width;
IntPtr rowPtr = pixBuff.Pixels.Data;
int offset = 0;
int row = 0;
for (row = y; row < (y + height); row++)
{
offset = pixBuff.Pixels.Data.ToInt32() + row * pixBuff.Pixels.Stride + x * pixBuff.Pixels.BytesPerPixel;
rowPtr = (IntPtr)offset;
chunk.CopyFrom(rowPtr, numBytesPerRow);
}
PackCommand(chunk);
}
示例3: SaveState
/// Some GraphPort control things
///
public override void SaveState()
{
BufferChunk chunk = new BufferChunk(128);
chunk += GDI32.EMR_SAVEDC;
SendCommand(chunk);
}
示例4: PixBltPixelBuffer24
public override void PixBltPixelBuffer24(GDIDIBSection fPixMap, int x, int y)
{
MemoryStream ms = new MemoryStream();
PixelAccessorBGRb accessor = new PixelAccessorBGRb(fPixMap.Width, fPixMap.Height, fPixMap.Orientation, fPixMap.Pixels);
// 2. Run length encode the image to a memory stream
NewTOAPIA.Imaging.TargaRunLengthCodec rlc = new NewTOAPIA.Imaging.TargaRunLengthCodec();
rlc.Encode(accessor, ms);
// 3. Get the bytes from the stream
byte[] imageBytes = ms.GetBuffer();
int dataLength = (int)imageBytes.Length;
// 4. Allocate a buffer chunk to accomodate the bytes, plus some more
BufferChunk chunk = new BufferChunk(dataLength + 128);
// 5. Put the command, destination, and data size into the buffer first
chunk += (int)UICommands.PixBltRLE;
ChunkUtils.Pack(chunk, x, y);
ChunkUtils.Pack(chunk, accessor.Width, accessor.Height);
chunk += dataLength;
// 6. Put the image bytes into the chunk
chunk += imageBytes;
// 6. Finally, send the packet
SendCommand(chunk);
}
示例5: PixBltPixelArray
public override void PixBltPixelArray(IPixelArray pixBuff, int x, int y)
{
//NewTOAPIA.Kernel.PrecisionTimer timer = new NewTOAPIA.Kernel.PrecisionTimer();
// 1. convert the pixel array to a Bitmap object
Bitmap bm = PixelBufferHelper.CreateBitmapFromPixelArray(pixBuff);
// 2. Write this bitmap to a memory stream as a compressed JPEG image
MemoryStream ms = new MemoryStream();
bm.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
// 3. Get the bytes from the stream
byte[] imageBytes = ms.GetBuffer();
// 4. Allocate a buffer chunk to accomodate the bytes, plus some more
BufferChunk chunk = new BufferChunk(imageBytes.Length + 128);
// 5. Put the command, destination, and data size into the buffer first
chunk += (int)UICommands.PixBltJPG;
ChunkUtils.Pack(chunk, x, y);
chunk += (int)imageBytes.Length;
// 6. Put the image bytes into the chunk
chunk += imageBytes;
//double duration = timer.GetElapsedSeconds();
//Console.WriteLine("Encoder - Time to pack image: {0}", duration);
// Finally, send the packet
SendCommand(chunk);
}
示例6: SetTextColor
// Modes and attributes
public override void SetTextColor(uint colorref)
{
BufferChunk chunk = new BufferChunk(128);
chunk += GDI32.EMR_SETTEXTCOLOR;
chunk += colorref;
SendCommand(chunk);
}
示例7: UnpackGuid
Guid UnpackGuid(BufferChunk chunk)
{
int bufferLength = chunk.NextInt32(); // How many bytes did we pack
byte[] bytes = (byte[])chunk.NextBufferChunk(bufferLength);
Guid aGuid = new Guid(bytes);
return aGuid;
}
示例8: SetupBufferChunks
void SetupBufferChunks()
{
fChunks = new Queue<BufferChunk>();
for (int i = 0; i < NumberOfPackets; i++)
{
BufferChunk newChunk = new BufferChunk(UDP.MTU);
fChunks.Enqueue(newChunk);
}
}
示例9: Pack
public static void Pack(BufferChunk chunk, XFORM aTrans)
{
chunk += aTrans.eDx;
chunk += aTrans.eDy;
chunk += aTrans.eM11;
chunk += aTrans.eM12;
chunk += aTrans.eM21;
chunk += aTrans.eM22;
}
示例10: ReceiveChunk
public virtual void ReceiveChunk(BufferChunk aRecord)
{
// First read out the record type
int recordType = aRecord.NextInt32();
// Then deserialize the rest from there
switch ((UserIOCommand)recordType)
{
case UserIOCommand.HideCursor:
HideCursor();
break;
case UserIOCommand.Showcursor:
ShowCursor();
break;
case UserIOCommand.MoveCursor:
{
int x = aRecord.NextInt32();
int y = aRecord.NextInt32();
MoveCursor(x, y);
}
break;
case UserIOCommand.KeyboardActivity:
{
KeyActivityType kEvent = (KeyActivityType)aRecord.NextInt32();
VirtualKeyCodes vk = (VirtualKeyCodes)aRecord.NextInt32();
KeyboardActivityArgs kbda = new KeyboardActivityArgs(kEvent, vk);
KeyboardActivity(this, kbda);
}
break;
case UserIOCommand.MouseActivity:
{
MouseActivityType maType = MouseActivityType.None;
MouseButtonActivity mbActivity = (MouseButtonActivity)aRecord.NextInt32();
int x = aRecord.NextInt32();
int y = aRecord.NextInt32();
int clicks = aRecord.NextInt32();
short delta = aRecord.NextInt16();
int keyflags = 0;
MouseActivityArgs ma = new MouseActivityArgs(null, maType, mbActivity,
MouseCoordinateSpace.Desktop, MouseMovementType.Absolute, IntPtr.Zero,
x, y, delta, clicks, keyflags);
MouseActivity(this, ma);
}
break;
default:
break;
}
}
示例11: SetPixel
// Drawing Primitives
/// Our first pass will be to implement everything as
/// taking explicit int parameters.
/// We'll assume that drawing with a different pen will
/// be accomplished by setting the Pen property on the
/// port before drawing. This will keep our API count
/// low and alleviate the need to pass the same
/// parameter every time. We can add more later.
///
public override void SetPixel(int x, int y, Color colorref)
{
BufferChunk chunk = new BufferChunk(128);
chunk += GDI32.EMR_SETTEXTCOLOR;
ChunkUtils.Pack(chunk, x, y);
chunk += colorref.ToArgb();
SendCommand(chunk);
}
示例12: SelectUniqueObject
public override void SelectUniqueObject(Guid objectID)
{
BufferChunk chunk = new BufferChunk(128);
chunk += GDI32.EMR_SELECTUNIQUEOBJECT;
chunk += (int)16; // The following byte array is 16 elements long
chunk += objectID.ToByteArray();
SendCommand(chunk);
}
示例13: CreateSurface
public virtual void CreateSurface(string title, RECT frame, Guid uniqueID)
{
BufferChunk chunk = new BufferChunk(1024);
chunk += SpaceControlChannel.SC_CreateSurface;
CodecUtils.Pack(chunk,uniqueID);
CodecUtils.Pack(chunk,frame.Left, frame.Top, frame.Width, frame.Height);
PackCommand(chunk);
}
示例14: InvalidateSurfaceRect
public virtual void InvalidateSurfaceRect(Guid surfaceID, RECT frame)
{
BufferChunk chunk = new BufferChunk(1024);
chunk += SpaceControlChannel.SC_InvalidateSurfaceRect;
CodecUtils.Pack(chunk, surfaceID);
CodecUtils.Pack(chunk, frame.Left, frame.Top, frame.Width, frame.Height);
PackCommand(chunk);
}
示例15: Pack
public static void Pack(BufferChunk chunk, Point3D[] points)
{
// Need to know how many points so that space can be allocated for them on the receiving end
chunk += points.Length;
// Encode each of the points
foreach(Point3D aPoint in points)
{
Pack(chunk, (int)aPoint.X, (int)aPoint.Y);
}
}