"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Pinta.Core/Classes/Document.cs" between
pinta-1.7.tar.gz and pinta-1.7.1.tar.gz

About: Pinta is a powerful image drawing and editing program (modeled after Paint.NET).

Document.cs  (pinta-1.7):Document.cs  (pinta-1.7.1)
skipping to change at line 156 skipping to change at line 156
/// <summary> /// <summary>
/// Just the directory name, like "C:\MyPictures". /// Just the directory name, like "C:\MyPictures".
/// </summary> /// </summary>
public string Pathname { get; set; } public string Pathname { get; set; }
/// <summary> /// <summary>
/// Directory and file name, like "C:\MyPictures\dog.jpg". /// Directory and file name, like "C:\MyPictures\dog.jpg".
/// </summary> /// </summary>
public string PathAndFileName { public string PathAndFileName {
get { return System.IO.Path.Combine (Pathname, Filename); get {
} if (!string.IsNullOrEmpty(Pathname) && !string.Is
NullOrEmpty(Filename))
return System.IO.Path.Combine (Pathname,
Filename);
return string.Empty;
}
set { set {
if (string.IsNullOrEmpty (value)) { if (string.IsNullOrEmpty (value)) {
Pathname = string.Empty; Pathname = string.Empty;
Filename = string.Empty; Filename = string.Empty;
} else { } else {
Pathname = System.IO.Path.GetDirectoryNam e (value); Pathname = System.IO.Path.GetDirectoryNam e (value);
Filename = System.IO.Path.GetFileName (va lue); Filename = System.IO.Path.GetFileName (va lue);
} }
} }
} }
skipping to change at line 306 skipping to change at line 311
return CreateLayer (string.Format ("{0} {1}", Catalog.Get String ("Layer"), layer_name_int++), width, height); return CreateLayer (string.Format ("{0} {1}", Catalog.Get String ("Layer"), layer_name_int++), width, height);
} }
public UserLayer CreateLayer (string name) public UserLayer CreateLayer (string name)
{ {
return CreateLayer (name, ImageSize.Width, ImageSize.Heig ht); return CreateLayer (name, ImageSize.Width, ImageSize.Heig ht);
} }
public UserLayer CreateLayer(string name, int width, int height) public UserLayer CreateLayer(string name, int width, int height)
{ {
Cairo.ImageSurface surface = new Cairo.ImageSurface (Cair Cairo.ImageSurface surface = CairoExtensions.CreateImageS
o.Format.ARGB32, width, height); urface (Cairo.Format.ARGB32, width, height);
UserLayer layer = new UserLayer(surface) { Name = name }; UserLayer layer = new UserLayer(surface) { Name = name };
return layer; return layer;
} }
public void CreateSelectionLayer () public void CreateSelectionLayer ()
{ {
Layer old = selection_layer; Layer old = selection_layer;
selection_layer = CreateLayer (); selection_layer = CreateLayer ();
skipping to change at line 411 skipping to change at line 417
if (!ShowSelectionLayer) if (!ShowSelectionLayer)
return; return;
FinishPixelsHistoryItem hist = new FinishPixelsHistoryIte m (); FinishPixelsHistoryItem hist = new FinishPixelsHistoryIte m ();
hist.TakeSnapshot (); hist.TakeSnapshot ();
Layer layer = SelectionLayer; Layer layer = SelectionLayer;
using (Cairo.Context g = new Cairo.Context (CurrentUserLa yer.Surface)) { using (Cairo.Context g = new Cairo.Context (CurrentUserLa yer.Surface)) {
selection.Clip (g); selection.Clip (g);
layer.DrawWithOperator(g, layer.Surface, Operator .Source, 1.0f, true); layer.Draw (g);
} }
DestroySelectionLayer (); DestroySelectionLayer ();
Workspace.Invalidate (); Workspace.Invalidate ();
Workspace.History.PushNewItem (hist); Workspace.History.PushNewItem (hist);
} }
// Flatten image // Flatten image
public void FlattenImage () public void FlattenImage ()
skipping to change at line 466 skipping to change at line 472
public void FlipImageVertical () public void FlipImageVertical ()
{ {
foreach (var layer in UserLayers) foreach (var layer in UserLayers)
layer.FlipVertical (); layer.FlipVertical ();
Workspace.Invalidate (); Workspace.Invalidate ();
} }
public ImageSurface GetClippedLayer (int index) public ImageSurface GetClippedLayer (int index)
{ {
Cairo.ImageSurface surf = new Cairo.ImageSurface (Cairo.F ormat.Argb32, ImageSize.Width, ImageSize.Height); Cairo.ImageSurface surf = CairoExtensions.CreateImageSurf ace (Cairo.Format.Argb32, ImageSize.Width, ImageSize.Height);
using (Cairo.Context g = new Cairo.Context (surf)) { using (Cairo.Context g = new Cairo.Context (surf)) {
g.AppendPath(Selection.SelectionPath); g.AppendPath(Selection.SelectionPath);
g.Clip (); g.Clip ();
g.SetSource (UserLayers[index].Surface); g.SetSource (UserLayers[index].Surface);
g.Paint (); g.Paint ();
} }
return surf; return surf;
} }
/// <summary> /// <summary>
/// Gets the final pixel color for the given point, taking layers , opacity, and blend modes into account. /// Gets the final pixel color for the given point, taking layers , opacity, and blend modes into account.
/// </summary> /// </summary>
public ColorBgra GetComputedPixel (int x, int y) public ColorBgra GetComputedPixel (int x, int y)
{ {
using (var dst = new ImageSurface (Format.Argb32, 1, 1)) using (var dst = CairoExtensions.CreateImageSurface (Form
{ at.Argb32, 1, 1)) {
using (var g = new Context (dst)) { using (var g = new Context (dst)) {
foreach (var layer in GetLayersToPaint () ) { foreach (var layer in GetLayersToPaint () ) {
var color = layer.Surface.GetColo rBgraUnchecked (x, y).ToStraightAlpha ().ToCairoColor (); var color = layer.Surface.GetColo rBgraUnchecked (x, y).ToStraightAlpha ().ToCairoColor ();
g.SetBlendMode (layer.BlendMode); g.SetBlendMode (layer.BlendMode);
g.SetSourceColor (color); g.SetSourceColor (color);
g.Rectangle (dst.GetBounds ().ToC airoRectangle ()); g.Rectangle (dst.GetBounds ().ToC airoRectangle ());
g.PaintWithAlpha (layer.Opacity); g.PaintWithAlpha (layer.Opacity);
} }
} }
return dst.GetColorBgraUnchecked (0, 0); return dst.GetColorBgraUnchecked (0, 0);
} }
} }
public ImageSurface GetFlattenedImage () public ImageSurface GetFlattenedImage ()
{ {
// Create a new image surface // Create a new image surface
var surf = new Cairo.ImageSurface (Cairo.Format.Argb32, I mageSize.Width, ImageSize.Height); var surf = CairoExtensions.CreateImageSurface (Cairo.Form at.Argb32, ImageSize.Width, ImageSize.Height);
// Blend each visible layer onto our surface // Blend each visible layer onto our surface
foreach (var layer in GetLayersToPaint (include_tool_laye r: false)) { foreach (var layer in GetLayersToPaint (include_tool_laye r: false)) {
using (var g = new Context (surf)) using (var g = new Context (surf))
layer.Draw (g); layer.Draw (g);
} }
surf.MarkDirty (); surf.MarkDirty ();
return surf; return surf;
} }
 End of changes. 6 change blocks. 
9 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)