本文整理汇总了C#中Pixbuf类的典型用法代码示例。如果您正苦于以下问题:C# Pixbuf类的具体用法?C# Pixbuf怎么用?C# Pixbuf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pixbuf类属于命名空间,在下文中一共展示了Pixbuf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ColorAdjust
public static unsafe Pixbuf ColorAdjust(Pixbuf src, double brightness, double contrast,
double hue, double saturation, int src_color, int dest_color)
{
Pixbuf adjusted = new Pixbuf (Colorspace.Rgb, src.HasAlpha, 8, src.Width, src.Height);
PixbufUtils.ColorAdjust (src, adjusted, brightness, contrast, hue, saturation, src_color, dest_color);
return adjusted;
}
示例2: MainWindow
public MainWindow () : base (Gtk.WindowType.Toplevel)
{
Build ();
fm = new FlowMeter (ConnectorPin.P1Pin03.Input());
fm.FlowChanged += FlowChanged;
fc = new FridgeController (4, ConnectorPin.P1Pin05.Output (), (float)spn_OffTemp.Value, (float)spn_OnTemp.Value);
//Setup building the beer image list.
try
{
var img = new Pixbuf ("8BitBeer.bmp");
BeerImages = new List<Pixbuf> ();
int beerwidth = 224;
int beerheight = 224;
//Builds list of beer images.
for (int i = 0; i < 11; i++)
{
BeerImages.Add(new Pixbuf (img, beerwidth * i,0, beerwidth, beerheight));
}
img_Beer.Pixbuf =BeerImages[0];
}
catch(Exception ex)
{
}
}
示例3: LoadScaled
public static Pixbuf LoadScaled (string path, int target_width, int target_height,
out int original_width, out int original_height)
{
Pixbuf pixbuf = new Pixbuf (f_load_scaled_jpeg (path, target_width, target_height,
out original_width, out original_height));
g_object_unref (pixbuf.Handle);
return pixbuf;
}
示例4: Fit
public static double Fit (Pixbuf pixbuf,
int dest_width, int dest_height,
bool upscale_smaller,
out int fit_width, out int fit_height)
{
return Fit (pixbuf.Width, pixbuf.Height,
dest_width, dest_height,
upscale_smaller,
out fit_width, out fit_height);
}
示例5: CreateEffect
unsafe static Pixbuf CreateEffect (int src_width, int src_height, ConvFilter filter, int radius, int offset, double opacity)
{
Pixbuf dest;
int x, y, i, j;
int src_x, src_y;
int suma;
int dest_width, dest_height;
int dest_rowstride;
byte* dest_pixels;
dest_width = src_width + 2 * radius + offset;
dest_height = src_height + 2 * radius + offset;
dest = new Pixbuf (Colorspace.Rgb, true, 8, dest_width, dest_height);
dest.Fill (0);
dest_pixels = (byte*) dest.Pixels;
dest_rowstride = dest.Rowstride;
for (y = 0; y < dest_height; y++)
{
for (x = 0; x < dest_width; x++)
{
suma = 0;
src_x = x - radius;
src_y = y - radius;
/* We don't need to compute effect here, since this pixel will be
* discarded when compositing */
if (src_x >= 0 && src_x < src_width && src_y >= 0 && src_y < src_height)
continue;
for (i = 0; i < filter.size; i++)
{
for (j = 0; j < filter.size; j++)
{
src_y = -(radius + offset) + y - (filter.size >> 1) + i;
src_x = -(radius + offset) + x - (filter.size >> 1) + j;
if (src_y < 0 || src_y >= src_height ||
src_x < 0 || src_x >= src_width)
continue;
suma += (int) (((byte)0xFF) * filter.data [i * filter.size + j]);
}
}
byte r = (byte) (suma * opacity);
dest_pixels [y * dest_rowstride + x * 4 + 3] = r;
}
}
return dest;
}
示例6: OnShown
protected override void OnShown()
{
base.OnShown ();
imagedata = new ImageData ();
formsimage1.DataBindings.Add ("ImageData", imagedata, "Pixdata",
false, DataSourceUpdateMode.OnPropertyChanged);
Pixbuf pixbuf = new Pixbuf ("logo.png");
Pixdata pixdata = new Pixdata ();
pixdata.FromPixbuf (pixbuf, false);
imagedata.Pixdata = pixdata.Serialize();
}
示例7: AddThumbnail
public void AddThumbnail (string path, Pixbuf pixbuf)
{
Thumbnail thumbnail = new Thumbnail ();
thumbnail.path = path;
thumbnail.pixbuf = pixbuf;
RemoveThumbnailForPath (path);
pixbuf_mru.Insert (0, thumbnail);
pixbuf_hash.Add (path, thumbnail);
MaybeExpunge ();
}
示例8: Serialize
public static byte [] Serialize (Pixbuf pixbuf)
{
Pixdata pixdata = new Pixdata ();
pixdata.FromPixbuf (pixbuf, true); // FIXME GTK# shouldn't this be a constructor or something?
uint data_length;
IntPtr raw_data = gdk_pixdata_serialize (ref pixdata, out data_length);
byte [] data = new byte [data_length];
Marshal.Copy (raw_data, data, 0, (int) data_length);
GLib.Marshaller.Free (raw_data);
return data;
}
示例9: About
public About(string version, string translators)
{
Glade.XML gladeXML;
gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "dialog_about", null);
gladeXML.Autoconnect(this);
/*
//crash for test purposes
string [] myCrash = {
"hello" };
Console.WriteLine("going to crash now intentionally");
Console.WriteLine(myCrash[1]);
*/
//put an icon to window
UtilGtk.IconWindow(dialog_about);
//put logo image
Pixbuf pixbuf;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + Constants.FileNameLogo);
image_logo.Pixbuf = pixbuf;
dialog_about_label_version.Text = version;
dialog_about_label_translators.Text = translators;
//white bg
dialog_about.ModifyBg(StateType.Normal, new Gdk.Color(0xff,0xff,0xff));
//put authors separated by commas
string authorsString = "";
string paragraph = "";
foreach (string singleAuthor in Constants.Authors) {
authorsString += paragraph;
authorsString += singleAuthor;
paragraph = "\n\n";
}
dialog_about_label_developers.Text = authorsString;
//put documenters separated by commas
string docsString = "";
paragraph = "";
foreach (string doc in Constants.Documenters) {
docsString += paragraph;
docsString += doc;
paragraph = "\n\n";
}
dialog_about_label_documenters.Text = docsString;
}
示例10: Serialize
public static byte [] Serialize (Pixbuf pixbuf)
{
Pixdata pixdata = new Pixdata ();
IntPtr raw_pixdata = pixdata.FromPixbuf (pixbuf, false); // FIXME GTK# shouldn't this be a constructor or something?
// It's probably because we need the IntPtr to free it afterwards
uint data_length;
IntPtr raw_data = gdk_pixdata_serialize (ref pixdata, out data_length);
byte [] data = new byte [data_length];
Marshal.Copy (raw_data, data, 0, (int) data_length);
GLib.Marshaller.Free (new IntPtr[] { raw_data, raw_pixdata });
return data;
}
示例11: GetThumbnailForPath
public Pixbuf GetThumbnailForPath (string path)
{
if (! pixbuf_hash.ContainsKey (path))
return null;
Thumbnail item = pixbuf_hash [path] as Thumbnail;
pixbuf_mru.Remove (item);
pixbuf_mru.Insert (0, item);
// Shallow Copy
Pixbuf copy = new Pixbuf (item.pixbuf, 0, 0,
item.pixbuf.Width,
item.pixbuf.Height);
PixbufUtils.CopyThumbnailOptions (item.pixbuf, copy);
return copy;
}
示例12: RatingWidget
public RatingWidget()
: base()
{
bigStar = Pixbuf.LoadFromResource ("bigstar.png");
littleStar = Pixbuf.LoadFromResource ("littlestar.png");
buttons = new Button[MAX_RATING];
for (int i=0; i < MAX_RATING; i++) {
Button button = new Button();
button.Relief = ReliefStyle.None;
button.CanFocus = false;
button.Data["position"] = i;
this.PackStart (button);
button.Clicked += OnStarClicked;
buttons[i] = button;
}
Value = 1;
}
示例13: Blur
public static Pixbuf Blur(Pixbuf src, int radius, ThreadProgressDialog dialog)
{
ImageSurface sourceSurface = Hyena.Gui.PixbufImageSurface.Create (src);
ImageSurface destinationSurface = new ImageSurface (Format.Rgb24, src.Width, src.Height);
// If we do it as a bunch of single lines (rectangles of one pixel) then we can give the progress
// here instead of going deeper to provide the feedback
for (int i=0; i < src.Height; i++) {
GaussianBlurEffect.RenderBlurEffect (sourceSurface, destinationSurface, new[] { new Gdk.Rectangle (0, i, src.Width, 1) }, radius);
if (dialog != null) {
// This only half of the entire process
double fraction = ((double)i / (double)(src.Height - 1)) * 0.75;
dialog.Fraction = fraction;
}
}
return destinationSurface.ToPixbuf ();
}
示例14: SplashWindow
public SplashWindow()
{
Glade.XML gladeXML;
gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "splash_window", null);
gladeXML.Autoconnect(this);
//put an icon to window
UtilGtk.IconWindow(splash_window);
fakeButtonCancel = new Gtk.Button();
FakeButtonCreated = true;
CancelButtonShow(false);
hideAllProgressbars();
//put logo image
Pixbuf pixbuf;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + Constants.FileNameLogo320);
image_logo.Pixbuf = pixbuf;
}
示例15: DialogImageTest
public DialogImageTest(EventType myEventType)
{
Glade.XML gladeXML;
gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "dialog_image_test", null);
gladeXML.Autoconnect(this);
//put an icon to window
UtilGtk.IconWindow(dialog_image_test);
label_name_description.Text = "<b>" + myEventType.Name + "</b>" + " - " + myEventType.Description;
label_name_description.UseMarkup = true;
if(myEventType.LongDescription.Length == 0)
scrolledwindow28.Hide();
else {
label_long_description.Text = myEventType.LongDescription;
label_long_description.UseMarkup = true;
}
Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + myEventType.ImageFileName);
image_test.Pixbuf = pixbuf;
}