本文整理汇总了C#中Gdk.Pixbuf.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Pixbuf.Copy方法的具体用法?C# Gdk.Pixbuf.Copy怎么用?C# Gdk.Pixbuf.Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.Pixbuf
的用法示例。
在下文中一共展示了Gdk.Pixbuf.Copy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditTagIconDialog
public EditTagIconDialog(Db db, Tag t, Gtk.Window parent_window)
: base("EditTagIconDialog.ui", "edit_tag_icon_dialog")
{
this.db = db;
TransientFor = parent_window;
Title = String.Format (Catalog.GetString ("Edit Icon for Tag {0}"), t.Name);
preview_pixbuf = t.Icon;
Cms.Profile screen_profile;
if (preview_pixbuf != null && FSpot.ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) {
preview_image.Pixbuf = preview_pixbuf.Copy ();
ColorManagement.ApplyProfile (preview_image.Pixbuf, screen_profile);
} else
preview_image.Pixbuf = preview_pixbuf;
query = new FSpot.PhotoQuery (db.Photos);
if (db.Tags.Hidden != null)
query.Terms = FSpot.OrTerm.FromTags (new Tag [] {t});
else
query.Terms = new FSpot.Literal (t);
image_view = new PhotoImageView (query) {CropHelpers = false};
image_view.SelectionXyRatio = 1.0;
image_view.SelectionChanged += HandleSelectionChanged;
image_view.PhotoChanged += HandlePhotoChanged;
external_photo_chooser = new Gtk.FileChooserButton (Catalog.GetString ("Select Photo from file"),
Gtk.FileChooserAction.Open);
external_photo_chooser.Filter = new FileFilter();
external_photo_chooser.Filter.AddPixbufFormats();
external_photo_chooser.LocalOnly = false;
external_photo_chooser_hbox.PackStart (external_photo_chooser);
external_photo_chooser.Show ();
external_photo_chooser.SelectionChanged += HandleExternalFileSelectionChanged;
photo_scrolled_window.Add (image_view);
if (query.Count > 0) {
photo_spin_button.Wrap = true;
photo_spin_button.Adjustment.Lower = 1.0;
photo_spin_button.Adjustment.Upper = (double) query.Count;
photo_spin_button.Adjustment.StepIncrement = 1.0;
photo_spin_button.ValueChanged += HandleSpinButtonChanged;
image_view.Item.Index = 0;
} else {
from_photo_label.Markup = String.Format (Catalog.GetString (
"\n<b>From Photo</b>\n" +
" You can use one of your library photos as an icon for this tag.\n" +
" However, first you must have at least one photo associated\n" +
" with this tag. Please tag a photo as '{0}' and return here\n" +
" to use it as an icon."), t.Name);
photo_scrolled_window.Visible = false;
photo_label.Visible = false;
photo_spin_button.Visible = false;
}
icon_store = new ListStore (typeof (string), typeof (Gdk.Pixbuf));
icon_view = new Gtk.IconView (icon_store);
icon_view.PixbufColumn = 1;
icon_view.SelectionMode = SelectionMode.Single;
icon_view.SelectionChanged += HandleIconSelectionChanged;
icon_scrolled_window.Add (icon_view);
icon_view.Show();
image_view.Show ();
FSpot.Delay fill_delay = new FSpot.Delay (FillIconView);
fill_delay.Start ();
}
示例2: HandlePhotoChanged
private void HandlePhotoChanged (PhotoImageView view)
{
try {
if (!view.Item.IsValid)
throw new Exception ("Invalid Image");
using (FSpot.ImageFile img = FSpot.ImageFile.Create (((Photo)view.Item.Current).DefaultVersionUri)) {
try {
image_profile = img.GetProfile ();
} catch (System.Exception e) {
image_profile = null;
System.Console.WriteLine (e);
}
// FIXME fall back to rgb for now
if (image_profile == null)
image_profile = Cms.Profile.CreateStandardRgb ();
AdjustedPixbuf = img.Load (256, 256);
ScaledPixbuf = AdjustedPixbuf.Copy ();
}
if (AdjustedPixbuf.HasAlpha)
throw new Exception ("Unsupported Alpha Channel");
control_vbox.Sensitive = true;
ok_button.Sensitive = true;
RangeChanged (null, null);
} catch (System.Exception) {
control_vbox.Sensitive = false;
ok_button.Sensitive = false;
AdjustedPixbuf = null;
ScaledPixbuf = null;
image_profile = null;
}
}
示例3: OnControllerTokenChecked
/// <summary>
/// Handles the start of processing of a new node.
/// </summary>
/// <param name="sender">
/// A <see cref="System.Object"/>
/// </param>
/// <param name="args">
/// A <see cref="EventArgs"/>
/// </param>
private void OnControllerTokenChecked(object sender,
TokenCheckedArgs args)
{
Application.Invoke(sender, args,
delegate(object resender, EventArgs _args)
{
TokenCheckedArgs a = _args as TokenCheckedArgs;
if(!sequencingFinished)
{
currentToken = a.CurrentToken;
FloatBitmap sequenceImage;
if(a.LastSequence!= null)
{
TokenSequence joinSeq =
new TokenSequence(a.LastSequence);
lastToken = joinSeq.Last;
joinSeq.Append(currentToken);
Token joinedToken =Token.Join(joinSeq, "");
sequenceImage = joinedToken.Image;
}
else
{
sequenceImage = currentToken.Image;
lastToken = null;
}
// We add a border to the orginal image.
Gdk.Pixbuf sequencePixbuf = sequenceImage.CreatePixbuf();
Gdk.Pixbuf drawnImage =
new Gdk.Pixbuf(sequencePixbuf.Colorspace,false, 8,
sequencePixbuf.Width+10,
sequencePixbuf.Height+10);
drawnImage.Fill(0xFFFFFFFF);
sequencePixbuf.CopyArea(0, 0,
sequencePixbuf.Width,
sequencePixbuf.Height,
drawnImage,
5,5);
if(lastToken!=null)
{
uint color;
if(currentToken.CloseFollows(lastToken))
{
color = 0x00FF00;
sequencingStepResultLbl.Markup =
String.Format("<b>Sí, el símbolo «{0}» se añadirá a la secuencia actual</b>",
currentToken.Text);
}
else
{
color = 0xFF0000;
sequencingStepResultLbl.Markup =
String.Format("<b>No, «{0}» no puede ser considerado parte de la secuencia ({1})</b>",
currentToken.Text,
a.LastSequence.ToString());
}
Gdk.Pixbuf markedImage = drawnImage.Copy();
// We paint the image of the color
markedImage =
markedImage.CompositeColorSimple(markedImage.Width,
markedImage.Height,
Gdk.InterpType.Nearest,
100, 1, color, color);
// We are going to mark the image of the to symbols being considered
// with their baselines.
int min = int.MaxValue;
foreach (Token t in a.LastSequence )
{
if(t.Top < min)
min =t.Top;
}
int offset = Math.Min(min, currentToken.Top);
int lastBaseline = lastToken.Baseline - offset;
int currentBaseline = currentToken.Baseline - offset;
//.........这里部分代码省略.........
示例4: Refresh
public void Refresh()
{
foreach (string i in SearchPath) {Console.WriteLine (i);}
IconProvider provider = new IconProvider ("");
string folder = provider.GetTargetFolderPath ();
string [] files = Directory.GetFiles (folder);
int [] sizes = {16, 24, 32, 48};
foreach (string file_path in files) {
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (file_path);
FileInfo file_info = new FileInfo (file_path);
// Delete the icon if it turns out to be empty
if (file_info.Length == 0) {
File.Delete (file_path);
Console.WriteLine ("Deleted: " + file_path);
}
for (int i = 0; i < 4; i++) {
int size = sizes [i];
Gdk.Pixbuf pixbuf_copy = pixbuf.Copy ();
if (pixbuf.Width != size || pixbuf.Height != size)
pixbuf_copy = pixbuf.ScaleSimple (size, size, Gdk.InterpType.Hyper);
string size_folder_path = CombineMore (Path, size + "x" + size, "status");
string size_file_path = CombineMore (size_folder_path, System.IO.Path.GetFileName (file_path));
Directory.CreateDirectory (size_folder_path);
if (File.Exists (size_file_path))
File.Delete (size_file_path);
pixbuf_copy.Save (size_file_path, "png");
}
File.Delete (file_path);
}
RescanIfNeeded ();
}
示例5: OnControllerNodeBeingProcessed
/// <summary>
/// If sequencing, selects the next symbol of the list.
/// </summary>
/// <param name="sender">
/// A <see cref="System.Object"/>
/// </param>
/// <param name="args">
/// A <see cref="EventArgas"/>
/// </param>
private void OnControllerNodeBeingProcessed(object sender,
NodeBeingProcessedArgs _args)
{
Application.Invoke(sender, _args,
delegate(object resender, EventArgs args)
{
NodeBeingProcessedArgs a = args as NodeBeingProcessedArgs;
if(!sequencingFinished)
{
// We are sequencing.
// Selects the new first.
symbolsIV.SelectPath(processedPath);
symbolsIV.ScrollToPath(processedPath,1,0.5f);
processedPath.Next();
}
else
{
// We are matching
SequenceNode node = (SequenceNode) a.Node;
node.Select();
Token t = Token.Join(node.Sequence, "");
sequenceNodeImage = t.Image.CreatePixbuf();
sequenceMatchingImageArea.Image = sequenceNodeImage.Copy();
sequenceNodeImage =
sequenceNodeImage.CompositeColorSimple(sequenceNodeImage.Width,
sequenceNodeImage.Height,
Gdk.InterpType.Nearest,
100, 1,
0xAAAAAA,0xAAAAAA);
matchingResultLbl.Markup = "-";
tokenizingRulesTV.Selection.UnselectAll();
tokenizingRulesTV.ScrollToPoint(0,0);
if(controller.StepMode == ControllerStepMode.StepByStep)
{
tokenizingNextButtonsAlign.Sensitive = true;
}
}
});
}