Пример #1
0
 // topleft, autosized
 public ImageElement AddTextAutoSize(Point topleft, Size max, string label, Font fnt, Color c, Color backcolour, float backscale, Object tag = null, string tiptext = null)
 {
     ImageElement lab = new ImageElement();
     lab.TextAutosize(topleft, max, label, fnt, c, backcolour, backscale, tag, tiptext);
     elements.Add(lab);
     return lab;
 }
Пример #2
0
 public ImageElement AddImage(Rectangle p, Image img , Object tag = null, string tiptext = null)
 {
     ImageElement lab = new ImageElement();
     lab.Image(p,img,tag,tiptext);
     elements.Add(lab);
     return lab;
 }
Пример #3
0
 private void CreateTileNotification()
 {
     var text1 = new TextElement() { StringData = this.Group1Tbx.Text };
     var text2 = new TextElement() { StringData = this.Group2Tbx.Text };
     var defaultImgPath = "ms-appx:///Assets/Logo.png";
     var imgPath1 = this.Group1ImgTbx.Text;
     if (String.IsNullOrEmpty(imgPath1) || String.IsNullOrWhiteSpace(imgPath1))
         imgPath1 = defaultImgPath;
     var imgPath2 = this.Group2ImgTbx.Text;
     if (String.IsNullOrEmpty(imgPath2) || String.IsNullOrWhiteSpace(imgPath2))
         imgPath2 = defaultImgPath;
     var image1 = new ImageElement() { ImageSource = imgPath1, IsRemoveMargin = true };
     var image2 = new ImageElement() { ImageSource = imgPath2, IsRemoveMargin = true };
     var subgroup1 = new SubGroupElement() { weight = 1, ChildElements = new IChildElement[] { text1, image1 } };
     var subgroup2 = new SubGroupElement() { weight = 1, ChildElements = new IChildElement[] { text2, image2 } };
     var group1 = new GroupElement() { Subgroups = new SubGroupElement[] { subgroup1, subgroup2 } };
     var group2 = new GroupElement() { Subgroups = new SubGroupElement[] { subgroup1, subgroup2 } };
     var visual = new TileVisualElement()
     {
         version = 3,
         BindingElements = new TileBindingElement[]
         {
             new TileBindingElement() { TileTemplate = AdaptiveTileSizeEnum.TileWide, Group = group1 },
             new TileBindingElement() { TileTemplate = AdaptiveTileSizeEnum.TileMedium, Group = group2 }
         }
     };
     var tile = new TileElement() { visual = visual };
     var notification = new TileNotification(AdaptiveShellHelper.TrySerializeTileTemplateToXml(tile));
     TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
 }
Пример #4
0
        protected void btnCreatePDF_Click(object sender, EventArgs e)
        {
            // create a PDF document
            Document document = new Document();

            // set the license key
            document.LicenseKey = "B4mYiJubiJiInIaYiJuZhpmahpGRkZE=";

            // add a page to the PDF document
            PdfPage firstPage = document.AddPage();

            string imagesPath = System.IO.Path.Combine(Server.MapPath("~"), "Images");

            // display image in the available space in page and with a auto determined height to keep the aspect ratio
            ImageElement imageElement1 = new ImageElement(0, 0, System.IO.Path.Combine(imagesPath, "evologo-250.png"));
            AddElementResult addResult = firstPage.AddElement(imageElement1);

            // display image with the specified width and the height auto determined to keep the aspect ratio
            // the images is displayed to the right of the previous image and the bounds of the image inside the current page
            // are taken from the AddElementResult object
            ImageElement imageElement2 = new ImageElement(addResult.EndPageBounds.Right + 10, 0, 100,
                    System.IO.Path.Combine(imagesPath, "evologo-250.png"));
            addResult = firstPage.AddElement(imageElement2);

            // Display image with the specified width and the specified height. It is possible for the image to not preserve the aspect ratio
            // The images is displayed to the right of the previous image and the bounds of the image inside the current page
            // are taken from the AddElementResult object
            ImageElement imageElement3 = new ImageElement(addResult.EndPageBounds.Right + 10, 0, 100, 50,
                    System.IO.Path.Combine(imagesPath, "evologo-250.png"));
            addResult = firstPage.AddElement(imageElement3);

            try
            {
                // get the PDF document bytes
                byte[] pdfBytes = document.Save();

                // send the generated PDF document to client browser

                // get the object representing the HTTP response to browser
                HttpResponse httpResponse = HttpContext.Current.Response;

                // add the Content-Type and Content-Disposition HTTP headers
                httpResponse.AddHeader("Content-Type", "application/pdf");
                httpResponse.AddHeader("Content-Disposition", String.Format("attachment; filename=ImageElement.pdf; size={0}", pdfBytes.Length.ToString()));

                // write the PDF document bytes as attachment to HTTP response
                httpResponse.BinaryWrite(pdfBytes);

                // Note: it is important to end the response, otherwise the ASP.NET
                // web page will render its content to PDF document stream
                httpResponse.End();
            }
            finally
            {
                // close the PDF document to release the resources
                document.Close();
            }
        }
