Okay, here's my super-great ScalErekT function.

It's written in a Basic language called Blitzmax, which is a really sweet language btw. The code is big and bloated but super-simple, I just go with brute-force tactics all the way. Lots of comments too. But just in case I included some operator and function explanations below.
Ugly it may be but the code works! It smooths better than Scale2X overall imo and also preserves most edges/corners, which helps kill the claymation-effect most pixel-art filters suffer from. The down-side is that it reads two to three times more pixels than Scale2X so it's quite a bit slower also. No biggie if you're not using it for real-time full screen scaling tho.
Some operator differences between C and blitzmax:
' == //
<> == !=
And == &&
Or == ||
Other stuff:
P = PMPixels[pos] == Variable P = pixel at position
pos of source image
x2PMPixels[] = P_1 == Write pixel value stored in P_1 to output image
Pixmap == Just a normal bitmap image
And yeah, here's an exe file to check out the effect. Put your image in the same folder as the exe and rename it to test.bmp. Run the exe and press 1 for no scaling, 2 for Scale2X and 3 for ScalErekT:
http://www.mediafire.com/?9prowd8jyydh8snAnd the code:
' standard Scale2X.
Function Scale2X(Pixmap:TPixmap)
Local Pix_W:Int = PixmapWidth(Pixmap)
Local Pix_H:Int = PixmapHeight(Pixmap)
Local x:Int
Local y:Int
Local ScaledPixmap:TPixmap = CreatePixmap(Pix_W*2,Pix_H*2,PF_RGB888)
Local P:Int
Local A:Int
Local B:Int
Local C:Int
Local D:Int
Local P_1:Int
Local P_2:Int
Local P_3:Int
Local P_4:Int
' go through all pixels in the image
For x = 0 To Pix_W - 1
For y = 0 To Pix_H - 1
' read the source pixel and its surrounding pixels
P = ReadPixel(Pixmap,x,y)
If x > 0 And x < Pix_W - 1 And y > 0 And y < Pix_H - 1
A = ReadPixel(Pixmap,x,y-1)
B = ReadPixel(Pixmap,x+1,y)
C = ReadPixel(Pixmap,x-1,y)
D = ReadPixel(Pixmap,x,y+1)
Else
A = P
B = P
C = P
D = P
EndIf
P_1 = P
P_2 = P
P_3 = P
P_4 = P
' check for equal pixels around P and modify output pixels accordingly
If A = C And B <> C And A <> D Then P_1 = A
If A = B And B <> C And A <> D Then P_2 = B
If D = C And A <> D And B <> C Then P_3 = C
If B = D And B <> C And A <> D Then P_4 = D
WritePixel(ScaledPixmap,x*2,y*2,P_1)
WritePixel(ScaledPixmap,(x*2)+1,y*2,P_2)
WritePixel(ScaledPixmap,x*2,(y*2)+1,P_3)
WritePixel(ScaledPixmap,(x*2)+1,(y*2)+1,P_4)
Next
Next
OutputPixmap = CopyPixmap(ScaledPixmap)
End Function
' My function :]
Function ScalErekT(PM:TPixmap)
Local PMPixels: Int Ptr = Int Ptr(pm.pixels)
Local Pix_W:Int = PixmapWidth(PM)
Local Pix_H:Int = PixmapHeight(PM)
Local x:Int
Local y:Int
Local yt:Int
Local yb:Int
Local xl:Int
Local xr:Int
Local yt2:Int
Local yb2:Int
Local xl2:Int
Local xr2:Int
Local ScaledPM:TPixmap = CreatePixmap(Pix_W*2,Pix_H*2,PF_RGBA8888)
Local x2PMPixels:Int Ptr = Int Ptr (ScaledPM.pixels)
Local x2Pix_W:Int = PixmapWidth(ScaledPM)
Local x2Pix_H:Int = PixmapHeight(ScaledPM)
Local P:Int
Local A:Int
Local B:Int
Local C:Int
Local D:Int
Local FL:Int ' far left pixel (beside C)
Local TR:Int ' top right pixel
Local FR:Int ' far right pixel (beside B)
Local TL:Int ' top left pixel
Local FT:Int ' far top pixel
Local FB:Int ' far bottom pixel
Local BL:Int ' bottom left pixel
Local BR:Int ' bottom right pixel
Local P_1:Int ' output pixel top-left
Local P_2:Int ' output pixel top-right
Local P_3:Int ' output pixel bottom-left
Local P_4:Int ' output pixel bottom-right
' RotSprite vars
Local P_Clr:Int[4] ' 1 = R, 2 = G, 3 = B
Local A_Clr:Int[4] ' 1 = R, 2 = G, 3 = B
Local B_Clr:Int[4] ' 1 = R, 2 = G, 3 = B
Local C_Clr:Int[4] ' 1 = R, 2 = G, 3 = B
Local D_Clr:Int[4] ' 1 = R, 2 = G, 3 = B
Local P_Value:Int ' holds average of RGB values
Local A_Value:Int
Local B_Value:Int
Local C_Value:Int
Local D_Value:Int
' color class vars
Local P_Red:Int = False
Local A_Red:Int = False
Local B_Red:Int = False
Local C_Red:Int = False
Local D_Red:Int = False
Local P_Green:Int = False
Local A_Green:Int = False
Local B_Green:Int = False
Local C_Green:Int = False
Local D_Green:Int = False
Local P_Blue:Int = False
Local A_Blue:Int = False
Local B_Blue:Int = False
Local C_Blue:Int = False
Local D_Blue:Int = False
' go through all pixels in the image
For x = 0 To Pix_W - 1
For y = 0 To Pix_H - 1
yt = (y-1)*Pix_W
yb = (y+1)*Pix_W
yt2 = (y-2)*Pix_W
yb2 = (y+2)*Pix_W
xl2 = (x-2)
xr2 = (x+2)
xl = x-1
xr = x+1
Local yc:Int = y*pix_W
' read the source pixel and its surrounding pixels
P = PMPixels[yc+x]
If x > 0 And x < Pix_W - 1 And y > 0 And y < Pix_H - 1
A = PMPixels[yt+x]
B = PMPixels[yc+xr]
C = PMPixels[yc+xl]
D = PMPixels[yb+x]
Else
A = P
B = P
C = P
D = P
EndIf
P_1 = P
P_2 = P
P_3 = P
P_4 = P
' get colors
P_Clr[1] = (P & $FF0000) Shr 16 ' red
P_Clr[2] = (P & $FF00) Shr 8 ' green
P_Clr[3] = (P & $FF) ' blue
A_Clr[1] = (A & $FF0000) Shr 16 ' red
A_Clr[2] = (A & $FF00) Shr 8 ' green
A_Clr[3] = (A & $FF) ' blue
B_Clr[1] = (B & $FF0000) Shr 16 ' red
B_Clr[2] = (B & $FF00) Shr 8 ' green
B_Clr[3] = (B & $FF) ' blue
C_Clr[1] = (C & $FF0000) Shr 16 ' red
C_Clr[2] = (C & $FF00) Shr 8 ' green
C_Clr[3] = (C & $FF) ' blue
D_Clr[1] = (D & $FF0000) Shr 16 ' red
D_Clr[2] = (D & $FF00) Shr 8 ' green
D_Clr[3] = (D & $FF) ' blue
' set average value from RGB
P_Value = (P_Clr[1] + P_Clr[2] + P_Clr[3]) / 3
A_Value = (A_Clr[1] + A_Clr[2] + A_Clr[3]) / 3
B_Value = (B_Clr[1] + B_Clr[2] + B_Clr[3]) / 3
C_Value = (C_Clr[1] + C_Clr[2] + C_Clr[3]) / 3
D_Value = (D_Clr[1] + D_Clr[2] + D_Clr[3]) / 3
' check for equal pixels around P and modify output pixels accordingly
If B <> C And A <> D And (A = C Or A = B Or C = D Or B = D)
' if A = C then check far left and top right pixel to see if it's necessary
' to modify P_2 as well
If A = C
P_1 = A
' check pixel at far left and top right to see if stepping needs easing
If x > 1 Then FL = PMPixels[yc+xl2]
' if FL = C then read another pixel: TR
If FL = C
If x < Pix_W - 1 And y > 0 Then TR = PMPixels[yt+xr]
' If both = A && C then set P_2 to be A as well.
If FL = C And TR = A Then P_2 = A
EndIf
' If FL is C and TR is A then we already know what to smooth here so
' we can skip checking for vertical stepping and save CPU load. But if not
' then do another check for P_3 to see if the bottom left and far top
' pixels are the same.
If FL <> C Or TR <> A
' check pixel at far top and bottom left to see if stepping needs easing
If x > 0 And y < Pix_H - 1 Then BL = PMPixels[yb+xl]
If BL = C
If y > 1 Then FT = PMPixels[yt2+x]
' If both = A && C then set P_3 to be C as well
If BL = C And FT = A Then P_3 = C
EndIf
EndIf
' stepping has been applied but if BL and TL and TR are equal then
' P_1-4 make up a corner so undo stepping
If P_1 = A
' check top left first, if it's equal to A then check bottom left
If x > 0 And y > 0 Then TL = PMPixels[yt+xl]
If TL = A
' TL has been read; this way we don't need to read the pixel twice
Local TL_Read:Int = True
' now check bottom left
If x > 0 And y < Pix_H - 1 Then BL = PMPixels[yb+xl]
If BL = A
' BL has been read; this way we don't need to read the pixel twice
Local BL_Read:Int = True
' if P_2 = A then we don't need to check TR: it's already checked
If P_2 <> A
If x < Pix_W - 1 And y > 0 Then TR = PMPixels[yt+xr]
EndIf
' now compare them all and see if they make up a corner
' NOTE: checking TR would be enough; the others have been
' confirmed already. But I included them anyway for read-
' ability
If TL = A And BL = A And TR = A
P_1 = P
P_2 = P
EndIf
EndIf
EndIf
EndIf
' if A = B then check far right and top left pixel to see if it's necessary
' to modify P_1 as well
ElseIf A = B
P_2 = B
If x < Pix_W - 2 Then FR = PMPixels[yc+xr2]
If FR = B
If x > 0 And y > 0 Then TL = PMPixels[yt+xl]
If FR = B And TL = A Then P_1 = B
EndIf
If FR <> B Or TL <> A
If x < Pix_W - 1 And y < Pix_H - 1 Then BR = PMPixels[yb+xr]
If BR = B
If y > 1 Then FT = PMPixels[yt2+x]
If BR = B And FT = A Then P_4 = B
EndIf
EndIf
' stepping has been applied but if TL and TR and BR are equal then
' P_1-4 make up a corner so undo stepping
If P_2 = A
' check top right first, if it's equal to B then check bottom right
If x < Pix_W - 1 And y > 0 Then TR = PMPixels[yt+xr]
If TR = A
' now check bottom right
If x < Pix_W - 1 And y < Pix_H - 1 Then BR = PMPixels[yb+xr]
If BR = A
' if P_1 = A then we don't need to check TL: it's already checked
If P_1 <> A
If x > 0 And y > 0 Then TL = PMPixels[yt+xl]
EndIf
' now compare them all and see if they make up a corner
' NOTE: checking TL would be enough; the others have been
' confirmed already. But I included them anyway for read-
' ability
If TR = A And BR = A And TL = A
P_1 = P
P_2 = P
EndIf
EndIf
EndIf
EndIf
' if C = D then check far left and bottom right pixel to see if it's necessary
' to modify P_4 as well
ElseIf C = D
P_3 = C
If x > 1 Then FL = PMPixels[yc+xl2]
If FL = C
If x > 0 And y < Pix_H - 1 Then BR = PMPixels[yb+xr]
If FL = C And BR = D Then P_4 = C
EndIf
If FL <> C Or BR <> D
If x > 0 And y > 0 Then TL = PMPixels[yt+xl]
If TL = C
If y < Pix_H - 2 Then FB = PMPixels[yb2+x]
If TL = C And FB = D Then P_1 = C
EndIf
EndIf
' stepping has been applied but if TL and BL and BR are equal then
' P_1-4 make up a corner so undo stepping
If P_3 = D
' check top left first, if it's equal to A then check bottom left
If x > 0 And y > 0 Then TL = PMPixels[yt+xl]
If TL = D
' now check bottom left
If x > 0 And y < Pix_H - 1 Then BL = PMPixels[yb+xl]
If BL = D
' if P_4 = D then we don't need to check BR: it's already checked
If P_4 <> D
If x > 0 And y < Pix_H - 1 Then BR = PMPixels[yb+xr]
EndIf
' now compare them all and see if they make up a corner
' NOTE: checking BR would be enough; the others have been
' confirmed already. But I included them anyway for read-
' ability
If TL = D And BL = D And BR = D
P_3 = P
P_4 = P
EndIf
EndIf
EndIf
EndIf
' if B = D then check far right and bottom left pixel to see if it's necessary
' to modify P_3 as well
ElseIf B = D
P_4 = D
If x < Pix_W - 2 Then FR = PMPixels[yc+xr2]
If FR = B
If x > 0 And y < Pix_H - 1 Then BL = PMPixels[yb+xl]
If FR = B And BL = D Then P_3 = D
EndIf
If FR <> B Or BL <> D
If x < Pix_W - 1 And y > 0 Then TR = PMPixels[yt+xr]
If TR = B
If y < Pix_H - 2 Then FB = PMPixels[yb2+x]
If TR = B And FB = D Then P_2 = B
EndIf
EndIf
' stepping has been applied but if TR and BR and BL are equal then
' P_1-4 make up a corner so undo stepping
If P_3 = D
' check top right first, if it's equal to D then check bottom right
If x < Pix_W - 1 And y > 0 Then TR = PMPixels[yt+xr]
If TR = D
' now check bottom right
If x < Pix_W - 1 And y < Pix_H - 1 Then BR = PMPixels[yb+xr]
If BR = D
' if P_3 = D then we don't need to check BL: it's already checked
If P_3 <> D
If x > 0 And y < Pix_H - 1 Then BL = PMPixels[yb+xl]
EndIf
' now compare them all and see if they make up a corner
' NOTE: checking BL would be enough; the others have been
' confirmed already. But I included them anyway for read-
' ability
If TR = D And BR = D And BL = D
P_3 = P
P_4 = P
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
' vars to get value difference between P and B/C/D. Used to compare and set P
' to the value closest to it; prevents "stray" pixel artifacts
Local A_P_Difference:Int
Local B_P_Difference:Int
Local C_P_Difference:Int
Local D_P_Difference:Int
If P_1 <> P And P_1 <> P_3 And P_1 <> P_2 ' compare P_1 and P_3 to make sure there's been no vertical step smoothing
' check which pixel is closer to P: C or A?
If C_Value > P_Value Then C_P_Difference = C_Value - P_Value
If C_Value <= P_Value Then C_P_Difference = P_Value - C_Value
If A_Value > P_Value Then A_P_Difference = A_Value - P_Value
If A_Value <= P_Value Then A_P_Difference = P_Value - A_Value
If C_P_Difference > A_P_Difference
P_1 = A
Else
P_1 = C
EndIf
EndIf
If P_2 <> P And P_2 <> P_4 And P_1 <> P_2 ' compare P_2 and P_4 to make sure there's been no vertical step smoothing
' check which pixel is closer to P: B or A?
If B_Value > P_Value Then B_P_Difference = B_Value - P_Value
If B_Value <= P_Value Then B_P_Difference = P_Value - B_Value
If A_Value > P_Value Then A_P_Difference = A_Value - P_Value
If A_Value <= P_Value Then A_P_Difference = P_Value - A_Value
If B_P_Difference > A_P_Difference
P_2 = A
Else
P_2 = B
EndIf
EndIf
If P_3 <> P And P_3 <> P_1 And P_4 <> P_3 ' compare P_3 and P_1 to make sure there's been no vertical step smoothing
' check which pixel is closer to P: C or D?
If C_Value > P_Value Then C_P_Difference = C_Value - P_Value
If C_Value <= P_Value Then C_P_Difference = P_Value - C_Value
If D_Value > P_Value Then D_P_Difference = D_Value - P_Value
If D_Value <= P_Value Then D_P_Difference = P_Value - D_Value
If C_P_Difference > D_P_Difference
P_3 = D
Else
P_3 = C
EndIf
EndIf
If P_4 <> P And P_4 <> P_2 And P_4 <> P_3 ' compare P_4 and P_2 to make sure there's been no vertical step smoothing
' check which pixel is closer to P: B or D?
If B_Value > P_Value Then B_P_Difference = B_Value - P_Value
If B_Value <= P_Value Then B_P_Difference = P_Value - B_Value
If D_Value > P_Value Then D_P_Difference = D_Value - P_Value
If D_Value <= P_Value Then D_P_Difference = P_Value - D_Value
If B_P_Difference > D_P_Difference
P_4 = D
Else
P_4 = B
EndIf
EndIf
' if equal pixel conditions aren't met then check for similar pixels instead:
If P_1 = P And C <> A ' P_3 is unmodified and C & D are similar but not equal
' if C is similar to A and very different from P then turn P_1 into either C or A
If A_Value < C_Value + 40 And A_Value > C_Value - 40 And ((P_Value >= C_Value + 40 Or P_Value <= C_Value - 40) Or (P_Value >= A_Value + 40 Or P_Value <= A_Value - 40)) And C <> D And B <> A
If A <> D And B <> C And P_3 <> D And P_4 <> D And P_3 <> C And P_4 <> B
' check top-left pixel; only modify P_1 if TL <> P (no diagonal line from TL to P)
If x > 0 And y > 0 Then TL = PMPixels[yt+xl]
If TL <> P
' check BL and TR -> if they're the same as TL then P is a
' corner = don't modify
If x > 0 And y < Pix_H - 1 Then BL = PMPixels[yb+xl]
' TL = BL -> OK to check TR as well
If TL = BL
If x < Pix_W - 1 And y > 0 Then TR = PMPixels[yt+xr]
EndIf
' if they're all the same then leave P_3 as-is
If TL = BL And TL = TR
P_1 = P
Else
' check which pixel is closer to P: C or A?
If C_Value > P_Value Then C_P_Difference = C_Value - P_Value
If C_Value <= P_Value Then C_P_Difference = P_Value - C_Value
If A_Value > P_Value Then A_P_Difference = A_Value - P_Value
If A_Value <= P_Value Then A_P_Difference = P_Value - A_Value
If C_P_Difference > A_P_Difference
P_1 = A
Else
P_1 = C
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
If P_2 = P And A <> B ' P_2 is unmodified and A & B are similar but not equal
' if D is similar to B and very different from P then turn P_4 into either B or D
If B_Value < A_Value + 40 And B_Value > A_Value - 40 And ((P_Value >= A_Value + 40 Or P_Value <= A_Value - 40) Or (P_Value >= B_Value + 40 Or P_Value <= B_Value - 40)) And C <> A And D <> B
If B <> C And A <> D And P_3 <> C And P_4 <> D And P_3 <> D And P_4 <> B
' check top-right pixel; only modify P_2 if TR <> P (no diagonal line from TR to P)
If x < Pix_W - 1 And y > 0 Then TR = PMPixels[yt+xr]
If BR <> P ' old: If BR <> P Then P_4 = B
' check BR and TL -> if they're the same as TR then P is a
' corner = don't modify
If x < Pix_W - 1 And y < Pix_H - 1 Then BR = PMPixels[yb+xr]
' TR = BR -> OK to check TL as well
If TR = BR
If x > 0 And y > 0 Then TL = PMPixels[yt+xl]
EndIf
' if they're all the same then leave P_2 as-is
If TR = BR And TR = TL
P_2 = P
Else
' check which pixel is closer to P: B or A?
If B_Value > P_Value Then B_P_Difference = B_Value - P_Value
If B_Value <= P_Value Then B_P_Difference = P_Value - B_Value
If A_Value > P_Value Then A_P_Difference = A_Value - P_Value
If A_Value <= P_Value Then A_P_Difference = P_Value - A_Value
If B_P_Difference > A_P_Difference
P_2 = A
Else
P_2 = B
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
If P_3 = P And C <> D ' P_3 is unmodified and C & D are similar but not equal
' if C is similar to D and very different from P then turn P_3 into either C or D
If D_Value < C_Value + 40 And D_Value > C_Value - 40 And ((P_Value >= C_Value + 40 Or P_Value <= C_Value - 40) Or (P_Value >= D_Value + 40 Or P_Value <= D_Value - 40)) And B <> D And C <> A
If A <> D And B <> C And P_1 <> C And P_2 <> A And P_1 <> A And P_2 <> B
' check bottom-left pixel; only modify P_3 if BL <> P (no diagonal line from BL to P)
If x > 0 And y < Pix_H - 1 Then BL = PMPixels[yb+xl]
If BL <> P ' old: If BL <> P Then P_3 = D
' check TL and BR -> if they're the same as BL then P is a
' corner = don't modify
If x > 0 And y > 0 Then TL = PMPixels[yt+xl]
' TL = BL -> OK to check BR as well
If TL = BL
If x < Pix_W - 1 And y < Pix_H - 1 Then BR = PMPixels[yb+xr]
EndIf
' if they're all the same then leave P_3 as-is
If TL = BL And TL = BR
P_3 = P
Else
' check which pixel is closer to P: C or D?
If C_Value > P_Value Then C_P_Difference = C_Value - P_Value
If C_Value <= P_Value Then C_P_Difference = P_Value - C_Value
If D_Value > P_Value Then D_P_Difference = D_Value - P_Value
If D_Value <= P_Value Then D_P_Difference = P_Value - D_Value
If C_P_Difference > D_P_Difference
P_3 = D
Else
P_3 = C
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
If P_4 = P And B <> D ' P_4 is unmodified and B & D are similar but not equal
' if D is similar to B and very different from P then turn P_4 into either B or D
If B_Value < D_Value + 40 And B_Value > D_Value - 40 And ((P_Value >= D_Value + 40 Or P_Value <= D_Value - 40) Or (P_Value >= B_Value + 40 Or P_Value <= B_Value - 40)) And B <> A And D <> C
If B <> C And A <> D And P_1 <> C And P_2 <> A And P_1 <> A And P_2 <> B
' check bottom-right pixel; only modify P_4 if BR <> P (no diagonal line from BR to P)
If x < Pix_W - 1 And y < Pix_H - 1 Then BR = PMPixels[yb+xr]
If BR <> P ' old: If BR <> P Then P_4 = B
' check TR and BL -> if they're the same as BR then P is a
' corner = don't modify
If x < Pix_W - 1 And y > 0 Then TR = PMPixels[yt+xr]
' TR = BR -> OK to check BL as well
If TR = BR
If x > 0 And y < Pix_H - 1 Then BL = PMPixels[yb+xl]
EndIf
' if they're all the same then leave P_4 as-is
If TR = BR And TR = BL
P_4 = P
Else
' check which pixel is closer to P: B or D?
If B_Value > P_Value Then B_P_Difference = B_Value - P_Value
If B_Value <= P_Value Then B_P_Difference = P_Value - B_Value
If D_Value > P_Value Then D_P_Difference = D_Value - P_Value
If D_Value <= P_Value Then D_P_Difference = P_Value - D_Value
If B_P_Difference > D_P_Difference
P_4 = D
Else
P_4 = B
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
' Write pixels to output pixmap
x2PMPixels[(y*2 )*ScaledPM.Width+(x*2 )] = P_1
x2PMPixels[(y*2 )*ScaledPM.width+(x*2+1)] = P_2
x2PMPixels[(y*2+1)*ScaledPM.width+(x*2 )] = P_3
x2PMPixels[(y*2+1)*ScaledPM.Width+(x*2+1)] = P_4
Next
Next
OutputPixmap = ScaledPM
End Function
Hope it's useful, if you're wondering about anything just let me know

EDIT: Replaced crappy download link.