Esempio n. 1
0
        public bool ReadRecord(out DrawImageCommand record)
        {
            record = default;
            unsafe
            {
                fixed(byte *pByte = this.buffer)
                {
                    // This pointer points to the current read point in the
                    // instruction stream.
                    byte *pCur = pByte;

                    // This points to the first byte past the end of the
                    // instruction stream (i.e. when to stop)
                    byte *pEndOfInstructions = pByte + this.currentReadOffset;

                    if ((pCur >= pEndOfInstructions)) //reach end
                    {
                        return(false);
                    }

                    RecordHeader *pCurRecord = (RecordHeader *)pCur;

                    if (pCurRecord->Type != RecordType.DrawImage)
                    {
                        return(false);
                    }

                    DrawImageCommand *data = (DrawImageCommand *)(pCur + sizeof(RecordHeader));

                    record = *data;
                    this.currentReadOffset += pCurRecord->Size;
                    return(true);
                }
            }
        }
Esempio n. 2
0
        public override void DrawImage(ImGui.OSAbstraction.Graphics.ITexture image, Rect rectangle)
        {
            if (image == null)
            {
                return;
            }
            EnsureContent();

            unsafe
            {
                var record = new DrawImageCommand(
                    content.AddDependentResource(image),
                    rectangle);

                content.WriteRecord(RecordType.DrawImage, (byte *)&record, sizeof(DrawImageCommand));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Executes the DrawImageCommand command.
        /// </summary>
        public void ExecuteDrawImageCommand()
        {
            // create the processing command
            DrawImageCommand command = ImageProcessingCommandFactory.CreateDrawImageCommand(_viewer.Image);

            // set properties of command
            PropertyGridForm propertyGridForm = new PropertyGridForm(command, "Draw Image Command Properties", true);

            if (propertyGridForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // save a reference to the overlay image, image will be disposed when command is finished
            _overlayImage = command.OverlayImage;

            // execute the command
            ExecuteProcessingCommand(command, true);
        }