本文整理汇总了C#中Gdk.Size类的典型用法代码示例。如果您正苦于以下问题:C# Size类的具体用法?C# Size怎么用?C# Size使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Size类属于Gdk命名空间,在下文中一共展示了Size类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Import
public void Import(string fileName)
{
Pixbuf bg;
// Handle any EXIF orientation flags
using (var fs = new FileStream (fileName, FileMode.Open, FileAccess.Read))
bg = new Pixbuf (fs);
bg = bg.ApplyEmbeddedOrientation ();
Size imagesize = new Size (bg.Width, bg.Height);
Document doc = PintaCore.Workspace.CreateAndActivateDocument (fileName, imagesize);
doc.HasFile = true;
doc.ImageSize = imagesize;
doc.Workspace.CanvasSize = imagesize;
Layer layer = doc.AddNewLayer (Path.GetFileName (fileName));
using (Cairo.Context g = new Cairo.Context (layer.Surface)) {
CairoHelper.SetSourcePixbuf (g, bg, 0, 0);
g.Paint ();
}
bg.Dispose ();
}
开发者ID:jobernolte,项目名称:Pinta,代码行数:26,代码来源:GdkPixbufFormat.cs
示例2: Undo
public override void Undo ()
{
// maintain the current scaling setting after the operation
double scale = PintaCore.Workspace.Scale;
Size swap = PintaCore.Workspace.ImageSize;
PintaCore.Workspace.ImageSize = old_size;
PintaCore.Workspace.CanvasSize = old_size;
old_size = swap;
base.Undo ();
if (RestoreSelection != null) {
DocumentSelection old = PintaCore.Workspace.ActiveDocument.Selection;
PintaCore.Workspace.ActiveDocument.Selection = RestoreSelection.Clone();
if (old != null) {
old.Dispose ();
}
PintaCore.Layers.ShowSelection = true;
} else {
PintaCore.Layers.ResetSelectionPath ();
}
PintaCore.Workspace.Invalidate ();
PintaCore.Workspace.Scale = scale;
}
开发者ID:msiyer,项目名称:Pinta,代码行数:31,代码来源:ResizeHistoryItem.cs
示例3: ResizeHistoryItem
public ResizeHistoryItem (Size oldSize) : base ()
{
old_size = oldSize;
Icon = "Menu.Image.Resize.png";
Text = Catalog.GetString ("Resize Image");
}
开发者ID:msiyer,项目名称:Pinta,代码行数:7,代码来源:ResizeHistoryItem.cs
示例4: Shell
public Shell()
: base("Mono Heap Profiler")
{
entries = new ActionEntry[] {
new ActionEntry ("FileMenu", null, "_File", null, null, null),
new ActionEntry ("OpenAction", Stock.Open, null, "<control>O", "Open a profile...", new EventHandler (OnOpen)),
new ActionEntry ("QuitAction", Stock.Quit, null, "<control>Q", "Quit the application", delegate { Application.Quit (); }),
};
DefaultSize = new Gdk.Size (700, 700);
DeleteEvent += delegate { Application.Quit (); };
main_box = new VBox (false, 0);
Add (main_box);
shell_commands = new ActionGroup ("TestActions");
shell_commands.Add (entries);
uim = new UIManager ();
uim.AddWidget += delegate (object obj, AddWidgetArgs args) {
args.Widget.Show ();
main_box.PackStart (args.Widget, false, true, 0);
};
uim.ConnectProxy += OnProxyConnect;
uim.InsertActionGroup (shell_commands, 0);
uim.AddUiFromResource ("shell-ui.xml");
AddAccelGroup (uim.AccelGroup);
sb = new Statusbar ();
main_box.PackEnd (sb, false, true, 0);
pager = new ShellPager (this);
main_box.PackEnd (pager, true, true, 0);
}
开发者ID:mono,项目名称:heap-prof,代码行数:35,代码来源:Shell.cs
示例5: GetEdges
/// <summary>
/// Enmarca una imagen.
/// </summary>
/// <param name="image">
/// La imagen a enmarcar.
/// </param>
/// <param name="pos">
/// La esquina de la zona a recortar.
/// </param>
/// <param name="size">
/// El tamaño de la zona a recortar.
/// </param>
protected void GetEdges(FloatBitmap image, out Point pos, out Size size)
{
pos = new Point(0,0);
size = new Size(image.Width, image.Height);
bool found =false;
for(int i = 0; i < image.Width && !found; i++)
{
for(int j = 0; j < image.Height && !found; j++)
{
if (image[i, j] != FloatBitmap.White)
{
pos.X = i-1;
found = true;
}
}
}
found =false;
for(int i = image.Width-1; i >=0 && !found; i--)
{
for(int j = 0; j < image.Height && !found; j++)
{
if (image[i, j] != FloatBitmap.White)
{
size.Width = i - pos.X +2 ;
found = true;
}
}
}
found =false;
for(int j = 0; j < image.Height && !found; j++)
{
for(int i = 0; i < image.Width&& !found; i++)
{
if (image[i, j] != FloatBitmap.White)
{
pos.Y = j-1;
found = true;
}
}
}
found =false;
for(int j = image.Height-1; j >=0 && !found; j--)
{
for(int i = 0; i < image.Width && !found; i++)
{
if (image[i, j] != FloatBitmap.White)
{
size.Height = j - pos.Y +2;
found = true;
}
}
}
}
开发者ID:coler706,项目名称:mathtextrecognizer,代码行数:70,代码来源:BitmapSegmenter.cs
示例6: ApplyTransform
public override void ApplyTransform (Matrix xform, Size new_size)
{
base.ApplyTransform (xform, new_size);
foreach (ReEditableLayer rel in ReEditableLayers)
{
if (rel.IsLayerSetup)
rel.Layer.ApplyTransform (xform, new_size);
}
}
开发者ID:msiyer,项目名称:Pinta,代码行数:10,代码来源:UserLayer.cs
示例7: Initialize
public void Initialize(Size sourceSize, Size destinationSize)
{
if (sourceSize == source_size && destinationSize == destination_size)
return;
source_size = sourceSize;
destination_size = destinationSize;
scale_factor = new ScaleFactor (source_size.Width, destination_size.Width);
generated = false;
}
开发者ID:Kharevich,项目名称:Pinta,代码行数:11,代码来源:CanvasRenderer.cs
示例8: Init
private void Init()
{
Events = EventMask.PointerMotionMask |
EventMask.ButtonPressMask |
EventMask.ButtonReleaseMask;
_imContext = new Gtk.IMMulticontext();
_imContext.Commit += ImContext_Commit;
DoubleBuffered = false;
Realize();
_lastClientSize = ClientSize;
}
开发者ID:akrisiun,项目名称:Avalonia,代码行数:11,代码来源:WindowImpl.cs
示例9: ImageWidget
public ImageWidget(Pixbuf pixbuf)
{
resizingX = resizingY = false;
this.CanFocus = true;
this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask;
this.child = new Gtk.Image ();
this.child.Pixbuf = pixbuf;
originalPixbuf = pixbuf;
Add (child);
imageSize = child.Allocation.Size;
}
开发者ID:binarytemple,项目名称:tomboy-image,代码行数:11,代码来源:ImageWidget.cs
示例10: Rotate
public void Rotate (double angle, Size new_size)
{
double radians = (angle / 180d) * Math.PI;
var old_size = PintaCore.Workspace.ImageSize;
var xform = new Matrix ();
xform.Translate (new_size.Width / 2.0, new_size.Height / 2.0);
xform.Rotate (radians);
xform.Translate (-old_size.Width / 2.0, -old_size.Height / 2.0);
ApplyTransform (xform, new_size);
}
开发者ID:msiyer,项目名称:Pinta,代码行数:12,代码来源:UserLayer.cs
示例11: Apply
/// <summary>
/// Provides a default implementation for performing dst = F(lhs, rhs) over some rectangle of interest.
/// </summary>
/// <param name="dst">The Surface to write pixels to.</param>
/// <param name="dstOffset">The pixel offset that defines the upper-left of the rectangle-of-interest for the dst Surface.</param>
/// <param name="lhs">The Surface to read pixels from for the lhs parameter given to the method <b>ColorBgra Apply(ColorBgra, ColorBgra)</b>.</param>
/// <param name="lhsOffset">The pixel offset that defines the upper-left of the rectangle-of-interest for the lhs Surface.</param>
/// <param name="rhs">The Surface to read pixels from for the rhs parameter given to the method <b>ColorBgra Apply(ColorBgra, ColorBgra)</b></param>
/// <param name="rhsOffset">The pixel offset that defines the upper-left of the rectangle-of-interest for the rhs Surface.</param>
/// <param name="roiSize">The size of the rectangles-of-interest for all Surfaces.</param>
public void Apply (Cairo.ImageSurface dst, Point dstOffset,
Cairo.ImageSurface lhs, Point lhsOffset,
Cairo.ImageSurface rhs, Point rhsOffset,
Size roiSize)
{
// Bounds checking only enabled in Debug builds.
#if DEBUG
// Create bounding rectangles for each Surface
Rectangle dstRect = new Rectangle (dstOffset, roiSize);
Rectangle lhsRect = new Rectangle (lhsOffset, roiSize);
Rectangle rhsRect = new Rectangle (rhsOffset, roiSize);
// Clip those rectangles to those Surface's bounding rectangles
Rectangle dstClip = Rectangle.Intersect (dstRect, dst.GetBounds ());
Rectangle lhsClip = Rectangle.Intersect (lhsRect, lhs.GetBounds ());
Rectangle rhsClip = Rectangle.Intersect (rhsRect, rhs.GetBounds ());
// If any of those Rectangles actually got clipped, then throw an exception
if (dstRect != dstClip) {
throw new ArgumentOutOfRangeException ("roiSize", "Destination roi out of bounds");
}
if (lhsRect != lhsClip) {
throw new ArgumentOutOfRangeException ("roiSize", "lhs roi out of bounds");
}
if (rhsRect != rhsClip) {
throw new ArgumentOutOfRangeException ("roiSize", "rhs roi out of bounds");
}
#endif
// Cache the width and height properties
int width = roiSize.Width;
int height = roiSize.Height;
// Do the work.
unsafe {
for (int row = 0; row < height; ++row) {
ColorBgra* dstPtr = dst.GetPointAddress (dstOffset.X, dstOffset.Y + row);
ColorBgra* lhsPtr = lhs.GetPointAddress (lhsOffset.X, lhsOffset.Y + row);
ColorBgra* rhsPtr = rhs.GetPointAddress (rhsOffset.X, rhsOffset.Y + row);
Apply (dstPtr, lhsPtr, rhsPtr, width);
}
}
}
开发者ID:msiyer,项目名称:Pinta,代码行数:56,代码来源:BinaryPixelOp.cs
示例12: Browser
public Browser(string catalog_dir)
: base("Documentation Browser Sample")
{
DefaultSize = new Size (600, 400);
Gtk.Paned paned = new Gtk.HPaned ();
Gtk.ScrolledWindow sw = new ScrolledWindow ();
DocTree tree = new DocTree (catalog_dir);
sw.Add (tree);
paned.Add1 (sw);
sw = new ScrolledWindow ();
DocView view = new DocView (tree);
sw.AddWithViewport (view);
paned.Add2 (sw);
paned.Position = 250;
paned.ShowAll ();
Add (paned);
}
开发者ID:mono,项目名称:monodoc-widgets,代码行数:17,代码来源:Browser.cs
示例13: Import
public void Import(LayerManager layers, string fileName)
{
Pixbuf bg = new Pixbuf (fileName);
Size imagesize = new Size (bg.Width, bg.Height);
PintaCore.Workspace.CreateAndActivateDocument (fileName, imagesize);
PintaCore.Workspace.ActiveDocument.HasFile = true;
PintaCore.Workspace.ActiveDocument.ImageSize = imagesize;
PintaCore.Workspace.ActiveWorkspace.CanvasSize = imagesize;
Layer layer = layers.AddNewLayer (Path.GetFileName (fileName));
using (Cairo.Context g = new Cairo.Context (layer.Surface)) {
CairoHelper.SetSourcePixbuf (g, bg, 0, 0);
g.Paint ();
}
bg.Dispose ();
}
开发者ID:linuxmhall,项目名称:Pinta,代码行数:19,代码来源:GdkPixbufFormat.cs
示例14: Redo
public override void Redo()
{
// maintain the current scaling setting after the operation
double scale = PintaCore.Workspace.Scale;
Size swap = PintaCore.Workspace.ImageSize;
PintaCore.Workspace.ImageSize = old_size;
PintaCore.Workspace.CanvasSize = old_size;
old_size = swap;
base.Redo ();
PintaCore.Layers.ResetSelectionPath ();
PintaCore.Workspace.Invalidate ();
PintaCore.Workspace.Scale = scale;
}
开发者ID:bodicsek,项目名称:Pinta,代码行数:19,代码来源:ResizeHistoryItem.cs
示例15: ConfiguratorDialog
/// <summary>
/// Initializes a new instance of the <see cref="ConfiguratorDialog"/> class.
/// </summary>
/// <param name="treeStore">The tree store.</param>
/// <param name="dialogTitle">The dialog title.</param>
/// <param name="parentWindow">The parent window.</param>
/// <param name="flags">The flags.</param>
/// <param name="buttonData">The button data.</param>
public ConfiguratorDialog(
TreeStore treeStore,
string dialogTitle = "Configuration",
Window parentWindow = null,
DialogFlags flags = DialogFlags.DestroyWithParent,
params object[] buttonData)
: base(dialogTitle, parentWindow, flags, buttonData)
{
// Save the various parameters as member variables.
if (treeStore == null)
{
throw new ArgumentNullException("treeStore");
}
// Set up the widget.
InitializeWidget(treeStore);
// Set up the default
DefaultSize = new Size(400, 250);
}
开发者ID:dmoonfire,项目名称:mfgames-gtkext-cil,代码行数:28,代码来源:ConfiguratorDialog.cs
示例16: OnConfigureEvent
void OnConfigureEvent(object o, Gtk.ConfigureEventArgs args)
{
var evnt = args.Event;
args.RetVal = true;
var newSize = new Size(evnt.Width, evnt.Height);
if (newSize != _lastClientSize)
{
Resized(newSize);
_lastClientSize = newSize;
}
var newPosition = new Point(evnt.X, evnt.Y);
if (newPosition != _lastPosition)
{
PositionChanged(newPosition);
_lastPosition = newPosition;
}
}
开发者ID:jkoritzinsky,项目名称:Avalonia,代码行数:20,代码来源:WindowImpl.cs
示例17: Window
public Window (ComparisonInfo info) : base ("ilContrast Assembly Comparison Tool")
{
DefaultSize = new Size (450, 450);
main_vbox = new VBox (false, 0);
AddActionUI ();
#if USE_GECKO
browser = new Gecko.WebControl ();
main_vbox.PackStart (browser, true, true, 0);
#else
web_view = new WebKit.WebView ();
ScrolledWindow sw = new ScrolledWindow ();
sw.Add (web_view);
main_vbox.PackStart (sw, true, true, 0);
#endif
statusbar = new Statusbar ();
main_vbox.PackStart (statusbar, false, false, 0);
Add (main_vbox);
main_vbox.ShowAll ();
first_show = true;
this.info = info;
}
开发者ID:col42dev,项目名称:mono-tools,代码行数:22,代码来源:Window.cs
示例18: DrawDrawable
public void DrawDrawable( Gdk.GC gc, Drawable src, Point src_location, Point dest_location, Size sz )
{
this.DrawDrawable( gc, src, src_location.X, src_location.Y, dest_location.X, dest_location.Y, sz.Width, sz.Height );
}
开发者ID:tizianomanni,项目名称:holly-gtk-widgets,代码行数:4,代码来源:ExDrawable.cs
示例19: SetRequisition
private void SetRequisition(Size size)
{
Requisition req = new Requisition ();
req.Width = size.Width;
req.Height = size.Height;
Requisition = req;
QueueResize ();
}
开发者ID:rini18,项目名称:Pinta,代码行数:9,代码来源:PintaCanvas.cs
示例20: WindowImpl
public WindowImpl()
: base(Gtk.WindowType.Toplevel)
{
DefaultSize = new Gdk.Size(900, 480);
Init();
}
开发者ID:JackWangCUMT,项目名称:Perspex,代码行数:6,代码来源:WindowImpl.cs
注:本文中的Gdk.Size类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论