GdkExtensions.cs (pinta-1.7) | : | GdkExtensions.cs (pinta-1.7.1) | ||
---|---|---|---|---|
skipping to change at line 129 | skipping to change at line 129 | |||
} | } | |||
/// <summary> | /// <summary> | |||
/// Filters out all modifier keys except Ctrl/Shift/Alt. This pre vents Caps Lock, Num Lock, etc | /// Filters out all modifier keys except Ctrl/Shift/Alt. This pre vents Caps Lock, Num Lock, etc | |||
/// from appearing as active modifier keys. | /// from appearing as active modifier keys. | |||
/// </summary> | /// </summary> | |||
public static ModifierType FilterModifierKeys (this ModifierType current_state) | public static ModifierType FilterModifierKeys (this ModifierType current_state) | |||
{ | { | |||
var state = Gdk.ModifierType.None; | var state = Gdk.ModifierType.None; | |||
state |= (current_state & Gdk.ModifierType.ControlMask); | state |= (current_state & Gdk.ModifierType.ControlMask); | |||
state |= (current_state & Gdk.ModifierType.ShiftMask); | state |= (current_state & Gdk.ModifierType.ShiftMask); | |||
state |= (current_state & Gdk.ModifierType.Mod1Mask); | state |= (current_state & Gdk.ModifierType.Mod1Mask); | |||
state |= (current_state & Gdk.ModifierType.MetaMask); // | ||||
Command key on macOS. | ||||
return state; | return state; | |||
} | } | |||
public static Cairo.PointD GetPoint (this EventButton ev) | public static Cairo.PointD GetPoint (this EventButton ev) | |||
{ | { | |||
return new Cairo.PointD (ev.X, ev.Y); | return new Cairo.PointD (ev.X, ev.Y); | |||
} | } | |||
/// <summary> | /// <summary> | |||
skipping to change at line 161 | skipping to change at line 162 | |||
/// The implementation of Rectangle.Right was changed in 2.12.11 to fix an off-by-one error, | /// The implementation of Rectangle.Right was changed in 2.12.11 to fix an off-by-one error, | |||
/// and this function provides the newer behaviour for backwards compatibility with older versions. | /// and this function provides the newer behaviour for backwards compatibility with older versions. | |||
/// </summary> | /// </summary> | |||
public static int GetRight(this Rectangle r) | public static int GetRight(this Rectangle r) | |||
{ | { | |||
return r.X + r.Width - 1; | return r.X + r.Width - 1; | |||
} | } | |||
public static Cairo.Surface ToSurface (this Pixbuf pixbuf) | public static Cairo.Surface ToSurface (this Pixbuf pixbuf) | |||
{ | { | |||
var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, pixbuf.Wi dth, pixbuf.Height); | var surface = CairoExtensions.CreateImageSurface (Cairo.Format.ARGB3 2, pixbuf.Width, pixbuf.Height); | |||
using (var g = new Cairo.Context (surface)) { | using (var g = new Cairo.Context (surface)) { | |||
Gdk.CairoHelper.SetSourcePixbuf (g, pixbuf, 0, 0); | Gdk.CairoHelper.SetSourcePixbuf (g, pixbuf, 0, 0); | |||
g.Paint (); | g.Paint (); | |||
} | } | |||
return surface; | return surface; | |||
} | } | |||
public static Pixbuf CreateColorSwatch (int size, Color color) | public static Pixbuf CreateColorSwatch (int size, Color color) | |||
{ | { | |||
using (var pmap = new Pixmap (Screen.Default.RootWindow, size, size) ) | using (var pmap = new Pixmap (Screen.Default.RootWindow, size, size) ) | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 7 lines changed or added |