[calligra/calligra/2.9] krita: Added Trim to Image Size action

Dmitry Kazakov dimula73 at gmail.com
Fri Jul 17 21:13:02 UTC 2015


Git commit 30d614e8159d1752cf965e7018bf84fd05cdba75 by Dmitry Kazakov.
Committed on 17/07/2015 at 21:12.
Pushed by dkazakov into branch 'calligra/2.9'.

Added Trim to Image Size action

This action removes all the layers content outside
image bounds. This is needed in cases:

1) To make layer preview showing correct values
2) To reduce the size of the saved .kra and .psd files

The user can assign any shortcuts to this action.

Thanks David Revoy for creating an icon for this action!

CC:kimageshop at kde.org

M  +1    -0    krita/krita.action
M  +2    -1    krita/krita.rc
M  +2    -1    krita/pics/CMakeLists.txt
A  +-    --    krita/pics/dark_trim-to-image.png
A  +-    --    krita/pics/light_trim-to-image.png
A  +225  -0    krita/pics/svg/dark_trim-to-image.svg
A  +222  -0    krita/pics/svg/light_trim-to-image.svg
M  +13   -0    krita/ui/kis_layer_manager.cc
M  +1    -0    krita/ui/kis_layer_manager.h

http://commits.kde.org/calligra/30d614e8159d1752cf965e7018bf84fd05cdba75

diff --git a/krita/krita.action b/krita/krita.action
index ed289ef..8320fac 100644
--- a/krita/krita.action
+++ b/krita/krita.action
@@ -96,6 +96,7 @@
     <Action name="rasterize_layer" icon="" text="Rasterize Layer" whatsThis="" toolTip="Rasterize Layer" iconText="Rasterize Layer" shortcut="" defaultShortcut="" isCheckable="false" statusTip=""/>
     <Action name="save_groups_as_images" icon="document-save" text="Save Group Layers..." whatsThis="" toolTip="Save Group Layers" iconText="Save Group Layers" shortcut="" defaultShortcut="" isCheckable="false" statusTip=""/>
     <Action name="resizeimagetolayer" icon="" text="Size Canvas to Size of Current Layer" whatsThis="" toolTip="Size Canvas to Size of Current Layer" iconText="Size Canvas to Size of Current Layer" shortcut="" defaultShortcut="" isCheckable="false" statusTip=""/>
+    <Action name="trim_to_image" icon="light_trim-to-image" text="Trim to Image Size" whatsThis="" toolTip="Trim to Image Size" iconText="Trim to Image Size" shortcut="" defaultShortcut="" isCheckable="false" statusTip=""/>
     <Action name="mirrorNodeX" icon="object-flip-horizontal" text="Mirror Layer Horizontally" whatsThis="" toolTip="Mirror Layer Horizontally" iconText="Mirror Layer Horizontally" shortcut="" defaultShortcut="" isCheckable="false" statusTip=""/>
     <Action name="mirrorNodeY" icon="object-flip-vertical" text="Mirror Layer Vertically" whatsThis="" toolTip="Mirror Layer Vertically" iconText="Mirror Layer Vertically" shortcut="" defaultShortcut="" isCheckable="false" statusTip=""/>
     <Action name="activateNextLayer" icon="" text="Activate next layer" whatsThis="" toolTip="Activate next layer" iconText="Activate next layer" shortcut="PgUp" defaultShortcut="PgUp" isCheckable="false" statusTip=""/>
diff --git a/krita/krita.rc b/krita/krita.rc
index c76e94f..59118b7 100644
--- a/krita/krita.rc
+++ b/krita/krita.rc
@@ -2,7 +2,7 @@
 <kpartgui xmlns="http://www.kde.org/standards/kxmlgui/1.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 name="Krita"
-version="73"
+version="74"
 xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0  http://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd">
   <MenuBar>
     <Menu name="file" noMerge="1">
@@ -118,6 +118,7 @@ xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0  http://www.kde.org
       <Action name="imagecolorspaceconversion"/>
       <Action name="duplicate_image"/>
       <Separator/>
+      <Action name="trim_to_image"/>
       <Action name="resizeimagetolayer"/>
       <Action name="resizeimagetoselection"/>
       <Separator/>