Пример #5
0
        private void btnCreatePdf_Click(object sender, EventArgs e)
        {
            // create a PDF document
            Document document = new Document();

            // set the license key
            document.LicenseKey = "B4mYiJubiJiInIaYiJuZhpmahpGRkZE=";

            // add a page to the PDF document
            PdfPage firstPage = document.AddPage();

            string logoImagePath = System.IO.Path.Combine(Application.StartupPath, @"..\..\img\evologo-250.png");
            string certificateFilePath = System.IO.Path.Combine(Application.StartupPath, @"..\..\certificates\evopdf.pfx");

            PdfFont pdfFont = document.Fonts.Add(new Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Point));
            TextElement descriptionTextElement = new TextElement(0, 0,
                "A digital signature was applied on the logo image below. Click on the image to see the signature details", pdfFont);
            AddElementResult addResult = firstPage.AddElement(descriptionTextElement);

            // create the area where the digital signature will be displayed in the PDF document
            // in this sample the area is a logo image but it could be anything else
            ImageElement logoElement = new ImageElement(0, addResult.EndPageBounds.Bottom + 10, 100, logoImagePath);
            addResult = firstPage.AddElement(logoElement);

            //get the #PKCS 12 certificate from file
            DigitalCertificatesCollection certificates = DigitalCertificatesStore.GetCertificates(certificateFilePath, "evopdf");
            DigitalCertificate certificate = certificates[0];

            // create the digital signature over the logo image element
            DigitalSignatureElement signature = new DigitalSignatureElement(addResult.EndPageBounds, certificate);
            signature.Reason = "Protect the document from unwanted changes";
            signature.ContactInfo = "The contact email is [email protected]";
            signature.Location = "Development server";
            firstPage.AddElement(signature);

            string outFilePath = System.IO.Path.Combine(Application.StartupPath, "DigitalSignature.pdf");

            // save the PDF document to disk
            document.Save(outFilePath);

            // close the PDF document to release the resources
            document.Close();

            DialogResult dr = MessageBox.Show("Open the saved file in an external viewer?", "Open Rendered File", MessageBoxButtons.YesNo);
            if (dr == DialogResult.Yes)
            {
                try
                {
                    System.Diagnostics.Process.Start(outFilePath);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
        }
Пример #6
0
        private void btnCreatePdf_Click(object sender, EventArgs e)
        {
            // create a PDF document
            Document document = new Document();

            // set the license key
            document.LicenseKey = "B4mYiJubiJiInIaYiJuZhpmahpGRkZE=";

            // add a page to the PDF document
            PdfPage firstPage = document.AddPage();

            string imagesPath = System.IO.Path.Combine(Application.StartupPath, @"..\..\Img");

            // display image in the available space in page and with a auto determined height to keep the aspect ratio
            ImageElement imageElement1 = new ImageElement(0, 0, System.IO.Path.Combine(imagesPath, "evologo-250.png"));
            AddElementResult addResult = firstPage.AddElement(imageElement1);

            // display image with the specified width and the height auto determined to keep the aspect ratio
            // the images is displayed to the right of the previous image and the bounds of the image inside the current page
            // are taken from the AddElementResult object
            ImageElement imageElement2 = new ImageElement(addResult.EndPageBounds.Right + 10, 0, 100,
                    System.IO.Path.Combine(imagesPath, "evologo-250.png"));
            addResult = firstPage.AddElement(imageElement2);

            // Display image with the specified width and the specified height. It is possible for the image to not preserve the aspect ratio
            // The images is displayed to the right of the previous image and the bounds of the image inside the current page
            // are taken from the AddElementResult object
            ImageElement imageElement3 = new ImageElement(addResult.EndPageBounds.Right + 10, 0, 100, 50,
                    System.IO.Path.Combine(imagesPath, "evologo-250.png"));
            addResult = firstPage.AddElement(imageElement3);

            string outFilePath = System.IO.Path.Combine(Application.StartupPath, "ImageElementDemo.pdf");

            // save the PDF document to disk
            document.Save(outFilePath);

            // close the PDF document to release the resources
            document.Close();

            DialogResult dr = MessageBox.Show("Open the saved file in an external viewer?", "Open Rendered File", MessageBoxButtons.YesNo);
            if (dr == DialogResult.Yes)
            {
                try
                {
                    System.Diagnostics.Process.Start(outFilePath);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
        }
Пример #7
0
        public UIElement CreateLayout()
        {
            StackPanel root = new StackPanel();

            ImageElement map = new ImageElement {
                Source = UIImages[0],
                HorizontalAlignment = HorizontalAlignment.Right,
                Width  = 300.0f,
                Height = 400.0f,
                Margin = new Thickness(0, 0, 0, 20, 20, 0),
            };

            //root.Children.Add(map);

            return(root);
        }
Пример #8
0
        private Texture GetImageForImageElement(ImageElement element)
        {
            Texture result = null;

            if (!String.IsNullOrEmpty(element.Filename))
            {
                if (!this.ImageCache.TryGetValue(element, out result))
                {
                    result = Texture.FromFile(Device, element.Filename); // ToDispose()

                    this.ImageCache[element] = result;
                }
            }

            return(result);
        }
Пример #9
0
        public void TestMeasureOverrideInfiniteValues(StretchType stretch)
        {
            var imageSize = new Vector3(100, 50, 0);
            var sprite    = new Sprite {
                Region = new Rectangle(0, 0, (int)imageSize.X, (int)imageSize.Y), Borders = new Vector4(1, 2, 3, 4)
            };
            var image = new ImageElement {
                Source = (SpriteFromTexture)sprite, StretchType = stretch
            };

            image.Measure(new Vector3(float.PositiveInfinity));
            Assert.AreEqual(imageSize, image.DesiredSizeWithMargins);

            image.Measure(new Vector3(150, float.PositiveInfinity, 10));
            Assert.AreEqual(stretch == StretchType.None ? imageSize : new Vector3(150, 75, 0), image.DesiredSizeWithMargins);
        }
Пример #10
0
 public VSCompletionItemData(
     string displayText,
     ImageElement icon,
     ImmutableArray <AsyncCompletionData.CompletionFilter> filters,
     int filterSetData,
     ImmutableArray <ImageElement> attributeIcons,
     string insertionText
     )
 {
     DisplayText    = displayText;
     Icon           = icon;
     Filters        = filters;
     FilterSetData  = filterSetData;
     AttributeIcons = attributeIcons;
     InsertionText  = insertionText;
 }
Пример #11
0
        public ImageElement LoadImage(string url, bool createMask)
        {
            if (_images.ContainsKey(url))
            {
                return(_images[url]);
            }

            ImageElement image = (ImageElement)Document.CreateElement("IMG");

            _resourcesToLoad++;
            _resourcesToLoadLabel.InnerHTML = _resourcesToLoad.ToString();
            image.AddEventListener("load", createMask? _maskedResourceLoaded : _resourceLoaded, true);
            image.Src    = url;
            _images[url] = image;
            return(image);
        }
 public Navigator UseWindow(int windowIndex)
 {
     _windowId = windowIndex;
     _container = _runningApp.GetWindows()[windowIndex];
     _button = null;
     _checkBox = null;
     _label = null;
     _radioButton = null;
     _textBox = null;
     _comboBox = null;
     _image = null;
     _tab = null;
     _treeView = null;
     _panel = null;
     return this;
 }
Пример #13
0
        public void TestArrangeOverrideInfiniteValues(StretchType stretch)
        {
            var imageSize = new Vector3(100, 50, 0);
            var Sprite    = new Sprite {
                Region = new Rectangle(0, 0, (int)imageSize.X, (int)imageSize.Y), Borders = new Vector4(1, 2, 3, 4)
            };
            var image = new ImageElement {
                Source = Sprite, StretchType = stretch
            };

            image.Arrange(new Vector3(float.PositiveInfinity), false);
            Assert.AreEqual(imageSize, image.RenderSize);

            image.Arrange(new Vector3(150, float.PositiveInfinity, 10), false);
            Assert.AreEqual(stretch == StretchType.None ? imageSize : new Vector3(150, 75, 0), image.RenderSize);
        }
Пример #14
0
        public void Close(ElementEvent e)
        {
            DivElement menu     = Document.GetElementById <DivElement>("histogram");
            DivElement closeBtn = Document.GetElementById <DivElement>("histogramClose");

            menu.Style.Display = "none";
            Window.RemoveEventListener("click", Close, true);

            ImageElement image = Document.GetElementById <ImageElement>("graph");

            image.RemoveEventListener("mousedown", MouseDown, false);
            image.RemoveEventListener("mousemove", mousemove, false);
            image.RemoveEventListener("mouseup", mouseup, false);
            dropDown.RemoveEventListener("change", CurveStyleSelected, false);
            dropDown.RemoveEventListener("click", IgnoreMe, true);
        }
Пример #15
0
        public void RemoveItem(ImageElement orgimg, Color?backcolour)
        {
            int i = elements.IndexOf(orgimg);

            if (i >= 0)
            {
                if (!backcolour.HasValue)
                {
                    backcolour = FillColor;
                }
                Bitmap b = Image as Bitmap;
                BaseUtils.BitMapHelpers.ClearBitmapArea(b, orgimg.Location, backcolour.Value); // fill old element with back colour even if transparent
                orgimg.Dispose();
                elements.RemoveAt(i);
            }
        }
Пример #16
0
        private void IntializeElementResources()
        {
            dynamic element = null;

            TextElement  textElement  = element as TextElement;
            ImageElement imageElement = element as ImageElement;

            if (textElement != null)
            {
                this.GetFontForTextElement(textElement);
            }
            else if (imageElement != null)
            {
                this.GetImageForImageElement(imageElement);
            }
        }
Пример #17
0
        private void CreateMainMenuUI()
        {
            var strideLogo = new ImageElement {
                Source = SpriteFromSheet.Create(UIImages, "sd_logo")
            };

            strideLogo.SetCanvasPinOrigin(new Vector3(0.5f, 0.5f, 1f));
            strideLogo.SetCanvasRelativeSize(new Vector3(0.75f, 0.5f, 1f));
            strideLogo.SetCanvasRelativePosition(new Vector3(0.5f, 0.3f, 1f));

            var startButton = new Button
            {
                Content = new TextBlock
                {
                    Font                = Font,
                    Text                = "Touch to Start",
                    TextColor           = Color.Black,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center
                },
                NotPressedImage = buttonImage,
                PressedImage    = buttonImage,
                MouseOverImage  = buttonImage,
                Padding         = new Thickness(77, 30, 25, 30),
                MinimumWidth    = 250f,
            };

            startButton.SetCanvasPinOrigin(new Vector3(0.5f, 0.5f, 1f));
            startButton.SetCanvasRelativePosition(new Vector3(0.5f, 0.7f, 0f));
            startButton.Click += (sender, args) =>
            {
                GameGlobals.GameStartedEventKey.Broadcast();
                StartGameMode();
            };

            var mainMenuCanvas = new Canvas();

            mainMenuCanvas.Children.Add(strideLogo);
            mainMenuCanvas.Children.Add(startButton);

            mainMenuRoot = new ModalElement
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Content             = mainMenuCanvas
            };
        }
Пример #18
0
    public IEnumerator WithEmojiComplex2()
    {
        // 最後のgooooo..dが分離されて浮くように。
        var box = BoxElement.GO(
            null,// bg画像
            () =>
        {
            Debug.Log("ルートがタップされた");
        },
            TextElement.GO("hannidjkfajfaoooood"),                                                // テキスト
            ImageElement.GO(null),                                                                // 画像
            ButtonElement.GO(null, () => { Debug.Log("ボタンがタップされた"); }),
            TextElement.GO("hannin is yasu!\U0001F60A this is public problem! goooooooooooooad"), // テキスト
            ImageElement.GO(null),                                                                // 画像
            ImageElement.GO(null),                                                                // 画像
            TextElement.GO("hannidjkfajfaoooood2")
            );

        // レイアウトに使うクラスを生成する
        var layouter = new BasicLayouter();

        // コンテンツのサイズをセットする
        var size = new Vector2(600, 100);

        // レイアウトを行う

        box = LayouTaro.Layout(
            canvas.transform,
            size,
            box,
            layouter
            );

        var rectTrans = box.gameObject.GetComponent <RectTransform>();

        rectTrans.anchoredPosition3D = Vector3.zero;
        rectTrans.localScale         = Vector3.one;

        ScreenCapture.CaptureScreenshot("./images/" + methodName);

        while (false)
        {
            yield return(null);
        }

        yield break;
    }
Пример #19
0
        /// <summary>
        /// Creates the barcode image element.
        /// </summary>
        /// <param name="linearEncoder"></param>
        /// <param name="quietzone"></param>
        /// <returns>The generated barcode image inside an ImageElement object.</returns>
        internal static ImageElement GetBarcodeImage(LinearEncoder linearEncoder, int quietzone)
        {
            // Set the encoding image width from the minimum width multiplied by the x-dimension
            int barcodeImageWidth = linearEncoder.LinearEncoding.MinimumWidth * linearEncoder.XDimension;

            // Create a new bitmap image for the barcode based on the calculated dimensions
            ImageElement barcodeElement = new ImageElement(new Bitmap(barcodeImageWidth, linearEncoder.BarcodeHeight));

            barcodeElement.Image.SetResolution(linearEncoder.Dpi, linearEncoder.Dpi);

            //Create a new graphics to draw on the barcode image
            Graphics barcodeGraphics = Graphics.FromImage(barcodeElement.Image);

            int xPosition = 0;
            int yPosition = 0;

            barcodeGraphics.FillRectangle(Brushes.White, xPosition, yPosition, barcodeElement.Image.Width, barcodeElement.Image.Height);

            // Loop through each encoded symbol and convert to bars based on selected symbology
            for (int symbol = 0; symbol <= linearEncoder.LinearEncoding.Symbols.Count - 1; symbol++)
            {
                LinearPattern symbolPattern = linearEncoder.LinearEncoding.Symbols[symbol].Pattern;

                // Build the barcode symbol and insert
                for (int module = 0; module <= symbolPattern.Count - 1; module++)
                {
                    switch (symbolPattern[module].ModuleType)
                    {
                    case ModuleType.Bar:     // Bar
                        int barWidth = symbolPattern[module].Width * linearEncoder.XDimension;
                        barcodeGraphics.FillRectangle(Brushes.Black, xPosition, yPosition, barWidth, linearEncoder.BarcodeHeight);
                        xPosition += barWidth;
                        barcodeGraphics.Flush();
                        break;

                    case ModuleType.Space:     // Space
                        int spaceWidth = symbolPattern[module].Width * linearEncoder.XDimension;
                        xPosition += spaceWidth;
                        break;
                    }
                }
            }

            barcodeElement.Position.XPosition = quietzone;
            return(barcodeElement);
        }
Пример #20
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var imgElt = new ImageElement {
                Source = new Sprite(Content.Load <Texture>("uv")), StretchType = StretchType.Fill
            };

            imgElt.DependencyProperties.Set(GridBase.RowSpanPropertyKey, 2);
            imgElt.DependencyProperties.Set(GridBase.ColumnSpanPropertyKey, 2);
            imgElt.DependencyProperties.Set(GridBase.RowPropertyKey, 1);
            imgElt.DependencyProperties.Set(GridBase.ColumnPropertyKey, 1);

            var button1 = new Button();

            button1.DependencyProperties.Set(GridBase.RowPropertyKey, 3);
            button1.DependencyProperties.Set(GridBase.ColumnPropertyKey, 0);

            var button2 = new Button();

            button2.DependencyProperties.Set(GridBase.RowPropertyKey, 3);
            button2.DependencyProperties.Set(GridBase.ColumnPropertyKey, 3);

            var text = new TextBlock
            {
                Text = "Test Uniform Grid",
                Font = Content.Load <SpriteFont>("MicrosoftSansSerif15"),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            };

            text.DependencyProperties.Set(GridBase.ColumnSpanPropertyKey, 2);
            text.DependencyProperties.Set(GridBase.RowPropertyKey, 0);
            text.DependencyProperties.Set(GridBase.ColumnPropertyKey, 1);

            var grid = new UniformGrid {
                Rows = 4, Columns = 4
            };

            grid.Children.Add(imgElt);
            grid.Children.Add(button1);
            grid.Children.Add(button2);
            grid.Children.Add(text);

            UIComponent.RootElement = grid;
        }
Пример #21
0
    IEnumerator Start()
    {
        // generate your own data structure with parameters for UI.
        var box = BoxElement.GO(
            null,// UI bg with image
            () =>
        {
            Debug.Log("root box element is tapped.");
        },
            TextElement.GO("hannin is yasu! this is public problem\U0001F60A! gooooooooooooood "), // text.
            ImageElement.GO(null),                                                                 // image.
            ButtonElement.GO(null, () => { Debug.Log("button is tapped."); })
            );

        // generate the layouter which you want to use for layout.
        var layouter = new BasicLayouter();

        // set the default size of content.
        var size = new Vector2(600, 100);

        // do layout with LayouTaro. the GameObject will be returned with layouted structure.
        box = LayouTaro.Layout(
            canvas.transform,
            size,
            box,
            layouter
            );

        box.gameObject.transform.SetParent(canvas.transform);
        box.gameObject.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;

        yield return(null);

        // update element values and re-layout with same GameObject.
        box = LayouTaro.RelayoutWithUpdate(
            size,
            box,
            new Dictionary <LTElementType, object> {
            { LTElementType.Image, null },
            { LTElementType.Text, "relayout\U0001F60A!" }
        },
            layouter
            );

        yield return(null);
    }
Пример #22
0
    public IEnumerator LayoutOneLineTextDoesNotContainInTheEndOfLine()
    {
        var box = BoxElement.GO(
            null,// bg画像
            () =>
        {
            Debug.Log("ルートがタップされた");
        },
            TextElement.GO("hannin is yasu! this is public problem! gooooooood"), // テキスト
            ImageElement.GO(null),                                                // 画像
            ImageElement.GO(6.558f + 0.0002f, 10f),
            TextElement.GO("lllllllllllllx"),
            TextElement.GO("dijklmnoああああああああああああいえああああ")
            );

        // レイアウトに使うクラスを生成する
        var layouter = new BasicLayouter();

        // コンテンツのサイズをセットする
        var size = new Vector2(600, 100);

        // レイアウトを行う

        box = LayouTaro.Layout(
            canvas.transform,
            size,
            box,
            layouter
            );

        var rectTrans = box.gameObject.GetComponent <RectTransform>();

        rectTrans.anchoredPosition3D = Vector3.zero;
        rectTrans.localScale         = Vector3.one;

        yield return(null);

        while (false)
        {
            yield return(null);
        }

        ScreenCapture.CaptureScreenshot("./images/" + methodName);
        yield break;
    }
Пример #23
0
        public virtual void MakeTexture()
        {
            if (PrepDevice != null)
            {
                try
                {
                    texture2d = PrepDevice.createTexture();

                    PrepDevice.bindTexture(GL.TEXTURE_2D, texture2d);
                    PrepDevice.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_WRAP_S, GL.CLAMP_TO_EDGE);
                    PrepDevice.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_WRAP_T, GL.CLAMP_TO_EDGE);

                    if (dataset.Extension.ToLowerCase().IndexOf("fits") > -1 && RenderContext.UseGlVersion2)
                    {
                        PrepDevice.texImage2D(GL.TEXTURE_2D, 0, GL.R32F, (int)fitsImage.SizeX, (int)fitsImage.SizeY, 0, GL.RED, GL.FLOAT, fitsImage.dataUnit);
                        PrepDevice.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MIN_FILTER, GL.NEAREST);
                        PrepDevice.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MAG_FILTER, GL.NEAREST);
                    }
                    else
                    {
                        ImageElement image = texture;
                        // Before we bind resize to a power of two if nessesary so we can MIPMAP
                        if (!Texture.IsPowerOfTwo(texture.Height) | !Texture.IsPowerOfTwo(texture.Width))
                        {
                            CanvasElement temp = (CanvasElement)Document.CreateElement("canvas");
                            temp.Height = Texture.FitPowerOfTwo(image.Height);
                            temp.Width  = Texture.FitPowerOfTwo(image.Width);
                            CanvasContext2D ctx = (CanvasContext2D)temp.GetContext(Rendering.Render2D);
                            ctx.DrawImage(image, 0, 0, temp.Width, temp.Height);
                            //Substitute the resized image
                            image = (ImageElement)(Element)temp;
                        }
                        PrepDevice.texImage2D(GL.TEXTURE_2D, 0, GL.RGBA, GL.RGBA, GL.UNSIGNED_BYTE, image);
                        PrepDevice.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MIN_FILTER, GL.LINEAR_MIPMAP_NEAREST);
                        PrepDevice.generateMipmap(GL.TEXTURE_2D);
                    }

                    PrepDevice.bindTexture(GL.TEXTURE_2D, null);
                }
                catch
                {
                    errored = true;
                }
            }
        }
