¡@

Home 

2014/10/15 ¤U¤È 10:08:28

iphone Programming Glossary: erasemax

Undo drawing in Paint Application

http://stackoverflow.com/questions/6689600/undo-drawing-in-paint-application

kBrushOpacity void drawErase CGPoint start toPoint CGPoint end static GLfloat eraseBuffer NULL static NSUInteger eraseMax 64 NSUInteger vertexCount 0 count i EAGLContext setCurrentContext context glBindFramebufferOES GL_FRAMEBUFFER_OES viewFramebuffer.. scale start.y scale end.x scale end.y scale Allocate vertex array buffer if eraseBuffer NULL eraseBuffer malloc eraseMax 2 sizeof GLfloat Add points to the buffer so there are drawing points every X pixels count MAX ceilf sqrtf end.x start.x.. ceilf sqrtf end.x start.x end.x start.x end.y start.y end.y start.y kBrushPixelStep 1 for i 0 i count i if vertexCount eraseMax eraseMax 2 eraseMax eraseBuffer realloc eraseBuffer eraseMax 2 sizeof GLfloat eraseBuffer 2 vertexCount 0 start.x end.x..