diff --git a/krita/pics/CMakeLists.txt b/krita/pics/CMakeLists.txt
index 5ca6b3c..595917c 100644
--- a/krita/pics/CMakeLists.txt
+++ b/krita/pics/CMakeLists.txt
@@ -93,6 +93,7 @@ dark_selection-mode_mask.png
 dark_symmetry-horizontal.png
 dark_symmetry-vertical.png
 dark_krita_tool_editpath.png
+dark_trim-to-image.png
 
 
 light_select.png
@@ -113,7 +114,7 @@ light_selection-mode_mask.png
 light_symmetry-vertical.png
 light_symmetry-horizontal.png
 light_krita_tool_editpath.png
-
+light_trim-to-image.png
 
 
 tool_transform/dark_transform_icons_cage.png
diff --git a/krita/pics/dark_trim-to-image.png b/krita/pics/dark_trim-to-image.png
new file mode 100644
index 0000000..1c10e8c
Binary files /dev/null and b/krita/pics/dark_trim-to-image.png differ
diff --git a/krita/pics/light_trim-to-image.png b/krita/pics/light_trim-to-image.png
new file mode 100644
index 0000000..7155d23
Binary files /dev/null and b/krita/pics/light_trim-to-image.png differ
diff --git a/krita/pics/svg/dark_trim-to-image.svg b/krita/pics/svg/dark_trim-to-image.svg
new file mode 100644
index 0000000..739b8b9
--- /dev/null
+++ b/krita/pics/svg/dark_trim-to-image.svg
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   width="22"
+   height="22"
+   id="svg5119"
+   inkscape:version="0.91 r"
+   sodipodi:docname="dark_trim-to-image.svg"
+   inkscape:export-filename="/home/deevad/dark_trim-to-image.png"
+   inkscape:export-xdpi="90"
+   inkscape:export-ydpi="90">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="640"
+     inkscape:window-height="480"
+     id="namedview24"
+     showgrid="false"
+     inkscape:zoom="14.404369"
+     inkscape:cx="9.1524163"
+     inkscape:cy="10.575746"
+     inkscape:current-layer="svg5119" />
+  <metadata
+     id="metadata5125">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs5123">
+    <linearGradient
+       x1="178.39517"
+       y1="87.793045"
+       x2="185.75043"
+       y2="95.148293"
+       id="linearGradient10539"
+       xlink:href="#linearGradient6935"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.259156,0,0,1.259156,-7.4350029,33.683404)" />
+    <linearGradient
+       id="linearGradient6935">
+      <stop
+         id="stop6937"
+         style="stop-color:#666666;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop6939"
+         style="stop-color:#1a1a1a;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="178.39517"
+       y1="87.793045"
+       x2="185.75043"
+       y2="95.148293"
+       id="linearGradient5162"
+       xlink:href="#linearGradient6935"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.259156,0,0,1.259156,-7.4350029,33.683404)" />
+    <linearGradient
+       x1="178.39517"
+       y1="87.793045"
+       x2="185.75043"
+       y2="95.148293"
+       id="linearGradient9563"
+       xlink:href="#linearGradient5536"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.2865905,0,0,1.2865905,-700.8632,1039.1906)" />
+    <linearGradient
+       id="linearGradient5536">
+      <stop
+         id="stop5538"
+         style="stop-color:#e6e6e6;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop5540"
+         style="stop-color:#aaaaaa;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient6935"
+       id="linearGradient4208-7-8-7"
+       x1="20.091219"
+       y1="6.4588799"
+       x2="42.777454"
+       y2="6.4588799"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0,0.38110105,-0.38110105,0,4.8515431,-0.46508583)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient6935"
+       id="linearGradient4208-7-8"
+       x1="20.091219"
+       y1="6.4588799"
+       x2="42.777454"
+       y2="6.4588799"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.38110105,0,0,0.38110105,-0.35201932,17.378052)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient6935"
+       id="linearGradient4208-7"
+       x1="20.091219"
+       y1="6.4588799"
+       x2="42.777454"
+       y2="6.4588799"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0,-0.38110105,0.38110105,0,17.253547,22.819188)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient6935"
+       id="linearGradient4208"
+       x1="20.091219"
+       y1="6.4588799"
+       x2="42.777454"
+       y2="6.4588799"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-0.38110105,0,0,-0.38110105,23.212939,4.4624921)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient6935"
+       id="linearGradient4174"
+       x1="10.568574"
+       y1="25.864908"
+       x2="44.916229"
+       y2="25.864908"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.38110105,0,0,0.38110105,0.63954581,0.98967781)" />
+  </defs>
+  <path
+     style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:5.5;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+     d="m 16.280062,5.1763435 -0.745083,0.7368942 -1.589161,1.5727865 -5.1962234,0 0,-0.949031 0,-1.048028 -2.0960557,0 0,1.048028 0,0.949031 -0.9408433,0 -1.0480287,0 0,2.0960551 1.0480287,0 0.9408433,0 0,5.4202697 1.0480279,1.048027 0.3669583,0 c 0.1344695,5.35e-4 0.1348601,0 0.2032044,0 l 4.8314985,0 0,1.27654 0,1.048029 2.096055,0 0,-1.048029 0,-1.27654 1.268352,0 1.048028,0 0,-2.096055 -1.048028,0 -1.268352,0 0,-4.7592968 1.81023,-1.7916219 0.745083,-0.7368945 z m -7.5304674,4.4057358 3.0778374,0 -3.0778374,3.0458307 z m 4.3536334,1.6874137 0,2.684828 -2.713113,0 z"
+     id="path827-3"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccc" />
+  <path
+     style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient4174);fill-opacity:1.0;fill-rule:nonzero;stroke:none;stroke-width:5.5;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+     d="m 16.282635,4.247521 -0.745082,0.7368947 -1.589161,1.5727861 -5.1962239,0 0,-0.9490308 0,-1.0480279 -2.0960557,0 0,1.0480279 0,0.9490308 -0.9408433,0 -1.0480279,0 0,2.096056 1.0480279,0 0.9408433,0 0,5.4202692 1.0480278,1.048028 0.3669585,0 c 0.1344702,5.33e-4 0.13486,0 0.2032043,0 l 4.831498,0 0,1.276539 0,1.048027 2.096055,0 0,-1.048027 0,-1.276539 1.268353,0 1.048027,0 0,-2.096057 -1.048027,0 -1.268353,0 0,-4.7592961 1.810231,-1.7916212 0.745082,-0.7368948 z m -7.5304669,4.4057368 3.0778369,0 -3.0778369,3.0458312 z m 4.3536329,1.6874142 0,2.684826 -2.713112,0 z"
+     id="path827"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccc" />
+  <path
+     style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 15.046766,1.4118041 -7.445922,0.052069 4.076355,2.4546147 z"
+     id="path4200-5"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc" />
+  <path
+     style="fill:url(#linearGradient4208);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="M 14.985976,0.65382381 7.5400532,0.70589331 11.616409,3.1605084 Z"
+     id="path4200"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc" />
+  <path
+     style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="M 21.057331,15.872262 21.005261,8.4263401 18.550646,12.502697 Z"
+     id="path4200-5-2"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="0.20369589"
+     inkscape:transform-center-y="1.0996974" />
+  <path
+     style="fill:url(#linearGradient4208-7);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="M 21.062215,14.592224 21.010145,7.1463016 18.55553,11.222658 Z"
+     id="path4200-58"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="0.74659558"
+     inkscape:transform-center-y="1.1176511" />
+  <path
+     style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 7.8135115,21.888391 7.4459225,-0.05207 -4.076357,-2.454615 z"
+     id="path4200-5-2-6"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="1.0996975"
+     inkscape:transform-center-y="-0.20369623" />
+  <path
+     style="fill:url(#linearGradient4208-7-8);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 7.8749439,21.186719 7.4459221,-0.05207 -4.076357,-2.454615 z"
+     id="path4200-58-8"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="1.1176513"
+     inkscape:transform-center-y="-0.74659663" />
+  <path
+     style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 1.0819952,8.9245065 0.05207,7.4459215 2.4546153,-4.076358 z"
+     id="path4200-5-2-6-2"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="-0.20369668"
+     inkscape:transform-center-y="-1.0996974" />
+  <path
+     style="fill:url(#linearGradient4208-7-8-7);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 1.0428754,7.7618766 0.05207,7.4459224 2.4546152,-4.076357 z"
+     id="path4200-58-8-4"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="-0.74659663"
+     inkscape:transform-center-y="-1.1176511" />
+</svg>
diff --git a/krita/pics/svg/light_trim-to-image.svg b/krita/pics/svg/light_trim-to-image.svg
new file mode 100644
index 0000000..980f57f
--- /dev/null
+++ b/krita/pics/svg/light_trim-to-image.svg
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   width="22"
+   height="22"
+   id="svg5119"
+   inkscape:version="0.91 r"
+   sodipodi:docname="light_calligraphy.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="640"
+     inkscape:window-height="480"
+     id="namedview24"
+     showgrid="false"
+     inkscape:zoom="14.404369"
+     inkscape:cx="4.5704731"
+     inkscape:cy="13.977492"
+     inkscape:current-layer="svg5119" />
+  <metadata
+     id="metadata5125">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs5123">
+    <linearGradient
+       x1="178.39517"
+       y1="87.793045"
+       x2="185.75043"
+       y2="95.148293"
+       id="linearGradient10539"
+       xlink:href="#linearGradient6935"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.259156,0,0,1.259156,-7.4350029,33.683404)" />
+    <linearGradient
+       id="linearGradient6935">
+      <stop
+         id="stop6937"
+         style="stop-color:#666666;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop6939"
+         style="stop-color:#1a1a1a;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="178.39517"
+       y1="87.793045"
+       x2="185.75043"
+       y2="95.148293"
+       id="linearGradient5162"
+       xlink:href="#linearGradient6935"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.259156,0,0,1.259156,-7.4350029,33.683404)" />
+    <linearGradient
+       x1="178.39517"
+       y1="87.793045"
+       x2="185.75043"
+       y2="95.148293"
+       id="linearGradient9563"
+       xlink:href="#linearGradient5536"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.2865905,0,0,1.2865905,-700.8632,1039.1906)" />
+    <linearGradient
+       id="linearGradient5536">
+      <stop
+         id="stop5538"
+         style="stop-color:#e6e6e6;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop5540"
+         style="stop-color:#aaaaaa;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5536"
+       id="linearGradient4208-7-8-7"
+       x1="20.091219"
+       y1="6.4588799"
+       x2="42.777454"
+       y2="6.4588799"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0,0.38110105,-0.38110105,0,4.8515431,-0.46508583)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5536"
+       id="linearGradient4208-7-8"
+       x1="20.091219"
+       y1="6.4588799"
+       x2="42.777454"
+       y2="6.4588799"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.38110105,0,0,0.38110105,-0.35201932,17.378052)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5536"
+       id="linearGradient4208-7"
+       x1="20.091219"
+       y1="6.4588799"
+       x2="42.777454"
+       y2="6.4588799"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0,-0.38110105,0.38110105,0,17.253547,22.819188)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5536"
+       id="linearGradient4208"
+       x1="20.091219"
+       y1="6.4588799"
+       x2="42.777454"
+       y2="6.4588799"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-0.38110105,0,0,-0.38110105,23.212939,4.4624921)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5536"
+       id="linearGradient4174"
+       x1="10.568574"
+       y1="25.864908"
+       x2="44.916229"
+       y2="25.864908"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.38110105,0,0,0.38110105,0.63954581,0.98967781)" />
+  </defs>
+  <path
+     style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:5.5;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+     d="m 16.280062,5.1763435 -0.745083,0.7368942 -1.589161,1.5727865 -5.1962234,0 0,-0.949031 0,-1.048028 -2.0960557,0 0,1.048028 0,0.949031 -0.9408433,0 -1.0480287,0 0,2.0960551 1.0480287,0 0.9408433,0 0,5.4202697 1.0480279,1.048027 0.3669583,0 c 0.1344695,5.35e-4 0.1348601,0 0.2032044,0 l 4.8314985,0 0,1.27654 0,1.048029 2.096055,0 0,-1.048029 0,-1.27654 1.268352,0 1.048028,0 0,-2.096055 -1.048028,0 -1.268352,0 0,-4.7592968 1.81023,-1.7916219 0.745083,-0.7368945 z m -7.5304674,4.4057358 3.0778374,0 -3.0778374,3.0458307 z m 4.3536334,1.6874137 0,2.684828 -2.713113,0 z"
+     id="path827-3"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccc" />
+  <path
+     style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient4174);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:5.5;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+     d="m 16.282635,4.247521 -0.745082,0.7368947 -1.589161,1.5727861 -5.1962239,0 0,-0.9490308 0,-1.0480279 -2.0960557,0 0,1.0480279 0,0.9490308 -0.9408433,0 -1.0480279,0 0,2.096056 1.0480279,0 0.9408433,0 0,5.4202692 1.0480278,1.048028 0.3669585,0 c 0.1344702,5.33e-4 0.13486,0 0.2032043,0 l 4.831498,0 0,1.276539 0,1.048027 2.096055,0 0,-1.048027 0,-1.276539 1.268353,0 1.048027,0 0,-2.096057 -1.048027,0 -1.268353,0 0,-4.7592961 1.810231,-1.7916212 0.745082,-0.7368948 z m -7.5304669,4.4057368 3.0778369,0 -3.0778369,3.0458312 z m 4.3536329,1.6874142 0,2.684826 -2.713112,0 z"
+     id="path827"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccc" />
+  <path
+     style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 15.046766,1.4118041 -7.445922,0.052069 4.076355,2.4546147 z"
+     id="path4200-5"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc" />
+  <path
+     style="fill:url(#linearGradient4208);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="M 14.985976,0.65382381 7.5400532,0.70589331 11.616409,3.1605084 Z"
+     id="path4200"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc" />
+  <path
+     style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="M 21.057331,15.872262 21.005261,8.4263401 18.550646,12.502697 Z"
+     id="path4200-5-2"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="0.20369589"
+     inkscape:transform-center-y="1.0996974" />
+  <path
+     style="fill:url(#linearGradient4208-7);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="M 21.062215,14.592224 21.010145,7.1463016 18.55553,11.222658 Z"
+     id="path4200-58"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="0.74659558"
+     inkscape:transform-center-y="1.1176511" />
+  <path
+     style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 7.8135115,21.888391 7.4459225,-0.05207 -4.076357,-2.454615 z"
+     id="path4200-5-2-6"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="1.0996975"
+     inkscape:transform-center-y="-0.20369623" />
+  <path
+     style="fill:url(#linearGradient4208-7-8);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 7.8749439,21.186719 7.4459221,-0.05207 -4.076357,-2.454615 z"
+     id="path4200-58-8"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="1.1176513"
+     inkscape:transform-center-y="-0.74659663" />
+  <path
+     style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 1.0819952,8.9245065 0.05207,7.4459215 2.4546153,-4.076358 z"
+     id="path4200-5-2-6-2"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="-0.20369668"
+     inkscape:transform-center-y="-1.0996974" />
+  <path
+     style="fill:url(#linearGradient4208-7-8-7);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 1.0428754,7.7618766 0.05207,7.4459224 2.4546152,-4.076357 z"
+     id="path4200-58-8-4"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccc"
+     inkscape:transform-center-x="-0.74659663"
+     inkscape:transform-center-y="-1.1176511" />
+</svg>
diff --git a/krita/ui/kis_layer_manager.cc b/krita/ui/kis_layer_manager.cc
index 02626ba..ddb8b9d 100644
--- a/krita/ui/kis_layer_manager.cc
+++ b/krita/ui/kis_layer_manager.cc
@@ -330,6 +330,11 @@ void KisLayerManager::setup(KisActionManager* actionManager)
     actionManager->addAction("resizeimagetolayer", m_imageResizeToLayer);
     connect(m_imageResizeToLayer, SIGNAL(triggered()), this, SLOT(imageResizeToActiveLayer()));
 