Пример #24
0
        public DrawPage()
        {
            this.InitializeComponent();

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            SystemNavigationManager.GetForCurrentView().BackRequested += (o, e) =>
            {
                Frame.Navigate(typeof(MainPage), ImageElement.Source);
            };

            this.PropertyChanged += (o, e) =>
            {
                ImageElement.Render();
            };

            MyInkCanvas.InkPresenter.IsInputEnabled   = true;
            MyInkCanvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Touch | CoreInputDeviceTypes.Pen;
        }
Пример #25
0
        private void MaskedResourceLoaded(ElementEvent e)
        {
            CanvasElement canvas = (CanvasElement)Document.CreateElement("CANVAS");
            ImageElement  image  = (ImageElement)e.Target;

            canvas.Width  = image.NaturalWidth;
            canvas.Height = image.NaturalHeight;

            CanvasContext2D context = (CanvasContext2D)canvas.GetContext(Rendering.Render2D);

            context.FillStyle = "black";
            context.FillRect(0, 0, image.NaturalWidth, image.NaturalHeight);
            context.CompositeOperation = CompositeOperation.Xor;
            context.DrawImage(image, 0, 0);
            _masks[image.Src] = canvas;

            ResourceLoaded(e);
        }
Пример #26
0
        public ImageElement CreateImageFromFile(string path)
        {
            BitmapImage background = new BitmapImage();

            background.BeginInit();
            background.CacheOption   = BitmapCacheOption.OnLoad;
            background.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
            background.UriSource     = new Uri(path, UriKind.Absolute);
            background.EndInit();
            ImageSource  TemplateImage = background;
            ImageElement newImage      = new ImageElement();

            newImage.Image        = TemplateImage;
            newImage.CurrentImage = background;
            newImage.Name         = Path.GetFileNameWithoutExtension(new FileInfo(path).Name);
            newImage.CreationDate = new FileInfo(path).CreationTimeUtc;
            return(newImage);
        }
