當前位置: 首頁>>代碼示例>>C#>>正文


C# NewTOAPIA.BufferChunk類代碼示例

本文整理匯總了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;
 }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:7,代碼來源:ChunkUtils.cs

示例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);
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:26,代碼來源:SpaceCommandEncoder.cs

示例3: SaveState

        /// Some GraphPort control things
        /// 
        public override void SaveState()
        {
            BufferChunk chunk = new BufferChunk(128);
            chunk += GDI32.EMR_SAVEDC;

            SendCommand(chunk);
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:9,代碼來源:GraphPortChunkEncoder.cs

示例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);
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:29,代碼來源:GraphPortChunkEncoder.cs

示例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);
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:30,代碼來源:GraphPortChunkEncoder.cs

示例6: SetTextColor

        // Modes and attributes
        public override void SetTextColor(uint colorref)
        {
            BufferChunk chunk = new BufferChunk(128);
            chunk += GDI32.EMR_SETTEXTCOLOR;
            chunk += colorref;

            SendCommand(chunk);
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:9,代碼來源:GraphPortChunkEncoder.cs

示例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;
    }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:8,代碼來源:GraphPortChunkDecoder.cs

示例8: SetupBufferChunks

 void SetupBufferChunks()
 {
     fChunks = new Queue<BufferChunk>();
     for (int i = 0; i < NumberOfPackets; i++)
     {
         BufferChunk newChunk = new BufferChunk(UDP.MTU);
         fChunks.Enqueue(newChunk);
     }
 }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:9,代碼來源:CommChannel.cs

示例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;
 }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:9,代碼來源:ChunkUtils.cs

示例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;
            }
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:57,代碼來源:UserIOChannelDecoder.cs

示例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);
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:18,代碼來源:GraphPortChunkEncoder.cs

示例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);
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:9,代碼來源:GraphPortChunkEncoder.cs

示例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);
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:10,代碼來源:SpaceCommandEncoder.cs

示例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);
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:10,代碼來源:SpaceCommandEncoder.cs

示例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);
            }
        }
開發者ID:Wiladams,項目名稱:NewTOAPIA,代碼行數:12,代碼來源:ChunkUtils.cs


注:本文中的NewTOAPIA.BufferChunk類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。