Antialiasing in QB64

by (no login)

I made an antialiasing program - it scans the screen for pixels which need to be antialiased(edge pixels) and then blurs them accordingly. The problem is, it doesn't do anything. This is my source code :

SUB antialias (screenx, screeny)
FOR dx = 1 TO screenx - 1
FOR dy = 1 TO screeny - 1
op = POINT(dx, dy)
ra = 0
ba = 0
ga = 0
FOR cx = -1 TO 1
FOR cy = -1 TO 1
cp = POINT(dx + cx, dy + cy)
comparison = ABS(_RED32(op) - _RED32(cp)) + ABS(_BLUE32(op) - _BLUE32(cp)) + ABS(_GREEN32(cp) - _GREEN32(op))
IF comparison > 100 THEN
difpix = difpix + 1
END IF
ra = ra + (_RED32(cp) / 9)
ba = ba + (_BLUE32(cp) / 9)
ga = ga + (_GREEN32(cp) / 9)
NEXT cy
NEXT cx
IF difpix >= 1 AND difpix <= 4 THEN
difpix = 0
PSET (dx, dy), _RGB(ra, ga, ba)
END IF
NEXT dy
NEXT dx
END SUB

Posted on Jul 17, 2012, 7:52 AM

Respond to this message   

Return to Index


Response TitleAuthor and Date
Update on Jul 17
 Another Update on Jul 18
  One thing you might try... on Jul 19
   This is what I have so far on Jul 19
    *Hey, not bad -- and the red line works well, too! :-) on Jul 19
     I made it even better on Jul 20
      *Yeah -- definitely a speed improvement. Nice going. on Jul 20