Пример #27
0
        public UndoTourPropertiesChange(string text, TourDocument tour)
        {
            undoTitle           = tour.Title;
            undoAuthor          = tour.Author;
            undoAuthorEmail     = tour.AuthorEmail;
            undoDescription     = tour.Description;
            undoAuthorImage     = tour.AuthorImage;
            undoOrganizationUrl = tour.OrganizationUrl;
            undoOrgName         = tour.OrgName;
            undoKeywords        = tour.Keywords;
            undoTaxonomy        = tour.Taxonomy;
            undoLevel           = tour.Level;
            //        undoDomeMode = tour.DomeMode;

            actionText           = text;
            targetTour           = tour;
            targetTour.TourDirty = true;
        }
Пример #28
0
        internal static void SetMouseHidden(bool hidden)
        {
            if (DirectXHook == null)
            {
                return;
            }

            if (_cursor == null)
            {
                var cursorPic = new Bitmap(Main.GTANInstallDir + "images\\cef\\cursor.png");
                _cursor = new ImageElement(null, true);
                _cursor.SetBitmap(cursorPic);
                _cursor.Hidden = true;
                DirectXHook.AddImage(_cursor, 1);
            }

            _cursor.Hidden = hidden;
        }
Пример #29
0
        private void Generate()
        {
            int position = _startPosition;

            while (position < _endPosition)
            {
                if (Math.Random() * 100 < _density)
                {
                    ImageElement image      = _images[Math.Floor(Math.Random() * _images.Count)];
                    GameObject   gameObject = GameObject.Create(image, 0, image.NaturalHeight);
                    gameObject.Location = new Vector3D(position, 590, ShooterLevel.BuildingsZ);
                    position           += image.NaturalWidth;
                    _buildings.Add(gameObject);
                }

                position += Math.Random() * 40;
            }
        }
Пример #30
0
        public async Task <ImageGroup> FindImgByIdAsync(string objectId)
        {
            ImageElement element = _repository.FindImageElementById(objectId);

            if (element == null)
            {
                return(null);
            }

            ImageElementTranItem[] tranItems =
                await _repository.GetImageTranItemsByObjectIdAsync(objectId);

            return(new ImageGroup()
            {
                MediaElement = element,
                TramItems = tranItems,
            });
        }
Пример #31
0
        public override void Start()
        {
            base.Start();

            var uiComponent = Entity.Get <UIComponent>();

            _imageElement = uiComponent.Page.RootElement.VisualChildren.FirstOrDefault() as ImageElement;
            _width        = (int)uiComponent.Resolution.X;
            _height       = (int)uiComponent.Resolution.Y;
            _texture      = Texture.New2D(this.GraphicsDevice, _width, _height, Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget);
            _sprite       = new SpriteFromTexture();
            if (!_rendererInitialized)
            {
                UltralightDll.InitializeApp(this.AssetDirectory);
                _rendererInitialized = true;
            }
            UltralightDll.CreateView(_width, _height, "file:///" + HtmlFile);
        }
Пример #32
0
 private void AddTiles(List <ImageItem> imageList)
 {
     _imageTileControl.Groups[0].Tiles.Clear();
     foreach (var imageitem in imageList)
     {
         Tile tile = new Tile();
         tile.HorizontalSize = 2;
         tile.VerticalSize   = 2;
         _imageTileControl.Groups[0].Tiles.Add(tile);
         Image        img = Image.FromStream(new MemoryStream(imageitem.Base64));
         Template     tl  = new Template();
         ImageElement ie  = new ImageElement();
         ie.ImageLayout = ForeImageLayout.Stretch;
         tl.Elements.Add(ie);
         tile.Template = tl;
         tile.Image    = img;
     }
 }
Пример #33
0
        /// <summary>
        /// Builds a <see cref="CompletionItem"/> based on <see cref="ElementCatalog.Element"/>
        /// </summary>
        private CompletionItem MakeItemFromElement(ElementCatalog.Element element)
        {
            ImageElement icon = null;
            ImmutableArray <CompletionFilter> filters;

            switch (element.Category)
            {
            case ElementCatalog.Element.Categories.Metal:
                icon    = MetalIcon;
                filters = MetalFilters;
                break;

            case ElementCatalog.Element.Categories.Metalloid:
                icon    = MetalloidIcon;
                filters = MetalloidFilters;
                break;

            case ElementCatalog.Element.Categories.NonMetal:
                icon    = NonMetalIcon;
                filters = NonMetalFilters;
                break;

            case ElementCatalog.Element.Categories.Uncategorized:
                icon    = UnknownIcon;
                filters = UnknownFilters;
                break;
            }
            var item = new CompletionItem(
                displayText: element.Name,
                source: this,
                icon: icon,
                filters: filters,
                suffix: element.Symbol,
                insertText: element.Name,
                sortText: $"Element {element.AtomicNumber,3}",
                filterText: $"{element.Name} {element.Symbol}",
                attributeIcons: ImmutableArray <ImageElement> .Empty);

            // Each completion item we build has a reference to the element in the property bag.
            // We use this information when we construct the tooltip.
            item.Properties.AddProperty(nameof(ElementCatalog.Element), element);

            return(item);
        }
Пример #34
0
        public virtual void CleanUp(bool removeFromParent)
        {
            ReadyToRender  = false;
            DemData        = null;
            demFile        = null;
            demDownloading = false;
            texReady       = false;
            DemReady       = false;
            errored        = false;
            if (this.texture != null)
            {
                this.texture = null;
            }

            RenderTriangleLists = new List <RenderTriangle> [4];
            GeometryCreated     = false;
            if (removeFromParent && Parent != null)
            {
                Parent.RemoveChild(this);
                Parent = null;
            }

            if (PrepDevice != null)
            {
                foreach (WebGLBuffer buf in IndexBuffers)
                {
                    PrepDevice.deleteBuffer(buf);
                }
                IndexBuffers = new WebGLBuffer[4];

                if (VertexBuffer != null)
                {
                    PrepDevice.deleteBuffer(VertexBuffer);
                    VertexBuffer = null;
                }

                if (texture2d != null)
                {
                    PrepDevice.deleteTexture(texture2d);

                    texture2d = null;
                }
            }
        }
Пример #35
0
        public void TestImageElement()
        {
            // Arrange
            ImageElement imageElement = new ImageElement()
            {
                ElementAddress = 0x12345678, Data = new byte[] { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }
            };
            // Act
            var ser     = imageElement.Serialize();
            var address = BinaryPrimitives.ReadUInt32LittleEndian(ser.AsSpan(0, 4));
            var size    = BinaryPrimitives.ReadUInt32LittleEndian(ser.AsSpan(4, 4));

            // Assert
            Assert.Equal(imageElement.ElementAddress, address);
            Assert.Equal(imageElement.ElementSize, size);
            Assert.Equal((uint)imageElement.Data.Length, size);
            Assert.Equal(0x12, ser[8]);
            Assert.Equal(0xEF, ser[15]);
        }
Пример #36
0
        public void RemoveImage(ImageElement element, int overlay = 0)
        {
            DebugMessage("RemoveImage");
            lock (_overlayLock)
            {
                if (OverlayEngine == null || OverlayEngine.Overlays == null)
                {
                    OverlayEngine = new DX11.DXOverlayEngine(this);
                }

                if (OverlayEngine.Overlays.Count == 0)
                {
                    OverlayEngine.Overlays.Add(new Overlay());
                    OverlayEngine.Overlays.Add(new Overlay());
                }

                OverlayEngine.Overlays[overlay].Elements.Add(element);
            }
        }
Пример #37
0
        protected override double GetNativeHeight(SceneElement element)
        {
            ImageElement imageElement = element as ImageElement;
            double       num          = 0.0;

            if (imageElement != null && imageElement.IsViewObjectValid)
            {
                BitmapImage imageSafe = this.GetImageSafe(imageElement);
                if (imageSafe != null)
                {
                    num = (double)imageSafe.PixelHeight;
                }
            }
            if (num == 0.0)
            {
                num = base.GetNativeHeight(element);
            }
            return(num);
        }
Пример #38
0
        public static byte[] GeneratePDF(string html, string title, int topMargin, int bottomMargin, int leftMargin, int rightMargin, Image backgroundImage)
        {
            var pdfConv = new PdfConverter { LicenseKey = "Z+n56Pv76Pn6/uj85vjo+/nm+frm8fHx8Q==" };

            pdfConv.PdfDocumentOptions.TopMargin = topMargin;
            pdfConv.PdfDocumentOptions.BottomMargin = bottomMargin;
            pdfConv.PdfDocumentOptions.LeftMargin = leftMargin;
            pdfConv.PdfDocumentOptions.RightMargin = rightMargin;

            pdfConv.PdfDocumentOptions.EmbedFonts = true;

            // set header options
            pdfConv.PdfDocumentOptions.ShowHeader = true;
            pdfConv.PdfHeaderOptions.HeaderHeight = 50;
            AddHeaderElements(pdfConv);

            // set footer options
            pdfConv.PdfDocumentOptions.ShowFooter = true;
            pdfConv.PdfFooterOptions.FooterHeight = 50f;
            AddFooterElements(pdfConv);

            pdfConv.PdfDocumentInfo.Title = title;
            pdfConv.PdfDocumentInfo.CreatedDate = DateTime.Now;
            pdfConv.PdfDocumentInfo.AuthorName = "";

            pdfConv.BeforeRenderPdfPageEvent += (BeforeRenderPdfPageParams args) =>
            {
                var page = args.Page;

                var pageWidth = page.ClientRectangle.Width;
                var pageHeight = page.ClientRectangle.Height;

                var imageElement = new ImageElement(0, 0, pageWidth, pageHeight, backgroundImage);
                imageElement.Opacity = 60;

                page.AddElement(imageElement);
            };

            return pdfConv.GetPdfBytesFromHtmlString(html, "http://www.thedrillbook.com/");
        }
