本文整理汇总了C#中Xwt.Backends.ImageDescription类的典型用法代码示例。如果您正苦于以下问题:C# ImageDescription类的具体用法?C# ImageDescription怎么用?C# ImageDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageDescription类属于Xwt.Backends命名空间,在下文中一共展示了ImageDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetImage
public void SetImage (ImageDescription image)
{
Gtk.ImageMenuItem it = item as Gtk.ImageMenuItem;
if (it == null)
return;
if (!image.IsNull) {
if (defImage == null)
item.StateChanged += ImageMenuItemStateChanged;
defImage = image;
selImage = new ImageDescription {
Backend = image.Backend,
Size = image.Size,
Alpha = image.Alpha,
Styles = image.Styles.Add ("sel")
};
var img = new ImageBox (context, image);
img.ShowAll ();
it.Image = img;
GtkWorkarounds.ForceImageOnMenuItem (it);
} else {
if (defImage.HasValue) {
item.StateChanged -= ImageMenuItemStateChanged;
defImage = selImage = null;
}
it.Image = null;
}
}
示例2: Create
public override object Create(ImageDescription img)
{
NSImage nimg = img.ToNSImage ();
return new ImagePatternInfo () {
Image = nimg
};
}
示例3: Draw
void Draw(object ctx, Rectangle bounds, ImageDescription idesc, Toolkit toolkit)
{
var c = new Context (ctx, toolkit);
if (idesc.Styles != StyleSet.Empty)
c.SetStyles (idesc.Styles);
c.Reset (null);
c.Save ();
c.GlobalAlpha = idesc.Alpha;
OnDraw (c, bounds);
c.Restore ();
}
示例4: SetImage
public void SetImage (ImageDescription image)
{
Gtk.ImageMenuItem it = item as Gtk.ImageMenuItem;
if (it == null)
return;
if (!image.IsNull) {
var img = new ImageBox (context, image);
img.ShowAll ();
it.Image = img;
GtkWorkarounds.ForceImageOnMenuItem (it);
}
else
it.Image = null;
}
示例5: Draw
public void Draw(ApplicationContext actx, SWM.DrawingContext dc, double scaleFactor, double x, double y, ImageDescription idesc)
{
if (drawCallback != null) {
DrawingContext c = new DrawingContext (dc, scaleFactor);
actx.InvokeUserCode (delegate {
drawCallback (c, new Rectangle (x, y, idesc.Size.Width, idesc.Size.Height), idesc, actx.Toolkit);
});
}
else {
if (idesc.Alpha < 1)
dc.PushOpacity (idesc.Alpha);
var f = GetBestFrame (actx, scaleFactor, idesc.Size.Width, idesc.Size.Height, false);
var bmpImage = f as BitmapSource;
// When an image is a single bitmap that doesn't have the same intrinsic size as the drawing size, dc.DrawImage makes a very poor job of down/up scaling it.
// Thus we handle this manually by using a TransformedBitmap to handle the conversion in a better way when it's needed.
var scaledWidth = idesc.Size.Width * scaleFactor;
var scaledHeight = idesc.Size.Height * scaleFactor;
if (bmpImage != null && (Math.Abs (bmpImage.PixelHeight - scaledHeight) > 0.001 || Math.Abs (bmpImage.PixelWidth - scaledWidth) > 0.001))
f = new TransformedBitmap (bmpImage, new ScaleTransform (scaledWidth / bmpImage.PixelWidth, scaledHeight / bmpImage.PixelHeight));
dc.DrawImage (f, new Rect (x, y, idesc.Size.Width, idesc.Size.Height));
if (idesc.Alpha < 1)
dc.Pop ();
}
}
示例6: SetIcon
public void SetIcon(ImageDescription icon)
{
Window.IconList = ((GtkImage)icon.Backend).Frames.Select (f => f.Pixbuf).ToArray ();
}
示例7: DrawImage
public override void DrawImage(object backend, ImageDescription img, double x, double y)
{
CairoContextBackend ctx = (CairoContextBackend)backend;
img.Alpha *= ctx.GlobalAlpha;
var pix = (Xwt.GtkBackend.GtkImage) img.Backend;
pix.Draw (ApplicationContext, ctx.Context, ctx.ScaleFactor, x, y, img);
}
示例8: SetIcon
public void SetIcon(ImageDescription imageBackend)
{
window.Icon = imageBackend.ToImageSource ();
}
示例9: DrawImage
public override void DrawImage(object backend, ImageDescription img, double x, double y)
{
var srcRect = new Rectangle (Point.Zero, img.Size);
var destRect = new Rectangle (x, y, img.Size.Width, img.Size.Height);
DrawImage (backend, img, srcRect, destRect);
}
示例10: Create
public override object Create (ImageDescription img)
{
return new ImagePattern (ApplicationContext, img);
}
示例11: Create
public abstract object Create (ImageDescription img);
示例12: SetImage
public void SetImage(ImageDescription imageBackend)
{
if (imageBackend.IsNull)
this.menuItem.Icon = null;
else
this.menuItem.Icon = new ImageBox (Context) { ImageSource = imageBackend };
}
示例13: RenderFrame
Gdk.Pixbuf RenderFrame(ApplicationContext actx, double scaleFactor, double width, double height)
{
using (var sf = new Cairo.ImageSurface (Cairo.Format.ARGB32, (int)(width * scaleFactor), (int)(height * scaleFactor)))
using (var ctx = new Cairo.Context (sf)) {
ImageDescription idesc = new ImageDescription () {
Alpha = 1,
Size = new Size (width * scaleFactor, height * scaleFactor)
};
Draw (actx, ctx, 1, 0, 0, idesc);
var f = new ImageFrame (ImageBuilderBackend.CreatePixbuf (sf), (int)width, (int)height);
AddFrame (f);
return f.Pixbuf;
}
}
示例14: DrawPixbuf
void DrawPixbuf(Cairo.Context ctx, Gdk.Pixbuf img, double x, double y, ImageDescription idesc)
{
ctx.Save ();
ctx.Translate (x, y);
ctx.Scale (idesc.Size.Width / (double)img.Width, idesc.Size.Height / (double)img.Height);
Gdk.CairoHelper.SetSourcePixbuf (ctx, img, 0, 0);
if (idesc.Alpha == 1)
ctx.Paint ();
else
ctx.PaintWithAlpha (idesc.Alpha);
ctx.Restore ();
}
示例15: SetIcon
public void SetIcon (ImageDescription icon)
{
}