or if you want to dirrectly affect the pixels in the pixmap without creating a new pixmap
if you have an image you can call the routines with
this gets the pixmap for the relevant frame in the image
Function replacecolour2:Int(p:TPixmap,old_rgb:Int,new_rgb:Int,threshold:Int) Local w:Int = PixmapWidth(p) Local h:Int = PixmapHeight(p) Local x:Int,y:Int Local c:Int Local r1:Int,g1:Int,b1:Int ' Local n:TPixmap = CreatePixmap(w,h,pf_BGRA8888) Local r:Int = (old_rgb Shr 16) & 255 Local g:Int = (old_rgb Shr 8) & 255 Local b:Int = (old_rgb Shr 0) & 255 ' Local p1:TPixmap = ConvertPixmap(p,PF_BGRA8888) ' scan through image x =0 While x < w y = 0 While y < h c = ReadPixel(p,x,y) r1 = (c Shr 16) & 255 g1 = (c Shr 8) & 255 b1 = (c Shr 0) & 255 If threshold_check(r,r1,threshold) And threshold_check(g,g1,threshold) And threshold_check(b,b1,threshold) WritePixel p,x,y,new_rgb EndIf y:+1 Wend x:+1 Wend Return True End Function
if you have an image you can call the routines with
image.pixmaps[frame]
this gets the pixmap for the relevant frame in the image