Пример #39
0
        //单张图片上传
        private byte[] GenderPostData(ImageElement img, string boundary)
        {
            string fileName = GenderGUIDName();
            MemoryStream stream = new MemoryStream();

            WriteImageData(img.Value, boundary, "graph", fileName, stream);
            WritePostFooterData(boundary, stream);

            stream.Position = 0;
            byte[] postBuffer = new byte[stream.Length];
            stream.Read(postBuffer, 0, postBuffer.Length);
            stream.Close();

            return postBuffer;
        }
		void ShowAjaxIcon()
		{
			if (ajaxIcon == null)
			{
				ajaxIcon = (ImageElement) Document.CreateElement("IMG");
				ajaxIcon.Src = "/Gfx/autocomplete-loading.gif";
				ajaxIcon.Style.Height = "16px";
				ajaxIcon.Style.Width = "16px";
				ajaxIcon.Style.Position = "absolute";
				Offset offset = JQueryAPI.JQuery(anchor).Offset();
				ajaxIcon.Style.Left = (offset.Left + anchor.ClientWidth - 18) + "px";
				ajaxIcon.Style.Top = (offset.Top + 2) + "px";
				ajaxIcon.Style.ZIndex = 200;
				Document.Body.AppendChild(ajaxIcon);
			}
			ajaxIcon.Style.Display = "";
		}
