void HandleOverlayImage(MediaFile overlayImage) { if (overlayImage == null) { return; } var stream = overlayImage.GetStream(); bytes = ReadFully(stream); var image = new OverlayImage() { PhotoBytes = bytes }; //manually set opacity FIX ME LATER opacity = 75; var view = Resolver.Resolve <OverlayImageView>(); ((OverlayImageViewModel)view.BindingContext).Initialize(image, opacity); Navigation.PushAsync(view); }
private void OnPictureBoxPaint(object sender, PaintEventArgs e) { Debug.WriteLine("OnPictureBoxPaint: Image=" + ((Image == null) ? "null" : Image.GetType().Name) + " LinesImage=" + ((LinesImage == null) ? "null" : LinesImage.GetType().Name) + " OverlayImage=" + ((OverlayImage == null) ? "null" : OverlayImage.GetType().Name)); if (Image == null) { return; } Graphics g = e.Graphics; g.Clear(pictureBox.BackColor); g.DrawImage(Image, pictureBox.ClientRectangle, ViewRectangle, GraphicsUnit.Pixel); if (LinesImage != null) { g.DrawImage(LinesImage, pictureBox.ClientRectangle, ViewRectangle, GraphicsUnit.Pixel); } // Handle EDIT mode if (ActiveMode == Mode.EDIT && OverlayImage != null) { g.DrawImage(OverlayImage, pictureBox.ClientRectangle, ViewRectangle, GraphicsUnit.Pixel); } }
public async void Splat(AdditionalParameters ap) { if (_splatcount > 20) { return; } //r=1050 //1050=baseradius * intervals int intervals = 9999; int radiusx = 1680 * r.Next(intervals + 1) / intervals + 1, radiusy = 1050 * r.Next(intervals + 1) / intervals + 1; _splatcount++; OverlayImage oi = new OverlayImage("splat.png", 255); // oi.TopMost = true; { //oi.ShowInTaskbar = false; int x = 1680 / 2 + r.Next(radiusx / 2) - r.Next(radiusx / 2) - 168; int y = 1050 / 2 + r.Next(radiusy / 2) - r.Next(radiusy / 2) - 149; oi.Location = new Point(x, y); await Task.Delay(1000 + r.Next(3000)); int speed = 10 + r.Next(40); for (int i = 0; i < r.Next(50) + 150; i++) { oi.Location = new Point(oi.Location.X, oi.Location.Y + 1); await Task.Delay(speed); } } oi.Close(); _splatcount--; }
private async Task _splat(int x, int y, bool isheart) { OverlayImage oi; if (isheart) { oi = new OverlayImage("kiss.png", 255, false); } else { oi = new OverlayImage("splat.png", 255, false); } // oi.TopMost = true; { oi.Location = new Point(x, y); await Task.Delay(1000 + r.Next(3000)); int speed = 10 + r.Next(40); for (int i = 0; i < r.Next(60) + 60; i++) { oi.Location = new Point(oi.Location.X, oi.Location.Y + (isheart ? -1 : 1)); await Task.Delay(speed); } } oi.Close(); }
public void Banner() { _oi = new OverlayImage(); _oi.TopMost = true; _oi.SetBitmap("viribanner.png", 255); _oi.TopLevel = true; }
public static void DisposeOverlayImage() { if (OverlayImage != null) { OverlayImage.Dispose(); OverlayImage = null; } }
/// <summary> /// Draws the content on the specified spriteBatch. /// </summary> /// <param name="spriteBatch">Sprite batch.</param> public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); BackgroundImage.Draw(spriteBatch); OverlayImage.Draw(spriteBatch); LogoImage.Draw(spriteBatch); }
/// <summary> /// Unloads the content. /// </summary> public override void UnloadContent() { base.UnloadContent(); BackgroundImage.UnloadContent(); OverlayImage.UnloadContent(); LogoImage.UnloadContent(); }
public void FilePathOverlayImage_Case() { var image = new OverlayImage(_selectorStorage, new AppSettings()).FilePathOverlayImage("TesT.Jpg", new AppSettingsPublishProfiles()); Assert.AreEqual("test.jpg", image); }
public void OnRemoveImageOverlay() { FocusOnImageOverlay(); if (_imageOverlay != null) { _map.RemoveOverlay(_imageOverlay); _imageOverlay = null; } }
public void FilePathOverlayImage_outputParentFullFilePathFolder() { var image = new OverlayImage(_selectorStorage, new AppSettings()).FilePathOverlayImage( string.Empty, "TesT.Jpg", new AppSettingsPublishProfiles()); Assert.AreEqual(PathHelper.AddBackslash(string.Empty) + "test.jpg", image); }
public async Task ResizeOverlayImageLarge_null_exception() { var overlayImage = new OverlayImage(_selectorStorage, new AppSettings()); await overlayImage.ResizeOverlayImageLarge(null, null, new AppSettingsPublishProfiles()); // > ArgumentNullException }
public void FilePathOverlayImage_Append() { var image = new OverlayImage(_selectorStorage, new AppSettings()).FilePathOverlayImage("Img.Jpg", new AppSettingsPublishProfiles { Append = "_test" }); Assert.AreEqual("img_test.jpg", image); }
/// <summary> /// Redraws the OverlayImage and calls Invalidate on the PictureBox. /// Removes the OverlayImage if not in EDIT mode or if there is no /// HitLine and no HitPoint. /// </summary> public void redrawOverlay() { Debug.WriteLine("redrawOverlay: EDIT:" + " HitLine=" + ((HitLine == null) ? "null" : "\"" + HitLine.Desc + "\"") + " HitPoint=" + ((HitPoint == null) ? "null" : "X=" + HitPoint.Point.X)); if (ActiveMode != Mode.EDIT) { if (OverlayImage != null) { OverlayImage.Dispose(); OverlayImage = null; } pictureBox.Invalidate(); return; } if (HitLine == null && HitPoint == null) { if (OverlayImage != null) { OverlayImage.Dispose(); OverlayImage = null; } pictureBox.Invalidate(); return; } OverlayImage = new Bitmap(Image.Width, Image.Height); float size = HIT_TOLERANCE; float size2 = HIT_TOLERANCE * 1.5f; using (var brush = new SolidBrush(SELECT_COLOR)) using (var littlePen = new Pen(SELECT_COLOR, LINE_WIDTH)) using (var littlePenBlack = new Pen(Color.Black, 2)) using (Graphics g = Graphics.FromImage(OverlayImage)) { g.Clear(Color.Transparent); if (HitLine != null) { // Draw new color over the lines Point[] points = HitLine.Points.ToArray(); g.DrawLines(littlePen, points); foreach (Point point in HitLine.Points) { RectangleF rect = centeredSquare(point, size); g.FillEllipse(brush, rect); } } if (HitPoint != null) { RectangleF rect = centeredSquare(HitPoint.Point, size2); g.DrawEllipse(littlePenBlack, rect); } } pictureBox.Invalidate(); }
/// <summary> /// Updates the content. /// </summary> /// <param name="gameTime">Game time.</param> public override void Update(GameTime gameTime) { base.Update(gameTime); BackgroundImage.Update(gameTime); OverlayImage.Update(gameTime); LogoImage.Update(gameTime); Delay -= (float)gameTime.ElapsedGameTime.TotalSeconds; AlignItems(); }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { base.LoadContent(); BackgroundImage.LoadContent(); OverlayImage.LoadContent(); LogoImage.LoadContent(); AlignItems(); BackgroundImage.ActivateEffect("RotationEffect"); BackgroundImage.ActivateEffect("ZoomEffect"); }
public void Splat(string origin) { //crazyfan123 might call !splat. In that case, it calls splat(virifan123) if (peoplewhosplat.Contains(origin)) { return; } peoplewhosplat.Add(origin); _oi = new OverlayImage(); _oi.TopMost = true; _oi.SetBitmap("splat.png", 255); _oi.TopLevel = true; //todo: randomize splat image, splat goes downwards leavling trail of splat, splat disappears over time, apply disposals }
public async Task ResizeOverlayImageLarge_overlay_image_missing() { var overlayImage = new OverlayImage(_selectorStorage, new AppSettings { ThumbnailTempFolder = "/" }); await overlayImage.ResizeOverlayImageLarge("/test.jpg", "/out.jpg", new AppSettingsPublishProfiles { SourceMaxWidth = 100, OverlayMaxWidth = 1 }); // > overlay image missing }
public async Task ResizeOverlayImageThumbnails_itemFileHash_Not_Found() { var overlayImage = new OverlayImage(_selectorStorage, new AppSettings { ThumbnailTempFolder = "/" }); await overlayImage.ResizeOverlayImageThumbnails("non-exist.jpg", "/out.jpg", new AppSettingsPublishProfiles { SourceMaxWidth = 100, OverlayMaxWidth = 1 }); // itemFileHash not found }
public void AddActiveArea(Rectangle area, Bitmap infoImage) { OverlayImage info = new OverlayImage(infoImage, .2f, .2f, mWhereWindow); CameraPositionTrigger trigger = new CameraPositionTrigger(Manager.Coordinator); mActiveAreas.Add(trigger); trigger.Triggered += () => { mInfoImages.Add(info); mWhereButton.Active = true; }; trigger.Left += () => { mInfoImages.Remove(info); mWhereButton.Active = mInfoImages.Count > 0; }; }
public async Task ResizeOverlayImageThumbnails_Done() { var overlayImage = new OverlayImage(_selectorStorage, new AppSettings { ThumbnailTempFolder = "/" }); await overlayImage.ResizeOverlayImageThumbnails("/test.jpg", "/out_thumb.jpg", new AppSettingsPublishProfiles { SourceMaxWidth = 100, OverlayMaxWidth = 1, Path = "/test.jpg" }); Assert.IsTrue(_storage.ExistFile("/out_thumb.jpg")); }
public void ResizeOverlayImageThumbnails_Ignore_If_Exist() { var overlayImage = new OverlayImage(_selectorStorage, new AppSettings { ThumbnailTempFolder = "/" }); overlayImage.ResizeOverlayImageThumbnails("/test.jpg", "/test.jpg", new AppSettingsPublishProfiles { SourceMaxWidth = 100, OverlayMaxWidth = 1, Path = "/test.jpg" }); // Should return nothing Assert.IsTrue(_storage.ExistFile("/test.jpg")); }
/// <summary> /// Scales the <see cref="Overlay"/> or <see cref="EditorOverlay"/> image to the current /// <see cref="Graphics.MapView.Scale"/>.</summary> /// <param name="editing"> /// <c>true</c> to scale the <see cref="EditorOverlay"/> image; <c>false</c> to scale the /// <see cref="Overlay"/> image.</param> /// <remarks> /// <b>ScaleOverlay</b> sets the bounds of the indicated <see cref="Image"/> to the <see /// cref="OverlayImage.Bounds"/> of its associated <see cref="OverlayImage"/>, adjusted by /// the <see cref="Graphics.MapView.Scale"/> of the associated <see cref="MapView"/>. /// </remarks> public void ScaleOverlay(bool editing) { Image image = (editing ? EditorOverlay : Overlay); OverlayImage overlay = image.Tag as OverlayImage; if (overlay == null) { return; } RectI bounds = overlay.Bounds; double scale = MapView.Scale / 100.0; Canvas.SetLeft(image, bounds.X * scale + MapView.MapBorder.X); Canvas.SetTop(image, bounds.Y * scale + MapView.MapBorder.Y); image.Width = bounds.Width * scale; image.Height = bounds.Height * scale; }
public int GetImageIndex(string extension, OverlayImage overlay) { if (extension == null) throw new ArgumentNullException("extension"); extension = extension.ToLowerInvariant(); int imageIndex; if (!_imageCache.TryGetValue(extension, out imageIndex)) { imageIndex = _imageList.GetIndexForFileName("dummy" + extension); _imageCache.Add(extension, imageIndex); } int overlayIndex; if (_overlays.TryGetValue(overlay, out overlayIndex)) return _imageList.GetIndexForOverlay(imageIndex, overlayIndex); return imageIndex; }
private void HandlePhoto(MediaFile photo) { if (photo == null) { return; } var stream = photo.GetStream(); _bytes = ReadFully(stream); var imageToView = new OverlayImage() { PhotoBytes = _bytes }; //do somthing ... like show the image var view = new ResultView(imageToView); ((OverlayImageViewModel)view.BindingContext).Initialize(imageToView); Navigation.PushAsync(view); }
public ImageClickTrigger(FrameOverlayManager manager, OverlayImage image) : base(manager, image.Bounds) { mImage = image; }
public ImageHoverTrigger(OverlayPlugin manager, XmlNode node, Rectangle clip) : base(manager, node) { mImage = new OverlayImage(manager, node, clip, "image trigger"); Bounds = mImage.Bounds; }
public ImageHoverTrigger(FrameOverlayManager manager, ISelectionRenderer render, OverlayImage image) : base(manager, render, image.Bounds) { mImage = image; }
public ResultView(OverlayImage newImage) { InitializeComponent(); BindingContext = newImage; }
public ITrigger Create(OverlayPlugin manager, XmlNode node, Rectangle clip) { OverlayImage img = new OverlayImage(manager, node, clip, "image trigger"); return(new ImageClickTrigger(manager[img.Frame], img)); }
public async Task SetImage(OverlayImage image) { await this.SendPacket(new OverlayPacket("image", JObject.FromObject(image))); }