2 replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/ edited Apr 13 '17 at 12:56 Using a tweaked version of my answer herehere and a graphics expression which draws the rectangle outline separately: texturedShape[img_, shape_] := Module[{g, p, ar, i}, g = Graphics[shape, PlotRangePadding -> 0]; p = Polygon[AbsoluteOptions[g, PlotRange][[1, 2]] /. {{l_, r_}, {b_, t_}} :> {{l, b}, {l, t}, {r, t}, {r, b}}, VertexTextureCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 0}}]; ar = AbsoluteOptions[g, AspectRatio][[1, 2]]; i = SetAlphaChannel[img, ColorNegate@Rasterize[g, ImageSize -> ImageDimensions@img]]; {Texture[ImageData@i], p}] With[{ rect = Rectangle[{0, 0}, {2, 1}, RoundingRadius -> 0.2], tex = LinearGradientImage[{Top, Bottom} -> {Red, White}, {200, 100}]}, Graphics[{ (* inside *) texturedShape[tex, rect], (* outline *) FaceForm[None], EdgeForm[{Thickness[0.02], Black}], rect}]]  Using a tweaked version of my answer here and a graphics expression which draws the rectangle outline separately: texturedShape[img_, shape_] := Module[{g, p, ar, i}, g = Graphics[shape, PlotRangePadding -> 0]; p = Polygon[AbsoluteOptions[g, PlotRange][[1, 2]] /. {{l_, r_}, {b_, t_}} :> {{l, b}, {l, t}, {r, t}, {r, b}}, VertexTextureCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 0}}]; ar = AbsoluteOptions[g, AspectRatio][[1, 2]]; i = SetAlphaChannel[img, ColorNegate@Rasterize[g, ImageSize -> ImageDimensions@img]]; {Texture[ImageData@i], p}] With[{ rect = Rectangle[{0, 0}, {2, 1}, RoundingRadius -> 0.2], tex = LinearGradientImage[{Top, Bottom} -> {Red, White}, {200, 100}]}, Graphics[{ (* inside *) texturedShape[tex, rect], (* outline *) FaceForm[None], EdgeForm[{Thickness[0.02], Black}], rect}]]  Using a tweaked version of my answer here and a graphics expression which draws the rectangle outline separately: texturedShape[img_, shape_] := Module[{g, p, ar, i}, g = Graphics[shape, PlotRangePadding -> 0]; p = Polygon[AbsoluteOptions[g, PlotRange][[1, 2]] /. {{l_, r_}, {b_, t_}} :> {{l, b}, {l, t}, {r, t}, {r, b}}, VertexTextureCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 0}}]; ar = AbsoluteOptions[g, AspectRatio][[1, 2]]; i = SetAlphaChannel[img, ColorNegate@Rasterize[g, ImageSize -> ImageDimensions@img]]; {Texture[ImageData@i], p}] With[{ rect = Rectangle[{0, 0}, {2, 1}, RoundingRadius -> 0.2], tex = LinearGradientImage[{Top, Bottom} -> {Red, White}, {200, 100}]}, Graphics[{ (* inside *) texturedShape[tex, rect], (* outline *) FaceForm[None], EdgeForm[{Thickness[0.02], Black}], rect}]]  1 answered Feb 10 '16 at 22:08 Simon Woods 76.5k88 gold badges157157 silver badges295295 bronze badges Using a tweaked version of my answer here and a graphics expression which draws the rectangle outline separately: texturedShape[img_, shape_] := Module[{g, p, ar, i}, g = Graphics[shape, PlotRangePadding -> 0]; p = Polygon[AbsoluteOptions[g, PlotRange][[1, 2]] /. {{l_, r_}, {b_, t_}} :> {{l, b}, {l, t}, {r, t}, {r, b}}, VertexTextureCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 0}}]; ar = AbsoluteOptions[g, AspectRatio][[1, 2]]; i = SetAlphaChannel[img, ColorNegate@Rasterize[g, ImageSize -> ImageDimensions@img]]; {Texture[ImageData@i], p}] With[{ rect = Rectangle[{0, 0}, {2, 1}, RoundingRadius -> 0.2], tex = LinearGradientImage[{Top, Bottom} -> {Red, White}, {200, 100}]}, Graphics[{ (* inside *) texturedShape[tex, rect], (* outline *) FaceForm[None], EdgeForm[{Thickness[0.02], Black}], rect}]]