title: Translate GPUImage position with GPUImageTransformFilter and iOS Pan Gesture?
body: <p>I'm having an issue using the GPUImage transform filter. I'm using the pan gesture recognizer to reposition the image. The code that I have works, but the image moves at about half speed. If I double my <code>CGAffineTransform newTransform</code> coordinates, the image drags as expected. However, when I start a new panning gesture, the image jumps to a point about twice the distance from center. Perhaps my math is off. Any ideas? Or, can anyone suggest a better solution than what I have here?</p>
  
  <pre class="lang-c prettyprint-override"><code>- (void)move:(UIPanGestureRecognizer *)sender {
      // Translated CGPoint from GPUImageView
      CGPoint translation = [sender translationInView:self.primaryImageView];
      // Current transform from GPUImageTransformFilter
      CGAffineTransform currentTransform = self.transFilter.affineTransform;
      // Size of GPUImageView bounds for later calculations
      CGSize size = self.primaryImageView.bounds.size;
  
      if ([sender state] == UIGestureRecognizerStateBegan) {
          // Set a beginning CGPoint 
          // Multiply GPUImageView bounds by current transform to get
          // the translated coordinates in pixels.
          self.beginPoint = CGPointMake(size.width*currentTransform.tx, size.height*currentTransform.ty);
      }
  
      // Calculate difference from beginning point to translated point
      CGPoint updatedPoint = CGPointMake(self.beginPoint.x+translation.x, self.beginPoint.y+translation.y);
  
      // Create a new transform translation.
      // Divide updated coordinates by GPUImageView bounds to get
      // a percentage value (-1 to 1)
      CGAffineTransform newTransform = CGAffineTransformMakeTranslation(updatedPoint.x/(size.width), updatedPoint.y/(size.height));
  
      // Apply new transform to filter and process.
      [self.transFilter setAffineTransform:newTransform];
      [self.sourcePicture processImage];
  }
  </code></pre>