Hi Tricrokra
thanks for the GreyScale code. I have used it to great effect in my app (with a smallish change). I have also added a "thank you to Tricrokra" in my app.
The change I make was...
Added another function that does the same as the existing function but can work from a buffer direct rather than an image file...
Thanks once again!
thanks for the GreyScale code. I have used it to great effect in my app (with a smallish change). I have also added a "thank you to Tricrokra" in my app.
The change I make was...
Added another function that does the same as the existing function but can work from a buffer direct rather than an image file...
Function GreyScale_FromBuffer(Buf,Tpe, x, y) Local Ret = CreateImage(x, y) LockBuffer ImageBuffer(Ret) LockBuffer Buf For GSX = 0 To x For GSY = 0 To y Col1 = ReadPixelFast(GSX,GSY,Buf) GS_SplitValue Col1 Temp = (GSRR+GSRG+GSRB) / 3 GSIH = 255 Select Tpe Case 1 GSIR = Temp GSIG = 0 GSIB = 0 Case 2 GSIR = 0 GSIG = Temp GSIB = 0 Case 3 GSIR = 0 GSIG = 0 GSIB = Temp Case 4 GSIR = Temp GSIG = 0 GSIB = Temp Case 5 GSIR = Temp GSIG = Temp GSIB = 0 Case 6 GSIR = 0 GSIG = Temp GSIB = Temp Case 7 GSIR = Temp GSIG = Temp GSIB = Temp End Select Col2 = GS_JoinValue() WritePixelFast GSX,GSY,Col2,ImageBuffer(Ret) Next Next UnlockBuffer Buf UnlockBuffer ImageBuffer(Ret) Return Ret End Function
Thanks once again!