本文整理汇总了C#中Gdk.Size类的典型用法代码示例。如果您正苦于以下问题:C# Size类的具体用法?C# Size怎么用?C# Size使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Size类属于Gdk命名空间,在下文中一共展示了Size类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ();
}
示例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;
}
示例3: ResizeHistoryItem
public ResizeHistoryItem (Size oldSize) : base ()
{
old_size = oldSize;
Icon = "Menu.Image.Resize.png";
Text = Catalog.GetString ("Resize Image");
}
示例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);
}
示例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;
}
}
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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 ();
}
示例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;
}
示例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);
}