Thanks, I just added noise, color addition and subtraction methods:
Method noise(x:Int,y:Int,width:Int,height:Int,noiselevel:Int)
Local pixPtr:Byte Ptr = PixmapPixelPtr(Self.buffer)
For Local ty:Int = y To y+height-1
For Local tx:Int = x To x+width-1
If tx > -1 And tx < Self.width And ty > -1 And ty < Self.height Then
Local offset:Int = ty*Self.pitch+tx*Self.bcount
Local n:Int = Rnd(-noiselevel,noiselevel)
If pixPtr[offset] + n < 0 Then
pixPtr[offset] = 0
Else
If pixPtr[offset] + n > 255 Then
pixPtr[offset] = 255
Else
pixPtr[offset] :+ n
End If
End If
If pixPtr[offset+1] + n < 0 Then
pixPtr[offset+1] = 0
Else
If pixPtr[offset+1] + n > 255 Then
pixPtr[offset+1] = 255
Else
pixPtr[offset+1] :+ n
End If
End If
If pixPtr[offset+2] + n < 0 Then
pixPtr[offset+2] = 0
Else
If pixPtr[offset+2] + n > 255 Then
pixPtr[offset+2] = 255
Else
pixPtr[offset+2] :+ n
End If
End If
End If
Next
Next
End Method
Method colorSubtract(x:Int,y:Int,width:Int,height:Int,r:Byte,g:Byte,b:Byte,a:Byte)
Local pixPtr:Byte Ptr = PixmapPixelPtr(Self.buffer)
For Local ty:Int = y To y+height-1
For Local tx:Int = x To x+width-1
If tx > -1 And tx < Self.width And ty > -1 And ty < Self.height Then
Local offset:Int = ty*Self.pitch+tx*Self.bcount
If pixPtr[offset] - r < 0 Then
pixPtr[offset] = 0
Else
pixPtr[offset] = pixPtr[offset]-r
End If
If pixPtr[offset+1] - g < 0 Then
pixPtr[offset+1] = 0
Else
pixPtr[offset+1] = pixPtr[offset+1]-g
End If
If pixPtr[offset+2] - b < 0 Then
pixPtr[offset+2] = 0
Else
pixPtr[offset+2] = pixPtr[offset+2]-b
End If
If Self.bcount = 4 Then
If pixPtr[offset+3] - a < 0 Then
pixPtr[offset+3] = 0
Else
pixPtr[offset+3] = pixPtr[offset+3]-a
End If
End If
End If
Next
Next
End Method
Method colorAddition(x:Int,y:Int,width:Int,height:Int,r:Byte,g:Byte,b:Byte,a:Byte)
Local pixPtr:Byte Ptr = PixmapPixelPtr(Self.buffer)
For Local ty:Int = y To y+height-1
For Local tx:Int = x To x+width-1
If tx > -1 And tx < Self.width And ty > -1 And ty < Self.height Then
Local offset:Int = ty*Self.pitch+tx*Self.bcount
If r + pixPtr[offset] > 255 Then
pixPtr[offset] = 255
Else
pixPtr[offset] = pixPtr[offset]+r
End If
If g + pixPtr[offset+1] > 255 Then
pixPtr[offset+1] = 255
Else
pixPtr[offset+1] = pixPtr[offset+1]+g
End If
If b + pixPtr[offset+2] > 255 Then
pixPtr[offset+2] = 255
Else
pixPtr[offset+2] = pixPtr[offset+2]+b
End If
If Self.bcount = 4 Then
If a + pixPtr[offset+3] > 255 Then
pixPtr[offset+3] = 255
Else
pixPtr[offset+3] = pixPtr[offset+3]+a
End If
End If
End If
Next
Next
End Method
I probably won't be adding anymore tonight, its creeping towards midnight, and I'm a bit tired. But I will try and make more code for it tomorrow.