Пример #41
0
        private void btnCreatePdf_Click(object sender, EventArgs e)
        {
            string pdfToModify = textBoxPdfFilePath.Text.Trim();

            // create a PDF document
            Document document = new Document(pdfToModify);

            // set the license key
            document.LicenseKey = "B4mYiJubiJiInIaYiJuZhpmahpGRkZE=";

            // get the first page the PDF document
            PdfPage firstPage = document.Pages[0];

            string logoTransImagePath = System.IO.Path.Combine(Application.StartupPath, @"..\..\img\evologo-100-trans.png");
            string logoOpaqueImagePath = System.IO.Path.Combine(Application.StartupPath, @"..\..\img\evologo-100.jpg");

            // add an opaque image stamp in the top left corner of the first page
            // and make it semitransparent when rendered in PDF
            ImageElement imageStamp = new ImageElement(1, 1, logoOpaqueImagePath);
            imageStamp.Opacity = 50;
            AddElementResult addResult = firstPage.AddElement(imageStamp);

            // add a border for the image stamp
            RectangleElement imageBorderRectangleElement = new RectangleElement(1, 1, addResult.EndPageBounds.Width,
                                addResult.EndPageBounds.Height);
            firstPage.AddElement(imageBorderRectangleElement);

            // add a template stamp to the document repeated on each document page
            // the template contains an image and a text

            System.Drawing.Image logoImg = System.Drawing.Image.FromFile(logoTransImagePath);

            // calculate the template stamp location and size
            System.Drawing.SizeF imageSizePx = logoImg.PhysicalDimension;

            float imageWidthPoints = UnitsConverter.PixelsToPoints(imageSizePx.Width);
            float imageHeightPoints = UnitsConverter.PixelsToPoints(imageSizePx.Height);

            float templateStampXLocation = (firstPage.ClientRectangle.Width - imageWidthPoints) / 2;
            float templateStampYLocation = firstPage.ClientRectangle.Height / 4;

            // the stamp size is equal to image size in points
            Template templateStamp = document.AddTemplate(new System.Drawing.RectangleF(templateStampXLocation, templateStampYLocation,
                    imageWidthPoints, imageHeightPoints + 20));

            // set a semitransparent background color for template
            RectangleElement background = new RectangleElement(0, 0, templateStamp.ClientRectangle.Width, templateStamp.ClientRectangle.Height);
            background.BackColor = Color.White;
            background.Opacity = 25;
            templateStamp.AddElement(background);

            // add a true type font to the document
            System.Drawing.Font ttfFontBoldItalic = new System.Drawing.Font("Times New Roman", 10,
                        System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point);
            PdfFont templateStampTextFont = document.AddFont(ttfFontBoldItalic, true);

            // Add a text element to the template. You can add any other types of elements to a template like a HtmlToPdfElement.
            TextElement templateStampTextElement = new TextElement(3, 0, "This is the Stamp Text", templateStampTextFont);
            templateStampTextElement.ForeColor = System.Drawing.Color.DarkBlue;
            templateStamp.AddElement(templateStampTextElement);

            // Add an image with transparency to the template. You can add any other types of elements to a template like a HtmlToPdfElement.
            ImageElement templateStampImageElement = new ImageElement(0, 20, logoImg);
            // instruct the library to use transparency information
            templateStampImageElement.RenderTransparentImage = true;
            templateStamp.AddElement(templateStampImageElement);

            // add a border to template
            RectangleElement templateStampRectangleElement = new RectangleElement(0, 0, templateStamp.ClientRectangle.Width,
                        templateStamp.ClientRectangle.Height);
            templateStamp.AddElement(templateStampRectangleElement);

            // dispose the image
            logoImg.Dispose();

            string outFilePath = System.IO.Path.Combine(Application.StartupPath, "PdfStamps.pdf");

            // save the PDF document to disk
            try
            {
                document.Save(outFilePath);
            }
            finally
            {
                document.Close();
            }

            DialogResult dr = MessageBox.Show("Open the saved file in an external viewer?", "Open Rendered File", MessageBoxButtons.YesNo);
            if (dr == DialogResult.Yes)
            {
                try
                {
                    System.Diagnostics.Process.Start(outFilePath);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
        }
Пример #42
0
			public MyDelegate(ImageElement container, UITableView table, NSIndexPath path)
			{
				this.container = container;
				this.table = table;
				this.path = path;
			}
Пример #43
0
        protected void btnCreatePDF_Click(object sender, EventArgs e)
        {
            string pdfToModify = textBoxPdfFilePath.Text.Trim();

            // create a PDF document
            Document document = new Document(pdfToModify);

            // set the license key
            document.LicenseKey = "B4mYiJubiJiInIaYiJuZhpmahpGRkZE=";

            // get the first page the PDF document
            PdfPage firstPage = document.Pages[0];

            string logoTransImagePath = System.IO.Path.Combine(Server.MapPath("~"), @"images\evologo-100-trans.png");
            string logoOpaqueImagePath = System.IO.Path.Combine(Server.MapPath("~"), @"images\evologo-100.jpg");

            // add an opaque image stamp in the top left corner of the first page
            // and make it semitransparent when rendered in PDF
            ImageElement imageStamp = new ImageElement(1, 1, logoOpaqueImagePath);
            imageStamp.Opacity = 50;
            AddElementResult addResult = firstPage.AddElement(imageStamp);

            // add a border for the image stamp
            RectangleElement imageBorderRectangleElement = new RectangleElement(1, 1, addResult.EndPageBounds.Width,
                                addResult.EndPageBounds.Height);
            firstPage.AddElement(imageBorderRectangleElement);

            // add a template stamp to the document repeated on each document page
            // the template contains an image and a text

            System.Drawing.Image logoImg = System.Drawing.Image.FromFile(logoTransImagePath);

            // calculate the template stamp location and size
            System.Drawing.SizeF imageSizePx = logoImg.PhysicalDimension;

            float imageWidthPoints = UnitsConverter.PixelsToPoints(imageSizePx.Width);
            float imageHeightPoints = UnitsConverter.PixelsToPoints(imageSizePx.Height);

            float templateStampXLocation = (firstPage.ClientRectangle.Width - imageWidthPoints) / 2;
            float templateStampYLocation = firstPage.ClientRectangle.Height / 4;

            // the stamp size is equal to image size in points
            Template templateStamp = document.AddTemplate(new System.Drawing.RectangleF(templateStampXLocation, templateStampYLocation,
                    imageWidthPoints, imageHeightPoints + 20));

            // set a semitransparent background color for template
            RectangleElement background = new RectangleElement(0, 0, templateStamp.ClientRectangle.Width, templateStamp.ClientRectangle.Height);
            background.BackColor = Color.White;
            background.Opacity = 25;
            templateStamp.AddElement(background);

            // add a true type font to the document
            System.Drawing.Font ttfFontBoldItalic = new System.Drawing.Font("Times New Roman", 10,
                        System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point);
            PdfFont templateStampTextFont = document.AddFont(ttfFontBoldItalic, true);

            // Add a text element to the template. You can add any other types of elements to a template like a HtmlToPdfElement.
            TextElement templateStampTextElement = new TextElement(3, 0, "This is the Stamp Text", templateStampTextFont);
            templateStampTextElement.ForeColor = System.Drawing.Color.DarkBlue;
            templateStamp.AddElement(templateStampTextElement);

            // Add an image with transparency to the template. You can add any other types of elements to a template like a HtmlToPdfElement.
            ImageElement templateStampImageElement = new ImageElement(0, 20, logoImg);
            // instruct the library to use transparency information
            templateStampImageElement.RenderTransparentImage = true;
            templateStamp.AddElement(templateStampImageElement);

            // add a border to template
            RectangleElement templateStampRectangleElement = new RectangleElement(0, 0, templateStamp.ClientRectangle.Width,
                        templateStamp.ClientRectangle.Height);
            templateStamp.AddElement(templateStampRectangleElement);

            // dispose the image
            logoImg.Dispose();

            // save the document on http response stream
            try
            {
                // get the PDF document bytes
                byte[] pdfBytes = document.Save();

                // send the generated PDF document to client browser

                // get the object representing the HTTP response to browser
                HttpResponse httpResponse = HttpContext.Current.Response;

                // add the Content-Type and Content-Disposition HTTP headers
                httpResponse.AddHeader("Content-Type", "application/pdf");
                httpResponse.AddHeader("Content-Disposition", String.Format("attachment; filename=PdfStamps.pdf; size={0}", pdfBytes.Length.ToString()));

                // write the PDF document bytes as attachment to HTTP response
                httpResponse.BinaryWrite(pdfBytes);

                // Note: it is important to end the response, otherwise the ASP.NET
                // web page will render its content to PDF document stream
                httpResponse.End();
            }
            finally
            {
                document.Close();
            }
        }
Пример #44
0
        protected override void OnMouseMove(MouseEventArgs eventargs)
        {
            base.OnMouseMove(eventargs);

            if (elementin == null)
            {
                foreach (ImageElement i in elements)
                {
                    if (i.pos.Contains(eventargs.Location))
                    {
                        elementin = i;
                        if (EnterElement != null)
                            EnterElement(this, elementin, elementin.tag);
                    }
                }
            }
            else
            {
                if (!elementin.pos.Contains(eventargs.Location))
                {
                    if (LeaveElement != null)
                        LeaveElement(this, elementin, elementin.tag);

                    elementin = null;
                }
            }

            if (Math.Abs(eventargs.X - hoverpos.X) + Math.Abs(eventargs.Y - hoverpos.Y) > 8 || elementin == null)
            {
                ClearHoverTip();
            }

            if ( elementin != null && !hovertimer.Enabled && hovertip == null)
            {
                hoverpos = eventargs.Location;
                hovertimer.Start();
            }
        }
Пример #45
0
 private ImageElement GetNormalImage(int no, string id)
 {
     string path = ImageNormalMap[no] as string;
     if (!string.IsNullOrEmpty(path))
     {
         ImageElement element = new ImageElement();
         element.Name = "normal";
         element.ReportID = id;
         element.Url = ImageServer + path;
         return element;
     }
     return null;
 }
Пример #46
0
        private void Populate(object callbacks, object o, RootElement root)
        {
            MemberInfo last_radio_index = null;
            var members = o.GetType().GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Public |
                                                 BindingFlags.NonPublic | BindingFlags.Instance);

            Section section = null;

            foreach (var mi in members)
            {
                Type mType = GetTypeForMember(mi);

                if (mType == null)
                    continue;

                string caption = null;
                object[] attrs = mi.GetCustomAttributes(false);
                bool skip = false;
                foreach (var attr in attrs)
                {
                    if (attr is SkipAttribute || attr is System.Runtime.CompilerServices.CompilerGeneratedAttribute)
                        skip = true;
                    else if (attr is CaptionAttribute)
                        caption = ((CaptionAttribute)attr).Caption;
                    else if (attr is SectionAttribute)
                    {
                        if (section != null)
                            root.Add(section);
                        var sa = attr as SectionAttribute;
                        section = new Section(sa.Caption, sa.Footer);
                    }
                }
                if (skip)
                    continue;

                if (caption == null)
                    caption = MakeCaption(mi.Name);

                if (section == null)
                    section = new Section();

                Element element = null;
                if (mType == typeof(string))
                {
                    PasswordAttribute pa = null;
                    AlignmentAttribute align = null;
                    EntryAttribute ea = null;
                    object html = null;
                    Action invoke = null;
                    bool multi = false;

                    foreach (object attr in attrs)
                    {
                        if (attr is PasswordAttribute)
                            pa = attr as PasswordAttribute;
                        else if (attr is EntryAttribute)
                            ea = attr as EntryAttribute;
                        else if (attr is MultilineAttribute)
                            multi = true;
                        else if (attr is HtmlAttribute)
                            html = attr;
                        else if (attr is AlignmentAttribute)
                            align = attr as AlignmentAttribute;

                        if (attr is OnTapAttribute)
                        {
                            string mname = ((OnTapAttribute)attr).Method;

                            if (callbacks == null)
                            {
                                throw new Exception(
                                    "Your class contains [OnTap] attributes, but you passed a null object for `context' in the constructor");
                            }

                            var method = callbacks.GetType().GetMethod(mname);
                            if (method == null)
                                throw new Exception("Did not find method " + mname);
                            invoke = delegate { method.Invoke(method.IsStatic ? null : callbacks, new object[0]); };
                        }
                    }

                    var value = (string)GetValue(mi, o);
                    if (pa != null)
                        element = new EntryElement(caption, pa.Placeholder, value, true);
                    else if (ea != null)
                        element = new EntryElement(caption, ea.Placeholder, value) { KeyboardType = ea.KeyboardType };
                    else if (multi)
                        element = new MultilineElement(caption, value);
                    else if (html != null)
                        element = new HtmlElement(caption, value);
                    else
                    {
                        var selement = new StringElement(caption, value);
                        element = selement;

                        if (align != null)
                            selement.Alignment = align.Alignment;
                    }

                    if (invoke != null)
                        (element).Tapped += invoke;
                }
                else if (mType == typeof(float))
                {
                    var floatElement = new FloatElement(null, null, (float)GetValue(mi, o)) { Caption = caption };
                    element = floatElement;

                    foreach (object attr in attrs)
                    {
                        if (attr is RangeAttribute)
                        {
                            var ra = attr as RangeAttribute;
                            floatElement.MinValue = ra.Low;
                            floatElement.MaxValue = ra.High;
                            floatElement.ShowCaption = ra.ShowCaption;
                        }
                    }
                }
                else if (mType == typeof(bool))
                {
                    bool checkbox = false;
                    foreach (object attr in attrs)
                    {
                        if (attr is CheckboxAttribute)
                            checkbox = true;
                    }

                    if (checkbox)
                        element = new CheckboxElement(caption, (bool)GetValue(mi, o));
                    else
                        element = new BooleanElement(caption, (bool)GetValue(mi, o));
                }
                else if (mType == typeof(DateTime))
                {
                    var dateTime = (DateTime)GetValue(mi, o);
                    bool asDate = false, asTime = false;

                    foreach (object attr in attrs)
                    {
                        if (attr is DateAttribute)
                            asDate = true;
                        else if (attr is TimeAttribute)
                            asTime = true;
                    }

                    if (asDate)
                        element = new DateElement(caption, dateTime);
                    else if (asTime)
                        element = new TimeElement(caption, dateTime);
                    else
                        element = new DateTimeElement(caption, dateTime);
                }
                else if (mType.IsEnum)
                {
                    var csection = new Section();
                    ulong evalue = Convert.ToUInt64(GetValue(mi, o), null);
                    int idx = 0;
                    int selected = 0;

                    foreach (var fi in mType.GetFields(BindingFlags.Public | BindingFlags.Static))
                    {
                        ulong v = Convert.ToUInt64(GetValue(fi, null));

                        if (v == evalue)
                            selected = idx;

                        var ca = Attribute.GetCustomAttribute(fi, typeof(CaptionAttribute)) as CaptionAttribute;
                        csection.Add(new RadioElement(ca != null ? ca.Caption : MakeCaption(fi.Name)));
                        idx++;
                    }

                    element = new RootElement(caption, new RadioGroup(null, selected)) { csection };
                }
                else if (mType == typeof(UIImage))
                {
                    element = new ImageElement((UIImage)GetValue(mi, o));
                }
                else if (typeof(System.Collections.IEnumerable).IsAssignableFrom(mType))
                {
                    var csection = new Section();
                    int count = 0;

                    if (last_radio_index == null)
                        throw new Exception("IEnumerable found, but no previous int found");
                    foreach (var e in (IEnumerable)GetValue(mi, o))
                    {
                        csection.Add(new RadioElement(e.ToString()));
                        count++;
                    }
                    var selected = (int)GetValue(last_radio_index, o);
                    if (selected >= count || selected < 0)
                        selected = 0;
                    element = new RootElement(caption, new MemberRadioGroup(null, selected, last_radio_index))
                        {
                            csection
                        };
                    last_radio_index = null;
                }
                else if (typeof(int) == mType)
                {
                    if (attrs.OfType<RadioSelectionAttribute>().Any())
                    {
                        last_radio_index = mi;
                    }
                }
                else
                {
                    var nested = GetValue(mi, o);
                    if (nested != null)
                    {
                        var newRoot = new RootElement(caption);
                        Populate(callbacks, nested, newRoot);
                        element = newRoot;
                    }
                }

                if (element == null)
                    continue;
                section.Add(element);
                mappings[element] = new MemberAndInstance(mi, o);
            }
            root.Add(section);
        }
 public Pattern CreatePattern(ImageElement image, string repetition) { return null; }
 public abstract void TexImage2Di(uint target, int level, uint internalformat, uint format, uint type, ImageElement image);
Пример #49
0
 private void GSCustomConvert(InfoElement info, List<ImageElement> images, List<IFillElement> ls)
 {
     GSCustom custom = null;
     ImageElement image = null;
     foreach (IFillElement element in ls)
     {
         custom = element as GSCustom;
         if (custom != null)
         {
             if (custom.ItemNo == 43)
             {
                 //结论
                 info.Comment = custom.ReportComment;
             }
             else if (custom.ItemNo == 44)
             {
                 //描述
                 info.Description = custom.ReportDescribe;
             }
             else if (custom.IsFile == 1)
             {
                 if (custom.Graph != null)
                 {
                     image = new ImageElement();
                     image.ReportID = custom.ReportID;
                     image.Name = custom.ItemNo.ToString();
                     image.Value = custom.Graph;
                     images.Add(image);
                 }
             }
         }
     }
 }
Пример #50
0
		void updateTopPhotoUI()
		{
			if (elementsInitialised)
			{
				if (hasTopPhoto)
				{
					if (topPhotoHolder == null)
					{
						topPhotoHolder = Document.CreateElement("div");
						topPhotoHolder.Style.Position = "relative";
						topPhotoHolder.Style.Width = "280px";
						topPhotoHolder.Style.Height = "120px";
						MesssagesElementHolder.InsertBefore(topPhotoHolder, MesssagesElementHolder.ChildNodes[0]);

						topPhotoAnchor = (AnchorElement)Document.CreateElement("a");
						topPhotoAnchor.Style.Position = "absolute";
						topPhotoAnchor.Style.Top = "9px";
						topPhotoAnchor.Style.Left = "96px";
						
						topPhotoImage = (ImageElement)Document.CreateElement("img");
						topPhotoImage.ClassName = "BorderBlack All";
						topPhotoImage.Style.Width = "100px";
						topPhotoImage.Style.Height = "100px";

						topPhotoAnchor.AppendChild(topPhotoImage);
						topPhotoHolder.AppendChild(topPhotoAnchor);

						DOMElement txtSpan = Document.CreateElement("span");
						txtSpan.Style.TextAlign = "right";
						txtSpan.InnerHTML = "<small><a href=\"/pages/frontpagephotos\">Get&nbsp;yours<br />here!</a></small>";
						txtSpan.Style.Position = "absolute";
						txtSpan.Style.Top = "7px";
						txtSpan.Style.Left = "225px";
						txtSpan.ClassName = "CleanLinks";
						topPhotoHolder.AppendChild(txtSpan);

						DOMElement txtSpan1 = Document.CreateElement("span");
						txtSpan1.Style.TextAlign = "left";
						txtSpan1.InnerHTML = "<small>Chat&nbsp;about<br />this:</small>";
						txtSpan1.Style.Position = "absolute";
						txtSpan1.Style.Top = "7px";
						txtSpan1.Style.Left = "5px";
						topPhotoHolder.AppendChild(txtSpan1);
					}

					topPhotoImage.Src = Misc.GetPicUrlFromGuid(topPhoto.PhotoIcon);
					//topPhotoImage.Src = Misc.GetPicUrlFromGuid(topPhoto.PhotoThumb);
					//topPhotoImage.Style.Width = topPhoto.PhotoThumbWidth.ToString() + "px";
					//topPhotoImage.Style.Height = topPhoto.PhotoThumbHeight.ToString() + "px";

					DomEvent.ClearHandlers(topPhotoImage);
					DomEvent.AddHandler(topPhotoImage, "mouseover", delegate { Script.Eval("stm('<img src=" + Misc.GetPicUrlFromGuid(topPhoto.PhotoWeb) + " width=" + topPhoto.PhotoWebWidth.ToString() + " height=" + topPhoto.PhotoWebHeight.ToString() + " class=Block />');"); });
					DomEvent.AddHandler(topPhotoImage, "mouseout", delegate { Script.Literal("htm();"); });

					topPhotoAnchor.Href = topPhoto.PhotoUrl;



				}

			}
		}
Пример #51
0
        protected override void OnMouseMove(MouseEventArgs eventargs)
        {
            base.OnMouseMove(eventargs);

            if (elementin == null)
            {
                foreach (ImageElement i in elements)
                {
                    if (i.pos.Contains(eventargs.Location))
                    {
                        elementin = i;

                        //System.Diagnostics.Debug.WriteLine("Enter element " + elements.FindIndex(x=>x==i));

                        if (EnterElement != null)
                            EnterElement(this, eventargs, elementin, elementin.tag );
                    }
                }
            }
            else
            {
                if (!elementin.pos.Contains(eventargs.Location))
                {
                    //System.Diagnostics.Debug.WriteLine("Leave element ");

                    if (LeaveElement != null)
                        LeaveElement(this, eventargs, elementin, elementin.tag);

                    elementin = null;
                }
            }

            if (Math.Abs(eventargs.X - hoverpos.X) + Math.Abs(eventargs.Y - hoverpos.Y) > 8 || elementin == null)
            {
                ClearHoverTip();
            }

            if ( elementin != null && !hovertimer.Enabled && hovertip == null)
            {
                hoverpos = eventargs.Location;
                hovertimer.Start();
            }
        }
Пример #52
0
		public static RootElement TestElements()
		{
			RootElement re1 = new RootElement("re1");
			Debug.WriteLine(re1.ToString());
			Section s1 = new Section();
			Debug.WriteLine(s1.ToString());
			//Section s2 = new Section(new Android.Views.View(a1));
			//Debug.WriteLine(s2.ToString());
			Section s3 = new Section("s3");
			Debug.WriteLine(s3.ToString());
			//Section s4 = new Section
			//					(
			//					  new Android.Views.View(a1)
			//					, new Android.Views.View(a1)
			//					);
			//Debug.WriteLine(s4.ToString());
			Section s5 = new Section("caption", "footer");
			Debug.WriteLine(s5.ToString());

			StringElement se1 = new StringElement("se1");
			Debug.WriteLine(se1.ToString());
			StringElement se2 = new StringElement("se2", delegate() { });
			Debug.WriteLine(se2.ToString());
			//StringElement se3 = new StringElement("se3", 4);
			StringElement se4 = new StringElement("se4", "v4");
			Debug.WriteLine(se4.ToString());
			//StringElement se5 = new StringElement("se5", "v5", delegate() { });
			
			// removed - protected (all with LayoutID)
			// StringElement se6 = new StringElement("se6", "v6", 4);
			// Debug.WriteLine(se6.ToString());

			// not cross platform! 
			// TODO: make it!?!?!?
			// AchievementElement
			
			BooleanElement be1 = new BooleanElement("be1", true);
			Debug.WriteLine(be1.ToString());
			BooleanElement be2 = new BooleanElement("be2", false, "key");
			Debug.WriteLine(be2.ToString());
			
			// Abstract
			// BoolElement be3 = new BoolElement("be3", true);

			CheckboxElement cb1 = new CheckboxElement("cb1");
			Debug.WriteLine(cb1.ToString());
			CheckboxElement cb2 = new CheckboxElement("cb2", true);
			Debug.WriteLine(cb2.ToString());
			CheckboxElement cb3 = new CheckboxElement("cb3", false, "group1");
			Debug.WriteLine(cb3.ToString());
			CheckboxElement cb4 = new CheckboxElement("cb4", false, "subcaption", "group2");
			Debug.WriteLine(cb4.ToString());

			DateElement de1 = new DateElement("dt1", DateTime.Now);
			Debug.WriteLine(de1.ToString());

			// TODO: see issues 
			// https://github.com/kevinmcmahon/MonoDroid.Dialog/issues?page=1&state=open
			EntryElement ee1 = new EntryElement("ee1", "ee1");
			Debug.WriteLine(ee1.ToString());
			EntryElement ee2 = new EntryElement("ee2", "ee2 placeholder", "ee2 value");
			Debug.WriteLine(ee2.ToString());
			EntryElement ee3 = new EntryElement("ee3", "ee3 placeholder", "ee3 value", true);
			Debug.WriteLine(ee3.ToString());

			FloatElement fe1 = new FloatElement("fe1");
			Debug.WriteLine(fe1.ToString());
			FloatElement fe2 = new FloatElement(-0.1f, 0.1f, 3.2f);
			Debug.WriteLine(fe2.ToString());
			FloatElement fe3 = new FloatElement
									(
									  null
									, null // no ctors new Android.Graphics.Bitmap()
									, 1.0f
									);
			Debug.WriteLine(fe3.ToString());

			HtmlElement he1 = new HtmlElement("he1", "http://holisiticware.net");
			Debug.WriteLine(he1.ToString());

			
			// TODO: image as filename - cross-platform
			ImageElement ie1 = new ImageElement(null);
			Debug.WriteLine(ie1.ToString());

			// TODO: not in Kevin's MA.D
			// ImageStringElement

			MultilineElement me1 = new MultilineElement("me1");
			Debug.WriteLine(me1.ToString());
			MultilineElement me2 = new MultilineElement("me2", delegate() { });
			Debug.WriteLine(me2.ToString());
			MultilineElement me3 = new MultilineElement("me3", "me3 value");
			Debug.WriteLine(me3.ToString());

			RadioElement rde1 = new RadioElement("rde1");
			Debug.WriteLine(rde1.ToString());
			RadioElement rde2 = new RadioElement("rde1", "group3");
			Debug.WriteLine(rde2.ToString());

			// TODO: not in Kevin's MA.D
			// StyledMultilineElement

			TimeElement te1 = new TimeElement("TimeElement", DateTime.Now);
			Debug.WriteLine(te1.ToString());



			re1.Add(s1);
			//re1.Add(s2);
			re1.Add(s3);
			//re1.Add(s4);
			re1.Add(s5);

			return re1;
		}
Пример #53
0
        private void RenderImage()
        {
            Size imageSize = new System.Drawing.Size((int)(pictureBox.Width * numericUpDown1.Value), (int)(pictureBox.Height * numericUpDown1.Value));
            progressBar1.Maximum = imageSize.Width * imageSize.Height * (int)numericUpDown2.Value;

            ImageElement[,] pixels = new ImageElement[imageSize.Width, imageSize.Height];

            double _yMax = 1, _yMin = -_yMax;
            double _xMax = (double)imageSize.Height / imageSize.Width, _xMin = -_xMax;

            double newX = _random.NextDouble() * (_xMax - _xMin) + _xMin;
            double newY = _random.NextDouble() * (_yMax - _yMin) + _yMin;

            for (step = -20; step < (imageSize.Width * imageSize.Height * (int)numericUpDown2.Value); step++)
            {
                //Выбираем одно из аффинных преобразований
                int i = _random.Next(Convert.ToInt32(textBox1.Text));
                //и применяем его
                newX = _affine.GetCoeffecients(i).A * newX + _affine.GetCoeffecients(i).B * newY + _affine.GetCoeffecients(i).C;
                newY = _affine.GetCoeffecients(i).D * newX + _affine.GetCoeffecients(i).E * newY + _affine.GetCoeffecients(i).F;
                //Применяем нелинейное преобразование
                Vector p = Function.GetResult((String)comboBox1.SelectedItem, newX, newY);
                newX = p.X;
                newY = p.Y;

                if (step >= 0 && _xMin <= newX && newX <= _xMax && _yMin <= newY && newY <= _yMax)
                {
                    //Вычисляем координаты точки, а затем задаем цвет
                    int x1 = (int)(imageSize.Width * (1 - ((_xMax - newX) / (_xMax - _xMin))));
                    int y1 = (int)(imageSize.Height * (1 - ((_yMax - newY) / (_yMax - _yMin))));
                    //Если точка попала в область изображения
                    if (x1 < imageSize.Width && y1 < imageSize.Height)
                    {
                        //то проверяем, первый ли раз попали в нее
                        if (pixels[x1, y1].Counter == 0)
                        {
                            //Попали в первый раз, берем стартовый цвет у соответствующего аффинного преобразования
                            pixels[x1, y1].R = _affine.GetCoeffecients(i).Color.R;
                            pixels[x1, y1].G = _affine.GetCoeffecients(i).Color.G;
                            pixels[x1, y1].B = _affine.GetCoeffecients(i).Color.B;
                        }
                        else
                        {
                            //Попали не в первый раз, считаем так:
                            pixels[x1, y1].R = (pixels[x1, y1].R + _affine.GetCoeffecients(i).Color.R) / 2;
                            pixels[x1, y1].G = (pixels[x1, y1].G + _affine.GetCoeffecients(i).Color.G) / 2;
                            pixels[x1, y1].B = (pixels[x1, y1].B + _affine.GetCoeffecients(i).Color.B) / 2;
                        }
                        //Увеличиваем счетчик точки на единицу
                        pixels[x1, y1].Counter++;
                    }

                    //progressBar1.Value = step;
                }
            }

            //КОРРЕКЦИЯ
            double max = 0.0;
            double gamma = 2.2;
            for (int y = 0; y < imageSize.Height; y++)
            {
                for (int x = 0; x < imageSize.Width; x++)
                {
                    if (pixels[x, y].Counter != 0)
                    {
                        pixels[x, y].Normal = Math.Log10(pixels[x, y].Counter);
                        if (pixels[x, y].Normal > max)
                            max = pixels[x, y].Normal;
                    }
                }
            }
            for (int y = 0; y < imageSize.Height; y++)
            {
                for (int x = 0; x < imageSize.Width; x++)
                {
                    pixels[x, y].Normal /= max;
                    pixels[x, y].R = (int)(pixels[x, y].R * Math.Pow(pixels[x, y].Normal, (1.0 / gamma)));
                    pixels[x, y].G = (int)(pixels[x, y].G * Math.Pow(pixels[x, y].Normal, (1.0 / gamma)));
                    pixels[x, y].B = (int)(pixels[x, y].B * Math.Pow(pixels[x, y].Normal, (1.0 / gamma)));
                }
            }
            //

            Bitmap bmp = new Bitmap(imageSize.Width, imageSize.Height);
            for (int y = 0; y < imageSize.Height; y++)
            {
                for (int x = 0; x < imageSize.Width; x++)
                {
                    int r = (int)pixels[x, y].R;
                    int g = (int)pixels[x, y].G;
                    int b = (int)pixels[x, y].B;

                    bmp.SetPixel(x, y, Color.FromArgb(r, g, b));
                }
            }
            pictureBox.Image = bmp;
        }
 public void DrawImage(ImageElement image, float dx, float dy) { }
Пример #55
0
 public void TexSubImage2D(uint target, int level, int xoffset, int yoffset, uint format, uint type, ImageElement image)
 {
 }
 public void DrawImage(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh) { }
Пример #57
0
		void updateChatPicUI()
		{
			if (elementsInitialised)
			{
				if (hasTopPhoto)
				{
					if (chatPicHolder != null)
					{
						chatPicHolder.Style.Display = "none";
					}
					return;
				}
				if (hasChatPic)
				{
					if (chatPicHolder == null)
					{
						chatPicHolder = Document.CreateElement("div");
					//	chatPicHolder.ClassName = "ChatClientChatPicHolder";
					//	chatPicHolder.Style.Position = "relative";
					//	chatPicHolder.Style.Width = "300px";
					//	if (Misc.BrowserIsIE)
					//		chatPicHolder.Style.Height = "102px";
					//	else
					//		chatPicHolder.Style.Height = "101px";
					//	chatPicHolder.Style.BorderBottom = "1px solid #cba21e";
						MesssagesElementHolder.InsertBefore(chatPicHolder, MesssagesElementHolder.ChildNodes[0]);

						chatPicAnchor = (AnchorElement)Document.CreateElement("a");

						chatPicImage = (ImageElement)Document.CreateElement("img");
						chatPicImage.ClassName = "ChatClientChatPicImage";
					//	chatPicImage.Style.Position = "absolute";
					//	chatPicImage.Style.Top = "1px";
					//	chatPicImage.Style.Left = "0px";
					//	chatPicImage.Style.Width = "300px";
					//	chatPicImage.Style.Height = "100px";
						//chatPicImage.Style.BorderWidth = "0px";
						//chatPicImage.Style.BorderBottom = "1px solid #cba21e";

						chatPicAnchor.AppendChild(chatPicImage);
						chatPicHolder.AppendChild(chatPicAnchor);
					}

					chatPicImage.Src = Misc.GetPicUrlFromGuid(chatPic);

					DomEvent.ClearHandlers(chatPicImage);
					DomEvent.AddHandler(chatPicImage, "mouseover", delegate { Script.Eval("stmun(" + chatPicStmuParams + ");"); });
					DomEvent.AddHandler(chatPicImage, "mouseout", delegate { Script.Literal("htm();"); });

					chatPicAnchor.Href = chatPicUrl;
				}
				else
				{
					if (chatPicHolder != null)
						chatPicHolder.Style.Display = "none";
				}
			}
		}
Пример #58
0
 public void Add(ImageElement i)
 {
     elements.Add(i);
 }
Пример #59
0
    private void AddHeader(PdfConverter pdfConverter, string headerText, string clientLogoFilename)
    {
        //enable header
        pdfConverter.PdfDocumentOptions.ShowHeader = true;

        // set the header height in points
        pdfConverter.PdfHeaderOptions.HeaderHeight = 40;

        var headerTextElement = new TextElement(0, 0, headerText,
                                                new System.Drawing.Font(new System.Drawing.FontFamily("Arial"), 10,
                                                                        System.Drawing.GraphicsUnit.Point));
        headerTextElement.EmbedSysFont = true;
        headerTextElement.TextAlign = HorizontalTextAlign.Center;
        headerTextElement.VerticalTextAlign = VerticalTextAlign.Middle;

        pdfConverter.PdfHeaderOptions.AddElement(headerTextElement);

        // Add logo
        string imgFilepath = HttpContext.Current.Server.MapPath("/Content/Images/BSOHeaderLogo.png");
        ImageElement headerLogoElement = new ImageElement(PdfPageSize.A4.Height - 180, 0, imgFilepath);
        pdfConverter.PdfHeaderOptions.AddElement(headerLogoElement);

        // Add client logo
        if (!String.IsNullOrEmpty(clientLogoFilename))
        {
            string clientLogoFilepath = HttpContext.Current.Server.MapPath("/Content/Images/Client/" + clientLogoFilename);
            ImageElement clientLogoElement = new ImageElement(0, 0, clientLogoFilepath);
            pdfConverter.PdfHeaderOptions.AddElement(clientLogoElement);
        }
    }
 public override void TexImage2Di(uint target, int level, uint internalformat, uint format, uint type, ImageElement image) { /*Log("setting texImage2d; image: " + image.Src);*/ gl.TexImage2D(target, level, internalformat, format, type, image); CheckError("texImage2D"); }