+    KisAction *trimToImage = new KisAction(themedIcon("trim-to-image"), i18n("Trim to Image Size"), this);
+    trimToImage->setActivationFlags(KisAction::ACTIVE_IMAGE);
+    actionManager->addAction("trim_to_image", trimToImage);
+    connect(trimToImage, SIGNAL(triggered()), this, SLOT(trimToImage()));
+
     m_layerStyle  = new KisAction(i18n("Layer Style..."), this);
     m_layerStyle->setActivationFlags(KisAction::ACTIVE_LAYER);
     m_layerStyle->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
@@ -377,6 +382,14 @@ void KisLayerManager::imageResizeToActiveLayer()
     }
 }
 
+void KisLayerManager::trimToImage()
+{
+    KisImageWSP image = m_view->image();
+    if (image) {
+        image->cropImage(image->bounds());
+    }
+}
+
 void KisLayerManager::layerProperties()
 {
     if (!m_view) return;
diff --git a/krita/ui/kis_layer_manager.h b/krita/ui/kis_layer_manager.h
index c1056d2..622be52 100644
--- a/krita/ui/kis_layer_manager.h
+++ b/krita/ui/kis_layer_manager.h
@@ -78,6 +78,7 @@ private Q_SLOTS:
     void mergeLayer();
 
     void imageResizeToActiveLayer();
+    void trimToImage();
 
     void layerProperties();
 


More information about the kimageshop mailing list