本文整理汇总了C#中Gdk.Pixbuf.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Pixbuf.Fill方法的具体用法?C# Gdk.Pixbuf.Fill怎么用?C# Gdk.Pixbuf.Fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.Pixbuf
的用法示例。
在下文中一共展示了Gdk.Pixbuf.Fill方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetIcon
public Gdk.Pixbuf GetIcon(Gdk.Color gcolor)
{
uint color = (((uint)gcolor.Red >> 8) << 24) | (((uint)gcolor.Green >> 8) << 16) | (((uint)gcolor.Blue >> 8) << 8) | 0xff;
Gdk.Pixbuf icon = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 16, 16);
icon.Fill (color);
return icon;
}
示例2: DesaturateIcon
public static Gdk.Pixbuf DesaturateIcon(Gdk.Pixbuf source)
{
Gdk.Pixbuf dest = new Gdk.Pixbuf (source.Colorspace, source.HasAlpha, source.BitsPerSample, source.Width, source.Height);
dest.Fill (0);
source.SaturateAndPixelate (dest, 0, false);
return dest;
}
示例3: Crop
public override object Crop(object handle, int srcX, int srcY, int width, int height)
{
var pix = (Gdk.Pixbuf)handle;
Gdk.Pixbuf res = new Gdk.Pixbuf (pix.Colorspace, pix.HasAlpha, pix.BitsPerSample, width, height);
res.Fill (0);
pix.CopyArea (srcX, srcY, width, height, res, 0, 0);
return res;
}
示例4: AddIconOverlay
public static Gdk.Pixbuf AddIconOverlay(Gdk.Pixbuf target, Gdk.Pixbuf overlay)
{
Gdk.Pixbuf res = new Gdk.Pixbuf (target.Colorspace, target.HasAlpha, target.BitsPerSample, target.Width, target.Height);
res.Fill (0);
target.CopyArea (0, 0, target.Width, target.Height, res, 0, 0);
overlay.Composite (res, 0, 0, overlay.Width, overlay.Height, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 255);
return res;
}
示例5: AddOverlay
void AddOverlay (ref Gdk.Pixbuf icon, Gdk.Pixbuf overlay)
{
Gdk.Pixbuf cached = Context.GetComposedIcon (icon, overlay);
if (cached != null) {
icon = cached;
return;
}
int dx = 2;
int dy = 2;
Gdk.Pixbuf res = new Gdk.Pixbuf (icon.Colorspace, icon.HasAlpha, icon.BitsPerSample, icon.Width + dx, icon.Height + dy);
res.Fill (0);
icon.CopyArea (0, 0, icon.Width, icon.Height, res, 0, 0);
overlay.Composite (res,
res.Width - overlay.Width, res.Height - overlay.Height,
overlay.Width, overlay.Height,
res.Width - overlay.Width, res.Height - overlay.Height,
1, 1, Gdk.InterpType.Bilinear, 255);
Context.CacheComposedIcon (icon, overlay, res);
icon = res;
}
示例6: CreateColorBlock
static Gdk.Pixbuf CreateColorBlock (string name, Gtk.IconSize size)
{
int w, h;
if (!Gtk.Icon.SizeLookup (Gtk.IconSize.Menu, out w, out h))
w = h = 22;
Gdk.Pixbuf p = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, w, h);
uint color;
if (!TryParseColourFromHex (name, false, out color))
//if lookup fails, make it transparent
color = 0xffffff00u;
p.Fill (color);
return p;
}
示例7: CropBitmap
public override object CropBitmap (object handle, int srcX, int srcY, int width, int height)
{
var pix = ((GtkImage)handle).Frames[0].Pixbuf;
Gdk.Pixbuf res = new Gdk.Pixbuf (pix.Colorspace, pix.HasAlpha, pix.BitsPerSample, width, height);
res.Fill (0);
pix.CopyArea (srcX, srcY, width, height, res, 0, 0);
return new GtkImage (res);
}
示例8: MergeIcons
//caller should check null and that sizes match
static Gdk.Pixbuf MergeIcons (Gdk.Pixbuf icon1, Gdk.Pixbuf icon2)
{
Gdk.Pixbuf res = new Gdk.Pixbuf (icon1.Colorspace, icon1.HasAlpha, icon1.BitsPerSample, icon1.Width, icon1.Height);
res.Fill (0);
icon1.CopyArea (0, 0, icon1.Width, icon1.Height, res, 0, 0);
icon2.Composite (res, 0, 0, icon2.Width, icon2.Height, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 255);
return res;
}
示例9: InitializeWidgets
private void InitializeWidgets()
{
this.Spacing = 10;
this.BorderWidth = 10;
UserTreeView = new iFolderTreeView();
ScrolledWindow sw = new ScrolledWindow();
sw.ShadowType = Gtk.ShadowType.EtchedIn;
sw.Add(UserTreeView);
this.PackStart(sw, true, true, 0);
UserTreeStore = new ListStore(typeof(iFolderUser));
UserTreeView.Model = UserTreeStore;
CellRendererPixbuf mcrp = new CellRendererPixbuf();
TreeViewColumn UserColumn = new TreeViewColumn();
UserColumn.PackStart(mcrp, false);
UserColumn.Spacing = 2;
UserColumn.SetCellDataFunc(mcrp,
new TreeCellDataFunc(UserCellPixbufDataFunc));
CellRendererText mcrt = new CellRendererText();
UserColumn.PackStart(mcrt, false);
UserColumn.SetCellDataFunc(mcrt,
new TreeCellDataFunc(UserCellTextDataFunc));
UserColumn.Title = Util.GS("User");
UserTreeView.AppendColumn(UserColumn);
UserColumn.Resizable = true;
CellRendererText statecr = new CellRendererText();
statecr.Xpad = 5;
TreeViewColumn stateColumn =
UserTreeView.AppendColumn(Util.GS("Role"),
statecr,
new TreeCellDataFunc(StateCellTextDataFunc));
stateColumn.Resizable = true;
stateColumn.MinWidth = 150;
CellRendererText accesscr = new CellRendererText();
accesscr.Xpad = 5;
TreeViewColumn accessColumn =
UserTreeView.AppendColumn(Util.GS("Rights"),
accesscr,
new TreeCellDataFunc(AccessCellTextDataFunc));
accessColumn.Resizable = true;
UserTreeView.Selection.Mode = SelectionMode.Multiple;
UserTreeView.Selection.Changed +=
new EventHandler(OnUserSelectionChanged);
UserTreeView.ButtonPressEvent += new ButtonPressEventHandler(
OnUserTreeViewButtonPressed);
UserTreeView.RowActivated += new RowActivatedHandler(
OnUserTreeViewRowActivated);
OwnerUserPixbuf =
new Gdk.Pixbuf(Util.ImagesPath("ifolder-user-owner16.png"));
CurrentUserPixbuf =
new Gdk.Pixbuf(Util.ImagesPath("ifolder-user-current16.png"));
NormalUserPixbuf =
new Gdk.Pixbuf(OwnerUserPixbuf.Colorspace, true,
OwnerUserPixbuf.BitsPerSample,
OwnerUserPixbuf.Width,
OwnerUserPixbuf.Height);
NormalUserPixbuf.Fill(0x00000000);
HBox buttonBox = new HBox();
buttonBox.Spacing = 10;
this.PackStart(buttonBox, false, false, 0);
HBox leftBox = new HBox();
leftBox.Spacing = 10;
buttonBox.PackStart(leftBox, false, false, 0);
HBox midBox = new HBox();
midBox.Spacing = 10;
buttonBox.PackStart(midBox, true, true, 0);
HBox rightBox = new HBox();
rightBox.Spacing = 10;
buttonBox.PackStart(rightBox, false, false, 0);
AddButton = new Button(Gtk.Stock.Add);
rightBox.PackStart(AddButton);
AddButton.Clicked += new EventHandler(OnAddUser);
RemoveButton = new Button(Gtk.Stock.Remove);
rightBox.PackStart(RemoveButton);
RemoveButton.Clicked += new EventHandler(OnRemoveUser);
AccessButton = new Button(Util.GS("R_ights..."));
leftBox.PackStart(AccessButton);
AccessButton.Clicked += new EventHandler(OnAccessClicked);
}
示例10: DelayedUpdateHistogram
private bool DelayedUpdateHistogram()
{
if (Photos.Length == 0)
return false;
IPhoto photo = Photos[0];
Gdk.Pixbuf hint = histogram_hint;
histogram_hint = null;
int max = histogram_expander.Allocation.Width;
try {
if (hint == null)
using (var img = ImageFile.Create (photo.DefaultVersion.Uri)) {
hint = img.Load (256, 256);
}
histogram_image.Pixbuf = histogram.Generate (hint, max);
hint.Dispose ();
} catch (System.Exception e) {
Hyena.Log.Debug (e.StackTrace);
using (Gdk.Pixbuf empty = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 256, 256)) {
empty.Fill (0x0);
histogram_image.Pixbuf = histogram.Generate (empty, max);
}
}
return false;
}
示例11: GetIcon
public static Gdk.Pixbuf GetIcon (this Counter c)
{
Gdk.Pixbuf cachedIcon;
if (icons.TryGetValue (c, out cachedIcon))
return cachedIcon;
Gdk.Color gcolor = c.GetColor ();
uint color = (((uint)gcolor.Red >> 8) << 24) | (((uint)gcolor.Green >> 8) << 16) | (((uint)gcolor.Blue >> 8) << 8) | 0xff;
cachedIcon = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 16, 16);
cachedIcon.Fill (color);
icons [c] = cachedIcon;
return cachedIcon;
}
示例12: SlideShow
public SlideShow (string name)
{
Tag tag;
if (name != null)
tag = Database.Tags.GetTagByName (name);
else {
int id = (int) Preferences.Get (Preferences.SCREENSAVER_TAG);
tag = Database.Tags.GetTagById (id);
}
Photo [] photos;
if (tag != null)
photos = Database.Photos.Query (new Tag [] { tag } );
else if ((int) Preferences.Get (Preferences.SCREENSAVER_TAG) == 0)
photos = db.Photos.Query (new Tag [] {});
else
photos = new Photo [0];
window = new XScreenSaverSlide ();
SetStyle (window);
if (photos.Length > 0) {
Array.Sort (photos, new Photo.RandomSort ());
Gdk.Pixbuf black = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, 1, 1);
black.Fill (0x00000000);
slideview = new SlideView (black, photos);
window.Add (slideview);
} else {
Gtk.HBox outer = new Gtk.HBox ();
Gtk.HBox hbox = new Gtk.HBox ();
Gtk.VBox vbox = new Gtk.VBox ();
outer.PackStart (new Gtk.Label (String.Empty));
outer.PackStart (vbox, false, false, 0);
vbox.PackStart (new Gtk.Label (String.Empty));
vbox.PackStart (hbox, false, false, 0);
hbox.PackStart (new Gtk.Image (Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog),
false, false, 0);
outer.PackStart (new Gtk.Label (String.Empty));
string msg;
string long_msg;
if (tag != null) {
msg = String.Format (Catalog.GetString ("No photos matching {0} found"), tag.Name);
long_msg = String.Format (Catalog.GetString ("The tag \"{0}\" is not applied to any photos. Try adding\n" +
"the tag to some photos or selecting a different tag in the\n" +
"F-Spot preference dialog."), tag.Name);
} else {
msg = Catalog.GetString ("Search returned no results");
long_msg = Catalog.GetString ("The tag F-Spot is looking for does not exist. Try\n" +
"selecting a different tag in the F-Spot preference\n" +
"dialog.");
}
Gtk.Label label = new Gtk.Label (msg);
hbox.PackStart (label, false, false, 0);
Gtk.Label long_label = new Gtk.Label (long_msg);
long_label.Markup = String.Format ("<small>{0}</small>", long_msg);
vbox.PackStart (long_label, false, false, 0);
vbox.PackStart (new Gtk.Label (String.Empty));
window.Add (outer);
SetStyle (label);
SetStyle (long_label);
//SetStyle (image);
}
window.ShowAll ();
}
示例13: CreateEmblemedPixbuf
public static Gdk.Pixbuf CreateEmblemedPixbuf(Gdk.Pixbuf icon, Gdk.Pixbuf emblem)
{
if (icon == null || emblem == null) return null;
if (icon.Width <= emblem.Width || icon.Height <= emblem.Height) return null;
Gdk.Pixbuf dest = new Gdk.Pixbuf(icon.Colorspace, true, icon.BitsPerSample, icon.Width, icon.Height);
dest.Fill(0x00000000);
try
{
icon.Composite(dest,
0,
0,
dest.Width,
dest.Height,
0,
0,
1.0,
1.0,
Gdk.InterpType.Bilinear,
255);
emblem.Composite(dest,
icon.Width - emblem.Width - 1,
icon.Height - emblem.Height - 1,
emblem.Width,
emblem.Height,
icon.Width - emblem.Width - 1,
icon.Height - emblem.Height - 1,
1.0,
1.0,
Gdk.InterpType.Bilinear,
255);
}
catch(Exception e)
{
dest = null;
}
return dest;
}
示例14: MergeIcons
//caller should check that sizes match
public static Gdk.Pixbuf MergeIcons (Gdk.Pixbuf icon1, Gdk.Pixbuf icon2)
{
if (icon2 == null)
return icon1;
if (icon1 == null)
return icon2;
Gdk.Pixbuf res = new Gdk.Pixbuf (icon1.Colorspace, icon1.HasAlpha, icon1.BitsPerSample, icon1.Width, icon1.Height);
res.Fill (0);
icon1.CopyArea (0, 0, icon1.Width, icon1.Height, res, 0, 0);
icon2.Composite (res, 0, 0, icon2.Width, icon2.Height, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 255);
var icon1_2x = Get2xIconVariant (icon1);
var icon2_2x = Get2xIconVariant (icon2);
if (icon1_2x != null || icon2_2x != null) {
if (icon1_2x == null)
icon1_2x = ScaleIcon (icon1, icon1.Width * 2, icon1.Height * 2);
if (icon2_2x == null)
icon2_2x = ScaleIcon (icon2, icon2.Width * 2, icon2.Height * 2);
var res2x = MergeIcons (icon1_2x, icon2_2x);
Set2xIconVariant (res, res2x);
}
return res;
}
示例15: 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;
//.........这里部分代码省略.........