title: How to use a CGLayer to draw multiple images offscreen
body: <p>Ultimately I'm working on a box blur function for use on iPhone. </p>
  
  <p>That function would take a UIImage and draw transparent copies, first to the sides, then take that image and draw transparent copies above and below, returning a nicely blurred image.</p>
  
  <p>Reading the <a href="https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html" rel="nofollow noreferrer">Drawing with Quartz 2D Programming Guide</a>, it recommends using CGLayers for this kind of operation.</p>
  
  <p>The example code in the guide is a little dense for me to understand, so I would like someone to show me a very simple example of taking a <strong>UIImage</strong> and converting it to a <strong>CGLayer</strong> that I would then draw copies of and return as a <strong>UIImage</strong>.</p>
  
  <p>It would be OK if values were hard-coded (for simplicity). This is just for me to wrap my head around, not for production code.</p>