本文整理汇总了C#中Xwt.Backends.ImageDescription类的典型用法代码示例。如果您正苦于以下问题:C# ImageDescription类的具体用法?C# ImageDescription怎么用?C# ImageDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageDescription类属于Xwt.Backends命名空间,在下文中一共展示了ImageDescription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:TheBrainTech,项目名称:xwt,代码行数:27,代码来源:MenuItemBackend.cs
示例2: Create
public override object Create(ImageDescription img)
{
NSImage nimg = img.ToNSImage ();
return new ImagePatternInfo () {
Image = nimg
};
}
开发者ID:jbeaurain,项目名称:xwt,代码行数:7,代码来源:ImagePatternBackendHandler.cs
示例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 ();
}
开发者ID:akrisiun,项目名称:xwt,代码行数:11,代码来源:DrawingImage.cs
示例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;
}
开发者ID:m13253,项目名称:xwt,代码行数:14,代码来源:MenuItemBackend.cs
示例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 ();
}
}
开发者ID:RandallFlagg,项目名称:xwt,代码行数:29,代码来源:ImageHandler.cs
示例6: SetIcon
public void SetIcon(ImageDescription icon)
{
Window.IconList = ((GtkImage)icon.Backend).Frames.Select (f => f.Pixbuf).ToArray ();
}
开发者ID:m13253,项目名称:xwt,代码行数:4,代码来源:WindowFrameBackend.cs
示例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);
}
开发者ID:nirenyang,项目名称:xwt,代码行数:9,代码来源:CairoContextBackendHandler.cs
示例8: SetIcon
public void SetIcon(ImageDescription imageBackend)
{
window.Icon = imageBackend.ToImageSource ();
}
开发者ID:Jeha,项目名称:xwt,代码行数:4,代码来源:WindowFrameBackend.cs
示例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);
}
开发者ID:jbeaurain,项目名称:xwt,代码行数:6,代码来源:ContextBackendHandler.cs
示例10: Create
public override object Create (ImageDescription img)
{
return new ImagePattern (ApplicationContext, img);
}
开发者ID:m13253,项目名称:xwt,代码行数:4,代码来源:ImagePatternBackendHandler.cs
示例11: Create
public abstract object Create (ImageDescription img);
开发者ID:m13253,项目名称:xwt,代码行数:1,代码来源:ImagePatternBackendHandler.cs
示例12: SetImage
public void SetImage(ImageDescription imageBackend)
{
if (imageBackend.IsNull)
this.menuItem.Icon = null;
else
this.menuItem.Icon = new ImageBox (Context) { ImageSource = imageBackend };
}
开发者ID:Gaushick,项目名称:xwt,代码行数:7,代码来源:MenuItemBackend.cs
示例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;
}
}
开发者ID:neiz,项目名称:xwt,代码行数:14,代码来源:ImageHandler.cs
示例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 ();
}
开发者ID:neiz,项目名称:xwt,代码行数:12,代码来源:ImageHandler.cs
示例15: SetIcon
public void SetIcon (ImageDescription icon)
{
}
开发者ID:TheBrainTech,项目名称:xwt,代码行数:3,代码来源:WindowBackend.cs
示例16: DrawImage
public override void DrawImage(object backend, ImageDescription img, Xwt.Rectangle srcRect, Xwt.Rectangle destRect)
{
var ctx = (VectorBackend)backend;
ctx.Commands.Add (DrawingCommand.DrawImage2);
ctx.Images.Add (img);
ctx.Rectangles.Add (srcRect);
ctx.Rectangles.Add (destRect);
}
开发者ID:nite2006,项目名称:xwt,代码行数:8,代码来源:VectorImage.cs
示例17: Create
public override object Create(ImageDescription img)
{
return new ImagePatternBackend () {
Image = img
};
}
开发者ID:jbeaurain,项目名称:xwt,代码行数:6,代码来源:ImagePatternBackendHandler.cs
示例18: DrawImage
public override void DrawImage(object backend, ImageDescription img, double x, double y)
{
var c = (DrawingContext) backend;
WpfImage bmp = (WpfImage) img.Backend;
bmp.Draw (ApplicationContext, c.Context, c.ScaleFactor, x, y, img);
}
开发者ID:jbeaurain,项目名称:xwt,代码行数:7,代码来源:ContextBackendHandler.cs
示例19: ImagePattern
public ImagePattern (ApplicationContext actx, ImageDescription im)
{
this.actx = actx;
this.image = im;
}
开发者ID:m13253,项目名称:xwt,代码行数:5,代码来源:ImagePatternBackendHandler.cs
示例20: RenderFrame
Gdk.Pixbuf RenderFrame (ApplicationContext actx, double scaleFactor, double width, double height)
{
var swidth = Math.Max ((int)(width * scaleFactor), 1);
var sheight = Math.Max ((int)(height * scaleFactor), 1);
using (var sf = new Cairo.ImageSurface (Cairo.Format.ARGB32, swidth, sheight))
using (var ctx = new Cairo.Context (sf)) {
ImageDescription idesc = new ImageDescription () {
Alpha = 1,
Size = new Size (width, height)
};
ctx.Scale (scaleFactor, scaleFactor);
Draw (actx, ctx, scaleFactor, 0, 0, idesc);
var f = new ImageFrame (ImageBuilderBackend.CreatePixbuf (sf), Math.Max((int)width,1), Math.Max((int)height,1), true);
AddFrame (f);
return f.Pixbuf;
}
}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:18,代码来源:ImageHandler.cs
注:本文中的Xwt.Backends.ImageDescription类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论