Tiles with holes

(* takes list of point coordinates,returns plotRange bounding box,uses global "scale" and "lineThickness" to get bounding box *)

getPlotRange[lst_]:=({xs,ys}=Transpose[lst];
(*two extra 1/scale offsets needed for exact match*){{Min[xs]-lineThickness/2,Max[xs]+lineThickness/2},{Min[ys]-lineThickness/2,Max[ys]+lineThickness/2}});


(* appends alpha channel to raster data array *)
addAlpha[raster_,alpha_]:=(
temp=Transpose[raster,{2,3,1}]~Join~{alpha};
Transpose[temp,{3,1,2}]
);


lineThickness=.5; (* in absolute coordinates, assume grid graph coordinates *)
edgeThickness=.3;
scale=100;

g=GridGraph[{3,3}];
vcoords=Thread[VertexList[g]->(VertexCoordinates/.AbsoluteOptions[g,VertexCoordinates])];
bags={{2,4,5,6},{8,4,5,6},{2,3,6},{1,2,4},{4,7,8},{6,8,9}};

Clear[bagColors];
colorList=ColorData["Crayola","ColorList"];
Table[bagColors[bags[[i]]]=colorList[[i]],{i,1,Length[bags]}];

graphPR=getPlotRange[VertexList[g]/.vcoords];
graphIS=-scale Subtract@@@graphPR;

bagRaster[bag_]:=(
(* assume bag induces tree subgraph, draw curve through each maximal path *)
bagGraph=Subgraph[g,bag];
leafPoses=Position[VertexDegree[bagGraph],1];
leaves=Extract[VertexList[bagGraph],leafPoses];
tileEnds=Flatten[Outer[List,leaves,leaves],1];
tileEnds=Select[tileEnds,#[[1]]<#[[2]]&];
tiles=FindShortestPath[bagGraph,#[[1]],#[[2]]]&/@tileEnds;

tileOpts={bagColors[bag],AbsoluteThickness[lineThickness*scale],CapForm["Round"],JoinForm["Round"],Opacity[1]};
backOpts={Black,AbsoluteThickness[(lineThickness-edgeThickness)*scale],CapForm["Round"],JoinForm["Round"]};

tileG=Graphics[tileOpts~Join~ (Line[#/.vcoords]&/@tiles),PlotRange->graphPR,ImageSize->graphIS];
backG=Graphics[backOpts~Join~ (Line[#/.vcoords]&/@tiles),PlotRange->graphPR,ImageSize->graphIS];

holeMask=Rasterize[backG,"Data"][[All,All,1]]/255;
tileRaster=Rasterize[tileG,"Data",Background->None]/255;
backgroundMask=tileRaster[[All,All,4]];
tileRasterHole=addAlpha[tileRaster[[All,All,1;;3]],holeMask*backgroundMask];

Graphics[{Opacity[1],Raster[tileRasterHole]},ImageSize->graphIS]
);
Show[bagRaster/@bags]