Layer.cs (pinta-1.7) | : | Layer.cs (pinta-1.7.1) | ||
---|---|---|---|---|
skipping to change at line 162 | skipping to change at line 162 | |||
if (opacity >= 1.0) | if (opacity >= 1.0) | |||
ctx.Paint (); | ctx.Paint (); | |||
else | else | |||
ctx.PaintWithAlpha (opacity); | ctx.PaintWithAlpha (opacity); | |||
ctx.Restore (); | ctx.Restore (); | |||
} | } | |||
public virtual void ApplyTransform (Matrix xform, Size new_size) | public virtual void ApplyTransform (Matrix xform, Size new_size) | |||
{ | { | |||
var old_size = PintaCore.Workspace.ImageSize; | var old_size = PintaCore.Workspace.ImageSize; | |||
var dest = new ImageSurface (Format.ARGB32, new_size.Widt | var dest = CairoExtensions.CreateImageSurface (Format.ARG | |||
h, new_size.Height); | B32, new_size.Width, new_size.Height); | |||
using (var g = new Context (dest)) | using (var g = new Context (dest)) | |||
{ | { | |||
g.Transform (xform); | g.Transform (xform); | |||
g.SetSource (Surface); | g.SetSource (Surface); | |||
g.Paint (); | g.Paint (); | |||
} | } | |||
Surface old = Surface; | Surface old = Surface; | |||
Surface = dest; | Surface = dest; | |||
old.Dispose (); | old.Dispose (); | |||
skipping to change at line 220 | skipping to change at line 221 | |||
g.SetSource (dest); | g.SetSource (dest); | |||
g.Paint (); | g.Paint (); | |||
} | } | |||
(dest as IDisposable).Dispose (); | (dest as IDisposable).Dispose (); | |||
} | } | |||
public virtual void Resize (int width, int height) | public virtual void Resize (int width, int height) | |||
{ | { | |||
ImageSurface dest = new ImageSurface (Format.Argb32, widt | ImageSurface dest = CairoExtensions.CreateImageSurface (F | |||
h, height); | ormat.Argb32, width, height); | |||
Pixbuf pb = Surface.ToPixbuf(); | Pixbuf pb = Surface.ToPixbuf(); | |||
Pixbuf pbScaled = pb.ScaleSimple (width, height, InterpTy pe.Bilinear); | Pixbuf pbScaled = pb.ScaleSimple (width, height, InterpTy pe.Bilinear); | |||
using (Context g = new Context (dest)) { | using (Context g = new Context (dest)) { | |||
CairoHelper.SetSourcePixbuf (g, pbScaled, 0, 0); | CairoHelper.SetSourcePixbuf (g, pbScaled, 0, 0); | |||
g.Paint (); | g.Paint (); | |||
} | } | |||
(Surface as IDisposable).Dispose (); | (Surface as IDisposable).Dispose (); | |||
(pb as IDisposable).Dispose (); | (pb as IDisposable).Dispose (); | |||
(pbScaled as IDisposable).Dispose (); | (pbScaled as IDisposable).Dispose (); | |||
Surface = dest; | Surface = dest; | |||
} | } | |||
public virtual void ResizeCanvas (int width, int height, Anchor a nchor) | public virtual void ResizeCanvas (int width, int height, Anchor a nchor) | |||
{ | { | |||
ImageSurface dest = new ImageSurface (Format.Argb32, widt h, height); | ImageSurface dest = CairoExtensions.CreateImageSurface (F ormat.Argb32, width, height); | |||
int delta_x = Surface.Width - width; | int delta_x = Surface.Width - width; | |||
int delta_y = Surface.Height - height; | int delta_y = Surface.Height - height; | |||
using (Context g = new Context (dest)) { | using (Context g = new Context (dest)) { | |||
switch (anchor) { | switch (anchor) { | |||
case Anchor.NW: | case Anchor.NW: | |||
g.SetSourceSurface (Surface, 0, 0 ); | g.SetSourceSurface (Surface, 0, 0 ); | |||
break; | break; | |||
case Anchor.N: | case Anchor.N: | |||
skipping to change at line 282 | skipping to change at line 284 | |||
g.Paint (); | g.Paint (); | |||
} | } | |||
(Surface as IDisposable).Dispose (); | (Surface as IDisposable).Dispose (); | |||
Surface = dest; | Surface = dest; | |||
} | } | |||
public virtual void Crop (Gdk.Rectangle rect, Path selection) | public virtual void Crop (Gdk.Rectangle rect, Path selection) | |||
{ | { | |||
ImageSurface dest = new ImageSurface (Format.Argb32, rect .Width, rect.Height); | ImageSurface dest = CairoExtensions.CreateImageSurface (F ormat.Argb32, rect.Width, rect.Height); | |||
using (Context g = new Context (dest)) { | using (Context g = new Context (dest)) { | |||
// Move the selected content to the upper left | // Move the selected content to the upper left | |||
g.Translate (-rect.X, -rect.Y); | g.Translate (-rect.X, -rect.Y); | |||
g.Antialias = Antialias.None; | g.Antialias = Antialias.None; | |||
// Optionally, respect the given path. | // Optionally, respect the given path. | |||
if (selection != null) | if (selection != null) | |||
{ | { | |||
g.AppendPath (selection); | g.AppendPath (selection); | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 8 lines changed or added |