protected void OnBtnGenerateClicked(object sender, EventArgs e) { try { BarcodeLib.Barcode codeBar = new BarcodeLib.Barcode (); codeBar.Alignment = BarcodeLib.AlignmentPositions.CENTER; codeBar.IncludeLabel = true; codeBar.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER; BarcodeLib.TYPE bCodeType = (BarcodeLib.TYPE)Enum.Parse (typeof(BarcodeLib.TYPE), cmbBarCodeType.ActiveText.ToString ()); System.Drawing.Image imgTmpCodeBar = codeBar.Encode (bCodeType, txtData.Text.Trim (), System.Drawing.Color.Black, System.Drawing.Color.White, 300, 300); MemoryStream memoryStream = new MemoryStream(); imgTmpCodeBar.Save(memoryStream, ImageFormat.Png); Gdk.Pixbuf pb = new Gdk.Pixbuf (memoryStream.ToArray()); imgCodeBar.Pixbuf = pb; } catch (Exception err) { MessageDialog dlg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, string.Format ("Ocurrió un error \n {0}", err.Message)); dlg.Run (); dlg.Destroy (); dlg.Dispose (); dlg = null; } }
public Item(Gdk.Pixbuf icon, string text, string tooltip, object tag) { this.icon = icon; this.text = text; this.tooltip = tooltip; this.tag = tag; }
public TreeStore GetFiles(string startPath) { string[] aFilesPath = this._parent.oXbmc.Media.GetDirectoryContentPaths(startPath, "[" + this._parent.oShareBrowser.GetCurrentShareType() + "]"); string[] aFiles = this._parent.oXbmc.Media.GetDirectoryNames(aFilesPath); if (aFilesPath != null) { for (int y = 0; y < aFilesPath.Length; y++) { if (aFilesPath[y] != null && aFilesPath[y] != "") { string[] aFilesPathParts = aFilesPath[y].Split(':'); string mediaType = (aFilesPathParts[0] == "lastfm")? "lastfm" : "file" ; if (this._parent.oShareBrowser.GetCurrentShareType() == "video") mediaIcon = this._parent.oImages.menu.file_video; else if (this._parent.oShareBrowser.GetCurrentShareType() == "music") mediaIcon = this._parent.oImages.menu.file_music; else if (this._parent.oShareBrowser.GetCurrentShareType() == "pictures") mediaIcon = this._parent.oImages.menu.file_picture; else mediaIcon = this._parent.oImages.menu.file; this.tsFiles.AppendValues((y+1).ToString()+ ".", mediaIcon, aFiles[y], aFilesPath[y], mediaType); } } if ((aFilesPath[0] != null && aFilesPath[0] != "") || aFilesPath.Length > 1) this._parent.nbRight.CurrentPage = 1; } return tsFiles; }
protected override void Draw(Context cr, Pixbuf prev, Pixbuf next, int width, int height, double progress) { cr.Color = new Color (0, 0, 0, progress); if (next != null) { double scale = Math.Min ((double)width/(double)next.Width, (double)height/(double)next.Height); cr.Save (); cr.Rectangle (0, 0, width, .5 * (height - scale*next.Height)); cr.Fill (); cr.Rectangle (0, height - .5 * (height - scale*next.Height), width, .5 * (height - scale*next.Height)); cr.Fill (); cr.Rectangle (0, 0, .5 * (width - scale*next.Width), height); cr.Fill (); cr.Rectangle (width - .5 * (width - scale*next.Width), 0, .5 * (width - scale*next.Width), height); cr.Fill (); cr.Rectangle (0, 0, width, height); cr.Scale (scale, scale); CairoHelper.SetSourcePixbuf (cr, next, .5 * ((double)width/scale - next.Width), .5 * ((double)height/scale - next.Height)); cr.PaintWithAlpha (progress); cr.Restore (); } }
public SharpApp() : base("Fixed") { SetDefaultSize(300,280); SetPosition(WindowPosition.Center); ModifyBg(StateType.Normal, new Gdk.Color(10,40,40)); DeleteEvent += delegate {Application.Quit();}; try{ bardejov = new Gdk.Pixbuf("bardejov.jpg"); rotunda = new Gdk.Pixbuf("rotunda.jpg"); mincol = new Gdk.Pixbuf("mincol.jpg"); } catch { Console.WriteLine("Images not found"); Environment.Exit(1); } Image image1 = new Image(bardejov); Image image2 = new Image(rotunda); Image image3 = new Image(mincol); VBox fix = new VBox(true,4); fix.PackStart(image1); fix.Pack(image2); fix.PackEnd(image3); Add(fix); ShowAll(); }
static EditorStock() { // Load Window icon. WindowIcon = Gdk.Pixbuf.LoadFromResource ("supertux-editor.png"); AddIcon (Eye, Gtk.IconSize.Menu, "stock-eye-12.png"); AddIcon (EyeHalf, Gtk.IconSize.Menu, "stock-eye-half-12.png"); // HACK: This is needed to make tool icons show up on Windows, no idea why. // TODO: test if this is still needed with additional SizeWildcarded. // SizeWildcarded only gives fuzzy images, at least for stock-eye-12.png // It looks like windows are confusing large and small toolbar size ("SmallToolbar" causes 2x bigger buttons that "LargeToolbar"), bug in GTK for windows? bug in windows themselves? #if WINDOWS Gtk.IconSize ToolBarIconSize = Gtk.IconSize.SmallToolbar; #else Gtk.IconSize ToolBarIconSize = Gtk.IconSize.LargeToolbar; #endif AddIcon(ToolSelect, ToolBarIconSize, "stock-tool-select-24.png"); AddIcon(ToolTiles, ToolBarIconSize, "stock-tool-tiles-24.png"); AddIcon(ToolObjects, ToolBarIconSize, "stock-tool-objects-24.png"); AddIcon(ToolBrush, ToolBarIconSize, "stock-tool-brush-24.png"); AddIcon(ToolFill, ToolBarIconSize, "stock-tool-fill-24.png"); AddIcon(ToolReplace, ToolBarIconSize, "stock-tool-replace-24.png"); AddIcon(ToolPath, ToolBarIconSize, "stock-tool-path-24.png"); AddIcon(Camera, ToolBarIconSize, "stock-camera-24.png"); stock.AddDefault(); }
private AboutUI() { Glade.XML gxml = new Glade.XML (null, "organizer.glade", "window4", null); gxml.Autoconnect (this); Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(DeskFlickrUI.ICON_PATH); logoimage.Pixbuf = pixbuf; dfolabel.Markup = "<span font_desc='Sans Bold 16'>Desktop Flickr Organizer v0.8</span>"; notebook2.SetTabLabelText(notebook2.CurrentPageWidget, "About"); notebook2.NextPage(); notebook2.SetTabLabelText(notebook2.CurrentPageWidget, "Attribution"); notebook2.NextPage(); notebook2.SetTabLabelText(notebook2.CurrentPageWidget, "License"); notebook2.Page = 0; closebutton.Label = "Close"; closebutton.Clicked += new EventHandler(OnCloseButtonClicked); SetAboutInfo(); SetAttributionInfo(); window4.SetIconFromFile(DeskFlickrUI.ICON_PATH); window4.ShowAll(); }
static MainWindow () { Assembly ta = typeof (MainWindow).Assembly; classPixbuf = new Gdk.Pixbuf (ta, "c.gif"); delegatePixbuf = new Gdk.Pixbuf (ta, "d.gif"); enumPixbuf = new Gdk.Pixbuf (ta, "en.gif"); eventPixbuf = new Gdk.Pixbuf (ta, "e.gif"); fieldPixbuf = new Gdk.Pixbuf (ta, "f.gif"); interfacePixbuf = new Gdk.Pixbuf (ta, "i.gif"); methodPixbuf = new Gdk.Pixbuf (ta, "m.gif"); namespacePixbuf = new Gdk.Pixbuf (ta, "n.gif"); propertyPixbuf = new Gdk.Pixbuf (ta, "p.gif"); attributePixbuf = new Gdk.Pixbuf (ta, "r.gif"); structPixbuf = new Gdk.Pixbuf (ta, "s.gif"); assemblyPixbuf = new Gdk.Pixbuf (ta, "y.gif"); okPixbuf = new Gdk.Pixbuf (ta, "sc.gif"); errorPixbuf = new Gdk.Pixbuf (ta, "se.gif"); niexPixbuf = new Gdk.Pixbuf (ta, "mn.png"); missingPixbuf = new Gdk.Pixbuf (ta, "sm.gif"); todoPixbuf = new Gdk.Pixbuf (ta, "st.gif"); extraPixbuf = new Gdk.Pixbuf (ta, "sx.gif"); Gdk.Color.Parse ("#ff0000", ref red); Gdk.Color.Parse ("#00ff00", ref green); Gdk.Color.Parse ("#000000", ref black); }
public iFolderApplication(string[] args) : base("ifolder", "1.0", Modules.UI, args) { Util.InitCatalog(); Util.SetQuitiFolderDelegate(new QuitiFolderDelegate(QuitiFolder)); tIcon = new TrayIcon("iFolder"); bCollectionIsSynchronizing = false; currentIconAnimationDirection = 0; eBox = new EventBox(); eBox.ButtonPressEvent += new ButtonPressEventHandler(trayapp_clicked); RunningPixbuf = new Pixbuf(Util.ImagesPath("ifolder24.png")); StartingPixbuf = new Pixbuf(Util.ImagesPath("ifolder-startup.png")); StoppingPixbuf = new Pixbuf(Util.ImagesPath("ifolder-shutdown.png")); DownloadingPixbuf = new Gdk.PixbufAnimation(Util.ImagesPath("ifolder24.gif")); UploadingPixbuf = new Gdk.PixbufAnimation(Util.ImagesPath("ifolder24-upload.gif")); gAppIcon = new Gtk.Image(RunningPixbuf); eBox.Add(gAppIcon); tIcon.Add(eBox); tIcon.ShowAll(); LoginDialog = null; collectionSynchronizing = null; synchronizationErrors = new Hashtable(); iFolderStateChanged = new Gtk.ThreadNotify( new Gtk.ReadyEvent(OniFolderStateChanged)); simiasManager = Util.CreateSimiasManager(args); }
public AvatarManager() { if (instance != null) { throw new Exception ("One instance please!"); } else { instance = this; } genericAvatar = new Pixbuf(null, "FileFind.Meshwork.GtkClient.avatar-generic-large.png"); smallGenericAvatar = new Pixbuf(null, "FileFind.Meshwork.GtkClient.avatar-generic-medium.png"); miniGenericAvatar = new Pixbuf(null, "FileFind.Meshwork.GtkClient.avatar-generic-small.png"); avatarsPath = Path.Combine (Settings.ConfigurationDirectory, "avatars"); if (Directory.Exists (avatarsPath) == false) { Directory.CreateDirectory (avatarsPath); } foreach (Network network in Core.Networks) { AddNetwork (network); } Core.NetworkAdded += AddNetwork; UpdateMyAvatar (); }
/* GNOME cache -> 00:00:05.6705334 (creating cache) 00:00:00.2680794.(once cached) With no cache -> 00:00:28.8975945 (using Pixbuf) */ static void Main() { string[] files; Provider provider = Factory.Provider; Pixbuf buf; TimeSpan time; int nulls = 0; files = Directory.GetFiles ("/home/jordi/Desktop/berna"); // Directory with images to test Stopwatch stopWatch = new Stopwatch (); stopWatch.Start (); foreach (string file in files) { buf = provider.GetThumbnail (file, 96, 96); if (buf == null) { nulls++; buf = new Pixbuf (file); } buf.Dispose (); } stopWatch.Stop (); time = stopWatch.Elapsed; Console.WriteLine ("Time needed {0}. Total files {1}, thumbnailed {2}, skipped {3}", time, files.Length, files.Length - nulls, nulls); return; }
public static void Analyze(App app) { if (app.Filename == null) return; // Analyze the sprite sheet and show fit options. string filename = app.Filename; app.Output = "(no output)"; app.UI(UI.Output); app.UI(UI.Filename); app.Islands = null; app.Image = null; app.ErrorMessage = null; app.UI(UI.ErrorMessage); try { var buf = new Pixbuf(filename); app.Image = buf; app.Do(Act.AnalyzeHorizontal); app.Do(Act.AnalyzeVertical); app.Do(Act.AnalyzeIslands); } catch (Exception ex) { app.ErrorMessage = ex.Message; app.UI(UI.ErrorMessage); Console.WriteLine(ex.ToString()); } // Update the island editor. app.UI(UI.IslandEditor); app.UI(UI.CompletedTask); }
public sMenu(string path) { clear = new Pixbuf(path + "clear_16.png"); collapse = new Pixbuf(path + "collapse_16.png"); configure = new Pixbuf(path + "configure_16.png"); info = new Pixbuf(path + "info_16.png"); minus = new Pixbuf(path + "remove_16.png"); mute = new Pixbuf(path + "volume_mute_16.png"); next = new Pixbuf(path + "next_16.png"); pause = new Pixbuf(path + "pause_16.png"); play = new Pixbuf(path + "play_16.png"); plus = new Pixbuf(path + "add_16.png"); previous = new Pixbuf(path + "previous_16.png"); refresh = new Pixbuf(path + "refresh_16.png"); repeat = new Pixbuf(path + "repeat_16.png"); stop = new Pixbuf(path + "stop_16.png"); shuffle = new Pixbuf(path + "shuffle_16.png"); partymode = new Pixbuf(path + "partymode_16.png"); volume_down = new Pixbuf(path + "volume_down_16.png"); volume_up = new Pixbuf(path + "volume_up_16.png"); artist = new Pixbuf(path + "mic_16.png"); cd = new Pixbuf(path + "cd_16.png"); connect = new Pixbuf(path + "connect_16.png"); disconnect = new Pixbuf(path + "disconnect_16.png"); file = new Pixbuf(path + "file_files.png"); file_music = new Pixbuf(path + "file_music.png"); file_picture = new Pixbuf(path + "file_pictures.png"); file_video = new Pixbuf(path + "file_video.png"); folder_closed = new Pixbuf(path + "folder_closed.png"); folder_open = new Pixbuf(path + "folder_open.png"); icon = new Pixbuf(path + "icon.png"); pixel = new Pixbuf(path + "pixel.gif"); }
protected override void DoSave(Pixbuf pb, string fileName, string fileType) { int level = PintaCore.Actions.File.RaiseModifyCompression (85); if (level != -1) pb.Savev (fileName, fileType, new string[] { "quality", null }, new string[] { level.ToString(), null }); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { Stream pixbuf_stream = objectProvider.GetData(); BinaryReader reader = new BinaryReader (pixbuf_stream); bool has_alpha; int bits_per_sample, width, height, rowstride; Gdk.Pixbuf pixbuf; has_alpha = reader.ReadBoolean (); bits_per_sample = reader.ReadInt32 (); width = reader.ReadInt32 (); height = reader.ReadInt32 (); rowstride = reader.ReadInt32 (); int size = height * rowstride; byte[] pixbuf_data = new byte [size]; reader.Read (pixbuf_data, 0, size); pixbuf = new Pixbuf (Gdk.Colorspace.Rgb, has_alpha, bits_per_sample, width, height); Marshal.Copy (pixbuf_data, 0, pixbuf.Pixels, size); PixbufWindow win = new PixbufWindow ("Pixbuf Visualizer", pixbuf); win.Show (); }
protected void OnOpenActionActivated(object sender, EventArgs e) { Gtk.FileChooserDialog fc = new FileChooserDialog ( "Choose image to open", this, Gtk.FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); fc.Filter = new FileFilter(); fc.Filter.AddPattern ("*.png"); fc.Filter.AddPattern ("*.jpg"); fc.Filter.AddPattern("*.jpeg"); fc.Filter.AddPattern ("*.gif"); fc.Filter.AddPattern("*.tiff"); if (fc.Run() == (int)ResponseType.Accept) { System.Drawing.Image host = System.Drawing.Image.FromFile (fc.Filename); Bitmap hostImage = new Bitmap (host); MemoryStream pic = new MemoryStream (); hostImage.Save (pic, System.Drawing.Imaging.ImageFormat.Png); pic.Seek (0, SeekOrigin.Begin); Gdk.Pixbuf pb = new Gdk.Pixbuf (pic); originalImage.Pixbuf = pb; } //Don't forget to call Destroy() or the FileChooserDialog window won't get closed. fc.Destroy(); }
public WelcomePageWidget (WelcomePageView parentView) : base () { this.Build (); this.parentView = parentView; linkHoverLeaveEventHandler = new Gtk.LeaveNotifyEventHandler (handleHoverLeave); linkHoverEnterEventHandler = new Gtk.EnterNotifyEventHandler (handleHoverEnter); linkClickedEventHandler = new EventHandler (HandleLink); using (var stream = BrandingService.OpenStream ("WelcomePage_Logo.png")) logoPixbuf = new Gdk.Pixbuf (stream); using (var stream = BrandingService.OpenStream ("WelcomePage_TopBorderRepeat.png")) bgPixbuf = new Gdk.Pixbuf (stream); alignment1.SetPadding (WelcomePageView.LogoHeight + WelcomePageView.Spacing, 0, WelcomePageView.Spacing, 0); Gdk.Color color; if (!Gdk.Color.Parse (WelcomePageView.BackgroundColor, ref color)) color = Style.White; ModifyBg (StateType.Normal, color); BuildFromXml (); LoadRecent (); IdeApp.Workbench.GuiLocked += OnLock; IdeApp.Workbench.GuiUnlocked += OnUnlock; }
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Pixbuf icon, ref Pixbuf closedIcon) { ExtensionNodeInfo ninfo = (ExtensionNodeInfo) dataObject; ExtensionNodeDescription node = ninfo.Node; label = GLib.Markup.EscapeText (node.NodeName); StringBuilder desc = new StringBuilder (); foreach (NodeAttribute at in node.Attributes) { if (desc.Length > 0) desc.Append (" "); desc.Append (at.Name).Append ("=\"").Append (GLib.Markup.EscapeText (at.Value)).Append ('"'); } if (desc.Length > 0) label += "(<i>" + desc + "</i>)"; icon = Context.GetIcon ("md-extension-node"); if (treeBuilder.Options ["ShowExistingNodes"] && !ninfo.CanModify) { Gdk.Pixbuf gicon = Context.GetComposedIcon (icon, "fade"); if (gicon == null) { gicon = ImageService.MakeTransparent (icon, 0.5); Context.CacheComposedIcon (icon, "fade", gicon); } icon = gicon; } }
/// <summary> /// Creates new image item. /// </summary> /// <param name="image">Pixbuf.</param> public Item(Pixbuf image) { this.IsImage = true; this.Image = image; this.Label = string.Format("{0} [{1}x{2} / {3}]", UnicodeCharacters.Image, image.Width.ToString(), image.Height.ToString(), System.DateTime.Now.ToString()); this.Text = this.Label; }
public AboutDialog() : base(string.Empty, PintaCore.Chrome.MainWindow, DialogFlags.Modal) { Title = Catalog.GetString ("About Pinta"); //TransientFor = IdeApp.Workbench.RootWindow; AllowGrow = false; HasSeparator = false; Icon = PintaCore.Resources.GetIcon ("Pinta.png"); VBox.BorderWidth = 0; aboutPictureScrollBox = new ScrollBox (); VBox.PackStart (aboutPictureScrollBox, false, false, 0); imageSep = PintaCore.Resources.GetIcon ("About.ImageSep.png"); VBox.PackStart (new Gtk.Image (imageSep), false, false, 0); Notebook notebook = new Notebook (); notebook.BorderWidth = 6; notebook.AppendPage (new AboutPintaTabPage (), new Label (Title)); notebook.AppendPage (new VersionInformationTabPage (), new Label (Catalog.GetString ("Version Info"))); VBox.PackStart (notebook, true, true, 4); AddButton (Gtk.Stock.Close, (int)ResponseType.Close); ShowAll (); }
public static void Initialize () { DefaultIcon = DockServices.Drawing.LoadIcon (DefaultIconName, NoteIconSize); statusIcon = new StatusIcon (); statusIcon.Pixbuf = DockServices.Drawing.LoadIcon (DefaultIconName, StatusIconSize); statusIcon.Visible = false; }
public void TestSizePath() { var png_file_path = ExtractPngFromResource (); string jpg_file_path = null; try { var artist_album_id = CoverArtSpec.CreateArtistAlbumId ("Metallica", "Master Of Puppets"); jpg_file_path = CoverArtSpec.GetPathForSize (artist_album_id, CustomArtworkManager.SizeTest); // i.e.: /home/knocte/.cache/media-art/36/album-d33f25dbd7dfb4817a7e99f6bc2de49e.jpg" var pixbuf = new Pixbuf (png_file_path); var dir = System.IO.Path.GetDirectoryName (jpg_file_path); if (!System.IO.Directory.Exists (dir)) { System.IO.Directory.CreateDirectory (dir); } pixbuf.Save (jpg_file_path, "jpeg"); var artwork_manager = new CustomArtworkManager (); Assert.IsNull (artwork_manager.LookupScaleSurface (artist_album_id, 1, false), "Should have got null at the first request, with an invalid size"); Assert.IsNotNull (artwork_manager.LookupScaleSurface (artist_album_id, CustomArtworkManager.SizeTest, false), "Null at the second request, was null cached incorrectly?"); } finally { File.Delete (png_file_path); if (File.Exists (jpg_file_path)) { File.Delete (jpg_file_path); } } }
public PlayPauseButton(string playXPM, string pauseXPM) { _paused = true; _playImage = new Pixbuf(playXPM); _pauseImage = new Pixbuf(pauseXPM); _image = new Gtk.Image(); _image.Pixbuf = _playImage; Add(_image); _image.Show(); this.ButtonPressEvent+= delegate(object o, ButtonPressEventArgs args) { if (_paused) _image.Pixbuf = _pauseImage; else _image.Pixbuf = _playImage; _paused = !_paused; if (Clicked != null) Clicked(this, new PlayPauseButtonEventArgs(){ IsPaused = _paused }); }; this.WidthRequest = _image.Pixbuf.Width; }
public ImageWindow(string src) : base(src) { Decorated = false; KeepAbove = true; Resize (640, 240); Move (100, 100); //Opacity = 1.0; pixbuf = new Pixbuf (src); Gtk.Image image = new Gtk.Image (); image.Pixbuf = pixbuf; EventBox box = new EventBox (); box.Add (image); box.ButtonPressEvent += new ButtonPressEventHandler (WindowController.OnButtonDragPress); box.ExposeEvent += HandleMyWinExposeEvent; Add (box); WindowController.HandleMyWinScreenChanged(this, null); WindowController.SetWindowShapeFromPixbuf (this, image.Pixbuf); DestroyEvent += new DestroyEventHandler (delegate(object o, DestroyEventArgs args) { if(cr!=null){ ((IDisposable)cr).Dispose(); } }); ShowAll(); }
public void Import(string fileName) { Pixbuf bg; // Handle any EXIF orientation flags using (var fs = new FileStream (fileName, FileMode.Open, FileAccess.Read)) bg = new Pixbuf (fs); bg = bg.ApplyEmbeddedOrientation (); Size imagesize = new Size (bg.Width, bg.Height); Document doc = PintaCore.Workspace.CreateAndActivateDocument (fileName, imagesize); doc.HasFile = true; doc.ImageSize = imagesize; doc.Workspace.CanvasSize = imagesize; Layer layer = doc.AddNewLayer (Path.GetFileName (fileName)); using (Cairo.Context g = new Cairo.Context (layer.Surface)) { CairoHelper.SetSourcePixbuf (g, bg, 0, 0); g.Paint (); } bg.Dispose (); }
public override void DoThumbnail(object sender, EventArgs e) { Gtk.TreeIter iter; try { iter = (Gtk.TreeIter) ((Task)sender).Data; string file = (string) store.GetValue (iter, COL_PATH); Gdk.Pixbuf im = Backends.ThumbnailCache.Factory.Provider.GetThumbnail (file, thumbnail_width, thumbnail_height); if (im == null) im = new Gdk.Pixbuf (file); int max = Math.Max (im.Width, im.Height); Gdk.Pixbuf scaled = im.ScaleSimple (thumbnail_width * im.Width / max, thumbnail_height * im.Height / max, InterpType.Nearest); Application.Invoke (delegate { store.SetValue (iter, COL_PIXBUF, scaled); } ); im.Dispose (); } catch (Exception ex) { Logger.Error ("ImagesFileView.DoThumbnail. Exception: " + ex.Message); } }
/// <summary> /// Crea una imagen mas pequeña a partir de otra. /// </summary> /// <param name="image"> /// La imagen a la que se le quiere hacer una previsualización. /// </param> /// <param name="size"> /// El tamaño de la previsualización. /// </param> public static Gdk.Pixbuf MakeThumbnail(Gdk.Pixbuf image, int size) { float scale; // La escalamos para que no se distorsione. if(image.Width > image.Height) { scale = (float)(size)/image.Width; } else { scale = (float)(size)/image.Height; } int newWidth = (int)(scale*image.Width); int newHeight = (int)(scale*image.Height); Pixbuf res = new Pixbuf(image.Colorspace, image.HasAlpha, image.BitsPerSample, size, size); res.Fill(0xFFFFFFFF); image.Scale(res, 0,0, size, size, (size -newWidth)/2,(size-newHeight)/2, scale, scale, Gdk.InterpType.Bilinear ); return res; }
public void UpdateCaceheInfo() { m_model = new ListStore(typeof(Pixbuf), typeof(string), typeof(string)); if (m_monitor.SelectedCache == null) { this.Sensitive = false; return; } this.Sensitive = true; string imagesFolder = GetImagesFolder (); fileLabel.Text = String.Format(Catalog.GetString("Images Folder: {0}"), imagesFolder); if(Directory.Exists(imagesFolder)) { string[] files = Directory.GetFiles(imagesFolder); foreach(string file in files) { Pixbuf buf = new Pixbuf(file,256, 256); string[] filePath = file.Split('/'); m_model.AppendValues(buf, filePath[filePath.Length -1],file); } } imagesView.Model = m_model; imagesView.PixbufColumn = 0; imagesView.TextColumn = 1; imagesView.SelectionMode = SelectionMode.Single; }
//level must be declared prior to calling this public void drawTileset() { _tilesetCache = new Gdk.Pixbuf(_editLevel.tilesetPath); Pixmap pMap, mask; _tilesetCache.RenderPixmapAndMask (out pMap, out mask, 0); int imgWidth = _tilesetCache.Width, imgHeight = _tilesetCache.Height; _tilesetEventBox.SetSizeRequest (imgWidth, imgHeight); tilesetDrawPane.SetSizeRequest (imgWidth, imgHeight); if (_tilesetGrid) { //get the context we're drawing in Gdk.GC gc = new Gdk.GC (levelDrawPane.GdkWindow); //draw the grid for (int x = 0; x < imgWidth; x += _editLevel._tileWidth) pMap.DrawLine (gc, x, 0, x, imgHeight); for (int y = 0; y < imgHeight; y += _editLevel._tileHeight) pMap.DrawLine (gc, 0, y, imgWidth, y); } tilesetDrawPane.SetFromPixmap (pMap, mask); //---------------------- }
public Pixbuf Adjust () { Gdk.Pixbuf final = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, Input.Width, Input.Height); Cms.Profile [] list = GenerateAdjustments ().ToArray (); if (Input.HasAlpha) { Pixbuf alpha = PixbufUtils.Flatten (Input); Transform transform = new Transform (list, PixbufUtils.PixbufCmsFormat (alpha), PixbufUtils.PixbufCmsFormat (final), intent, 0x0000); PixbufUtils.ColorAdjust (alpha, final, transform); PixbufUtils.ReplaceColor (final, Input); alpha.Dispose (); final.Dispose (); final = Input; } else { Cms.Transform transform = new Cms.Transform (list, PixbufUtils.PixbufCmsFormat (Input), PixbufUtils.PixbufCmsFormat (final), intent, 0x0000); PixbufUtils.ColorAdjust (Input, final, transform); } return final; }
static bool Animate() { if (walking) { current_frame_num += FRAME_STEP; if (current_frame_num > WALK_CYCLE_END) { num_walks++; if (num_walks > 10) { num_walks = 0; walking = false; current_frame_num = DEATH_CYCLE_START; } else { current_frame_num = WALK_CYCLE_START; } } } else /* dying */ { if (current_frame_num == DEATH_CYCLE_END) { death_timer++; if (death_timer == 30) { death_timer = 0; walking = true; current_frame_num = WALK_CYCLE_START; } } else { current_frame_num++; } } byte[] pixbuf_data = CreatePixbufData(grp.GetFrame(current_frame_num), grp.Width, grp.Height, Palette.default_palette); Gdk.Pixbuf temp = new Gdk.Pixbuf(pixbuf_data, Colorspace.Rgb, false, 8, grp.Width, grp.Height, grp.Width * 3, null); current_frame = temp.ScaleSimple(grp.Width * 2, grp.Height * 2, InterpType.Nearest); temp.Dispose(); drawing_area.QueueDraw(); return(true); }
public bool Convert(FilterRequest req) { Uri source = req.Current; using (ImageFile img = ImageFile.Create(source)) { pixbuf = img.Load(); profile = img.GetProfile(); // If the image doesn't have an embedded profile assume it is sRGB if (profile == null) { profile = Profile.CreateStandardRgb(); } if (destination == null) { destination = profile; } Gdk.Pixbuf final = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, pixbuf.Width, pixbuf.Height); Profile [] list = Prepare(pixbuf); if (pixbuf.HasAlpha) { Gdk.Pixbuf alpha = PixbufUtils.Flatten(pixbuf); Transform transform = new Transform(list, PixbufUtils.PixbufCmsFormat(alpha), PixbufUtils.PixbufCmsFormat(final), rendering_intent, 0x0000); PixbufUtils.ColorAdjust(alpha, final, transform); PixbufUtils.ReplaceColor(final, pixbuf); alpha.Dispose(); final.Dispose(); final = pixbuf; } else { Transform transform = new Transform(list, PixbufUtils.PixbufCmsFormat(pixbuf), PixbufUtils.PixbufCmsFormat(final), rendering_intent, 0x0000); PixbufUtils.ColorAdjust(pixbuf, final, transform); pixbuf.Dispose(); } Uri dest_uri = req.TempUri(Path.GetExtension(source.LocalPath)); using (Stream output = File.OpenWrite(dest_uri.LocalPath)) { img.Save(final, output); } final.Dispose(); req.Current = dest_uri; return(true); } }
public static void CopyThumbnailOptions(Gdk.Pixbuf src, Gdk.Pixbuf dest) { if (src != null && dest != null) { PixbufUtils.SetOption(dest, "tEXt::Thumb::URI", src.GetOption("tEXt::Thumb::URI")); PixbufUtils.SetOption(dest, "tEXt::Thumb::MTime", src.GetOption("tEXt::Thumb::MTime")); } }
/// <summary> /// Carga una nueva imagen en la lista. /// </summary> /// <param name="image"> /// La imagen a cargar. /// </param> private void LoadNewImage(Gdk.Pixbuf image) { Gdk.Pixbuf smallImage = ImageUtils.MakeThumbnail(image, 48); TreeIter iter = imagesStore.AppendValues(smallImage, image); imagesIV.ScrollToPath(imagesStore.GetPath(iter)); imagesIV.SelectPath(imagesStore.GetPath(iter)); }
public void CreatePixbufFromThumb() { byte [] data = thumb.Copy (); Assert.AreEqual (8613, data.Length); Pixbuf pixbuf = new Pixbuf (data); Assert.AreEqual (160, pixbuf.Width); Assert.AreEqual (120, pixbuf.Height); }
static TabLabel() { try { closeImage = Gdk.Pixbuf.LoadFromResource("MonoDevelop.Close.png"); } catch (Exception e) { MonoDevelop.Core.LoggingService.LogError("Can't create pixbuf from resource: MonoDevelop.Close.png", e); } }
public Photo CreateOverDBus(string new_path, string orig_path, uint roll_id, out Gdk.Pixbuf pixbuf) { Photo photo = Create(new_path, orig_path, roll_id, out pixbuf); EmitAddedOverDBus(photo); return(photo); }
protected void RenderPixbufToSurf(Cairo.Context gc, Gdk.Pixbuf pixbuf, double x, double y) { gc.Save(); gc.Rectangle(x, y, pixbuf.Width, pixbuf.Height); Gdk.CairoHelper.SetSourcePixbuf(gc, pixbuf, x, y); gc.Fill(); gc.Restore(); }
static ZoomableCairoArea() { arrowUp = Gui.LoadIcon(22, "go-up"); arrowDown = Gui.LoadIcon(22, "go-down"); arrowLeft = Gui.LoadIcon(22, "go-previous"); arrowRight = Gui.LoadIcon(22, "go-next"); zoomGlass = new Pixbuf(null, "FileFind.Meshwork.GtkClient.zoom.png"); }
internal Bitmap GetBitmap(int width, int height) { Gdk.Pixbuf pb = GetPixbufOfWebBrowser(width, height); byte[] buffer = pb.SaveToBuffer("bmp"); MemoryStream s = new MemoryStream(buffer); return(new Bitmap(s)); }
static CustomCursorFactory() { Gdk.Pixbuf cursorGrabbingPix = Gdk.Pixbuf.LoadFromResource("TraceLab.UI.GTK.Resources.cursor_grabbing.png"); Gdk.Pixbuf cursorGrabOpenPix = Gdk.Pixbuf.LoadFromResource("TraceLab.UI.GTK.Resources.cursor-grab-open.png"); s_cursorGrabbingHand = new Cursor(Display.Default, cursorGrabbingPix, 0, 0); s_cursorOpenHandGrab = new Cursor(Display.Default, cursorGrabOpenPix, 0, 0); }
public void RenderItem(Context cr, Gdk.Point renderAnchor, int width, Do.Universe.Item item, bool drawArrow) { cr.Rectangle(renderAnchor.X, renderAnchor.Y, width, Height); cr.SetSourceRGBA(0, 0, 0, 0); cr.Operator = Operator.Source; cr.Fill(); cr.Operator = Operator.Over; Gdk.Pixbuf pixbuf = IconProvider.PixbufFromIconName(item.Icon, IconSize); Gdk.CairoHelper.SetSourcePixbuf(cr, pixbuf, 2, 2); cr.Paint(); pixbuf.Dispose(); foreach (int i in parent.Secondary) { if (parent.Results[i] == item) { pixbuf = IconProvider.PixbufFromIconName("gtk-add", IconSize); Gdk.CairoHelper.SetSourcePixbuf(cr, pixbuf, 2, 2); cr.PaintWithAlpha(.7); pixbuf.Dispose(); } } Pango.Layout layout = new Pango.Layout(parent.PangoContext); layout.Width = Pango.Units.FromPixels(width - IconSize - 25); layout.Ellipsize = Pango.EllipsizeMode.End; layout.SetMarkup("<span foreground=\"#" + parent.ItemTextColor + "\">" + GLib.Markup.EscapeText(item.Name) + "</span>"); layout.FontDescription = Pango.FontDescription.FromString("normal bold"); layout.FontDescription.AbsoluteSize = Pango.Units.FromPixels(10); cr.MoveTo(IconSize + 6, 4); Pango.CairoHelper.ShowLayout(cr, layout); layout.SetMarkup("<span foreground=\"#" + parent.ItemTextColor + "\">" + GLib.Markup.EscapeText(item.Description) + "</span>"); layout.FontDescription.Dispose(); layout.FontDescription = Pango.FontDescription.FromString("normal"); layout.FontDescription.AbsoluteSize = Pango.Units.FromPixels(10); cr.MoveTo(IconSize + 8, 19); Pango.CairoHelper.ShowLayout(cr, layout); if (drawArrow) { cr.MoveTo(width - 15, 13); cr.LineTo(width - 15 + 7, 17); cr.LineTo(width - 15, 21); Gdk.Color gc = new Gdk.Color(); Gdk.Color.Parse("#" + parent.ItemTextColor, ref gc); cr.SetSourceRGB(gc); cr.Fill(); } layout.FontDescription.Dispose(); layout.Dispose(); (cr as IDisposable).Dispose(); }
public Led(bool initialState) { BuildGui(); this.pixbufLedOn = Pixbuf.LoadFromResource("Basenji.images.LED_On.png"); this.pixbufLedOff = Pixbuf.LoadFromResource("Basenji.images.LED_Off.png"); LedState = initialState; }
protected override Gdk.Pixbuf ProcessPixbuf(Gdk.Pixbuf pbuf) { if (Status != WeatherDockletStatus.Error && Status != WeatherDockletStatus.Initializing) { return(pbuf); } return(pbuf.MonochromePixbuf()); }
public static void RenderTiled(this Cairo.Context self, Gdk.Pixbuf source, Gdk.Rectangle area, Gdk.Rectangle clip, double opacity = 1) { Gdk.CairoHelper.SetSourcePixbuf(self, source, area.X, area.Y); cairo_pattern_set_extend(self.Pattern.Pointer, CairoExtend.CAIRO_EXTEND_REPEAT); self.Rectangle(clip.ToCairoRect()); self.Clip(); self.PaintWithAlpha(opacity); self.ResetClip(); }
/// <summary> /// Adds an image to the image list. /// </summary> /// <param name="filename"> /// A <see cref="System.String"/> containing the image's location. /// </param> private void AddImageFile(string filename) { Gdk.Pixbuf b = new Gdk.Pixbuf(filename); LoadNewImage(b); LogLine("¡Archivo de imagen «{0}» añadido correctamente!", filename); }
public void AddStartMessage() { if (rootTest != null) { Gdk.Pixbuf infoIcon = failuresTreeView.RenderIcon(Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, ""); string msg = string.Format(GettextCatalog.GetString("Running tests for <b>{0}</b> configuration <b>{1}</b>"), rootTest.Name, configuration); failuresStore.AppendValues(infoIcon, msg, rootTest); } }
private static Gdk.Pixbuf ImageToPixbuf(System.Drawing.Image image) { using (MemoryStream stream = new MemoryStream()) { image.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp); stream.Position = 0; Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(stream); return(pixbuf); } }
public void AddStartMessage (bool isRunning = true) { if (rootTest != null) { Gdk.Pixbuf infoIcon = failuresTreeView.RenderIcon (Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, ""); string msg = string.Format (isRunning ? GettextCatalog.GetString ("Running tests for <b>{0}</b> configuration <b>{1}</b>") : GettextCatalog.GetString ("Test results for <b>{0}</b> configuration <b>{1}</b>"), rootTest.Name, configuration); startMessageIter = failuresStore.AppendValues (infoIcon, msg, rootTest, null, 0); } else { startMessageIter = Gtk.TreeIter.Zero; } }
/// <summary> /// Loads the icon for a given name and size. /// </summary> /// <returns>The icon as a Gdk.Pixbuf or missing image icon if not found.</returns> /// <param name="name">Icon Name.</param> /// <param name="size">Icon Size in pixels.</param> /// <param name="flags">Lookup Flags like ForceSVG.</param> public static Gdk.Pixbuf LoadIcon(string name, int size, IconLookupFlags flags = IconLookupFlags.ForceSvg) { try { IconInfo icon_info = Gtk.IconTheme.Default.LookupIcon(name, size, flags); Gdk.Pixbuf res = new Gdk.Pixbuf(icon_info.Filename, size, size, true); return(res); } catch (System.Exception) { return(LoadMissingIcon(size)); } }
internal virtual void StopPlaying() { stage.Playing = false; if (textImage != null) { textImage.Dispose(); textImage = null; } }
protected virtual void Init() { // could also use pre-defined wrapper with internal bitmap: NPlot.Bitmap.PlotSurface2D this.bitmap_cache = new System.Drawing.Bitmap(rectSizing.Width, rectSizing.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); // black/transparent (depending on image format) frame this.padding = Padding; constDataIcon = DrawConstDataIcon(); }
public static void SaveAtomic(Gdk.Pixbuf src, string filename, string type, string [] keys, string [] values) { string tmpname = filename + ".tmp"; src.Savev(tmpname, type, NullTerminateArray(keys), NullTerminateArray(values)); if (rename(tmpname, filename) < 0) { throw new Exception("Error renaming file"); } }
public static Surface CreateSurfaceForPixbuf(Cairo.Context cr, Gdk.Pixbuf pixbuf) { Surface surface = cr.Target.CreateSimilar(cr.Target.Content, pixbuf.Width, pixbuf.Height); Cairo.Context surface_cr = new Context(surface); Gdk.CairoHelper.SetSourcePixbuf(surface_cr, pixbuf, 0, 0); surface_cr.Paint(); ((IDisposable)surface_cr).Dispose(); return(surface); }
public void InitListViewIcons() { fax_receiving = Gtk.IconTheme.Default.LoadIcon("document-save", 16, 0); fax_fail = Gtk.IconTheme.Default.LoadIcon("gtk-cancel", 16, 0); fax_sent = Gtk.IconTheme.Default.LoadIcon("gtk-apply", 16, 0); fax_run = Gtk.IconTheme.Default.LoadIcon("printer-printing", 16, 0); fax_block = Gtk.IconTheme.Default.LoadIcon("printer-error", 16, 0); fax_sleep = Gtk.IconTheme.Default.LoadIcon("appointment-soon", 16, 0); fax_received = Gtk.IconTheme.Default.LoadIcon("text-x-generic", 16, 0); }
void DrawFrame(Gdk.Pixbuf pb, DateTime now) { Console.WriteLine("draw frame"); smk.NextFrame(); if (current_frame != null) { current_frame.Composite(pb, 0, 0, (int)smk.Width, (int)smk.Height, 0, 0, 1, 1, InterpType.Nearest, 0xff); } }
public SourceItem(ImportSource source) : base(source.Name.Replace("_", "__")) { this.Source = source; Gdk.Pixbuf icon = source.Icon; if (icon != null) { this.Image = new Gtk.Image(icon); } }
public static Gdk.Pixbuf ImageToPixbuf(System.Drawing.Image image) { using (var stream = new System.IO.MemoryStream()) { image.Save(stream, System.Drawing.Imaging.ImageFormat.Png); stream.Position = 0; Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(stream); return(pixbuf); } }
protected override void OnKeyDown(Gtk.DrawingArea canvas, Gtk.KeyPressEventArgs args) { base.OnKeyDown(canvas, args); //note that this WONT work if user presses control key and THEN selects the tool! if (args.Event.Key == Key.Control_L || args.Event.Key == Key.Control_R) { Gdk.Pixbuf icon = PintaCore.Resources.GetIcon("Cursor.CloneStampSetSource.png"); Gdk.Cursor setSourceCursor = new Gdk.Cursor(PintaCore.Chrome.Canvas.Display, icon, 6, 11); SetCursor(setSourceCursor); } }
public AboutDialog() { Artists = new string[] { "Michael Iatrou" }; Authors = new string[] { "Alexandros Frantzis" }; Copyright = Catalog.GetString("Copyright 2004 - 2008 Alexandros Frantzis"); ProgramName = "Bless"; Version = ConfigureDefines.VERSION; Comments = Catalog.GetString("Bless is a Hex Editor for Gtk#"); Website = "http://home.gna.org/bless"; Logo = new Gdk.Pixbuf(FileResourcePath.GetDataPath("bless-about.png")); }