BEWARE: Glitchfinder's sense of humor sucks.
 |
|
Location: Approximately 93 million miles from Sol.
|
I thought that, since I provided you with some of the methods, I might as well go a bit further. Here is a more permanent link for the current version of the .dll file. You might also want to try hosting it at [url]bb.ohsk.net[/url], which is hosted by shadow, owner of the Slacked IRC network. Also, what in particular do you mean when you say that the emboss doesn't get every color. When I tested it, it seemed to work fine. I could be wrong, though. Also, below is the original set of Ruby methods that I was basing this stuff on:
- def self.shader_alien2
- for y in 0..@bitmap.height
- for x in 0..@bitmap.width
- pixel1 = @bitmap.get_pixel(x, y)
- pixel2 = @bitmap.get_pixel(x + 1, y + 1)
- pixel3 = @bitmap.get_pixel(x, y + 1)
- pixel4 = @bitmap.get_pixel(x + 1, y)
- red = Math.hypot((pixel1.red - pixel2.red),
- (pixel3.red - pixel4.red))
- green = Math.hypot((pixel1.green - pixel2.green),
- (pixel3.green - pixel4.green))
- blue = Math.hypot((pixel1.blue - pixel2.blue),
- (pixel3.blue - pixel4.blue))
- if (red + green + blue) > 60
- if [red, green, blue].max == red
- @bitmap.set_pixel(x, y, Color.new(red + 20, green, blue,
- pixel1.alpha))
- elsif [red, green, blue].max == green
- @bitmap.set_pixel(x, y, Color.new(red, green + 20, blue,
- pixel1.alpha))
- elsif [red, green, blue].max == blue
- @bitmap.set_pixel(x, y, Color.new(red, green, blue + 20,
- pixel1.alpha))
- end
- else
- @bitmap.set_pixel(x, y, Color.new(0, 0, 0, pixel1.alpha))
- end
- end
- if x % 640 == 0 and x != 0
- self.contents.blt(0, 0, @bitmap, @bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_bnw
- for y in 0..@bitmap.height
- for x in 0..@bitmap.width
- a = @bitmap.get_pixel(x, y)
- shade = ((a.red + a.green + a.blue) / 3)
- @bitmap.set_pixel(x, y, Color.new(shade, shade, shade, a.alpha))
- end
- if x % 640 == 0 and x != 0
- self.contents.blt(0, 0, @bitmap, @bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_emboss
- for y in 0..@bitmap.height
- for x in 0..@bitmap.width
- a = @bitmap.get_pixel(x, y)
- b = @bitmap.get_pixel(x + 1, y + 1)
- red = (a.red - b.red + 128)
- red = red.abs
- green = (a.green - b.green + 128)
- green = green.abs
- blue = (a.blue - b.blue + 128)
- blue = blue.abs
- red = 255 if red > 255
- green = 255 if green > 255
- blue = 255 if blue > 255
- @bitmap.set_pixel(x, y, Color.new(red, green, blue, a.alpha))
- end
- if x % 640 == 0 and x != 0
- self.contents.blt(0, 0, @bitmap, @bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_minustwo
- for y in 0..@bitmap.height
- for x in 0..@bitmap.width
- a = @bitmap.get_pixel(x, y)
- b = @bitmap.get_pixel(x + 1, y + 1)
- color1 = (((a.red * 0.3) + (a.green * 0.6) + (a.blue * 0.1)) / 10)
- color2 = (((b.red * 0.3) + (b.green * 0.6) + (b.blue * 0.1)) / 10)
- if (color1 - color2) > 0.2
- @bitmap.set_pixel(x, y, Color.new(0, 0, 0, a.alpha))
- else
- @bitmap.set_pixel(x, y, Color.new(255, 255, 255, a.alpha))
- end
- end
- if x % 640 == 0 and x != 0
- self.contents.blt(0, 0, @bitmap, @bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_sepia
- for y in 0..@bitmap.height
- for x in 0..@bitmap.width
- a = @bitmap.get_pixel(x, y)
- red = ((a.red * 0.393) + (a.green * 0.769) + (a.blue * 0.189))
- green = ((a.red * 0.349) + (a.green * 0.686) + (a.blue * 0.168))
- blue = ((a.red * 0.272) + (a.green * 0.534) + (a.blue * 0.131))
- p blue if (y == 0 and x == 0)
- red = 255 if red > 255
- green = 255 if green > 255
- blue = 255 if blue > 255
- @bitmap.set_pixel(x, y, Color.new(red, green, blue, a.alpha))
- end
- if x % 640 == 0 and x != 0
- self.contents.blt(0, 0, @bitmap, @bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_sharpen
- red = 0
- green = 0
- blue = 0
- ap = 0.8
- for y in 0..@bitmap.height
- for x in 0..@bitmap.width
- a = @bitmap.get_pixel(x + 1, y + 1)
- b = @bitmap.get_pixel(x, y)
- red += a.red
- green += a.green
- blue += a.blue
- red = (b.red - (red / 3)) * ap + b.red
- green = (b.green - (green / 3)) * ap + b.green
- blue =(b.blue - (blue / 3)) * ap + b.blue
- red = 255 if red > 255
- green = 255 if green > 255
- blue = 255 if blue > 255
- red = 0 if red < 0
- green = 0 if green < 0
- blue = 0 if blue < 0
- @bitmap.set_pixel(x, y, Color.new(red, green, blue, b.alpha))
- end
- if x % 640 == 0 and x != 0
- self.contents.blt(0, 0, @bitmap, @bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_soften
- for y in 0..@bitmap.height
- for x in 0..@bitmap.width
- red = 0
- green = 0
- blue = 0
- for x_offset in -1..1
- for y_offset in -1..1
- a = @bitmap.get_pixel(x + x_offset, y + y_offset)
- red += a.red
- green += a.green
- blue += a.blue
- end
- end
- red /= 9
- green /= 9
- blue /= 9
- b = @bitmap.get_pixel(x, y)
- @bitmap.set_pixel(x, y, Color.new(red, green, blue, b.alpha))
- end
- if x % 640 == 0 and x != 0
- self.contents.blt(0, 0, @bitmap, @bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_splatter
- for y in 0..@bitmap.height
- for x in 0..@bitmap.width
- x_offset = rand(3) + 1
- y_offset = rand(3) + 1
- b = @bitmap.get_pixel(x + x_offset, y + y_offset)
- @bitmap.set_pixel(x, y, Color.new(b.red, b.green, b.blue, b.alpha))
- end
- if x % 640 == 0 and x != 0
- self.contents.blt(0, 0, @bitmap, @bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
-
-
-
- def self.shader_contrast
- conre = 1 ; ligre = 20
- congr = 2 ; liggr = 20
- conbl = 1 ; ligbl = 20
- ligre =(ligre-127*(conre-1))
- liggr =(liggr-127*(congr-1))
- ligbl =(ligbl-127*(conbl-1))
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- re = a.red*conre + ligre
- gr = a.green*congr + liggr
- bl = a.blue*conbl + ligbl
- re = 255 if re > 255 ; re = 0 if re < 0
- gr = 255 if gr > 255 ; gr = 0 if gr < 0
- bl = 255 if bl > 255 ; bl = 0 if bl < 0
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_negative
- conre = -2 ; ligre = 0
- congr = -2 ; liggr = 0
- conbl = -2 ; ligbl = 0
- ligre =(ligre-127*(conre-1))
- liggr =(liggr-127*(congr-1))
- ligbl =(ligbl-127*(conbl-1))
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- re = a.red*conre + ligre
- gr = a.green*congr + liggr
- bl = a.blue*conbl + ligbl
- re = 255 if re > 255 ; re = 0 if re < 0
- gr = 255 if gr > 255 ; gr = 0 if gr < 0
- bl = 255 if bl > 255 ; bl = 0 if bl < 0
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_cartoon
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- b = @bitmap.get_pixel(j,i)
- re = a.red+b.red
- gr = a.green+b.green
- bl = a.blue+b.blue
- re = 255 if re > 255 ; re = 0 if re < 0
- gr = 255 if gr > 255 ; gr = 0 if gr < 0
- bl = 255 if bl > 255 ; bl = 0 if bl < 0
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_bright
- ra = 50
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- b = @bitmap.get_pixel(j,i)
- re = (a.red>b.red ? a.red : b.red)
- gr = (a.green>b.green ? a.green : b.green)
- bl = (a.blue>b.blue ? a.blue : b.blue)
- al = (a.alpha>b.alpha ? a.alpha : b.alpha)
- @bitmap.set_pixel(j,i,Color.new(re+ra, gr+ra, bl+ra, al))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_bizarro
- ra = 100
- wh = 50
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- no = rand(ra)-ra+1
- re = a.red+no+wh ; gr = a.green+no+wh ; bl = a.blue+no+wh
- re = 255 if re > 255 ; re = 0 if re < 0
- gr = 255 if gr > 255 ; gr = 0 if gr < 0
- bl = 255 if bl > 255 ; bl = 0 if bl < 0
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_bulletholes
- ra = 10
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- if rand(101) < ra
- re = rand(256) ; gr = rand(256) ; bl = rand(256)
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_sill
- ra = 500
- re = 0 ; gr = 0 ; bl = 0
- for i in 1..(@bitmap.height-1)
- for j in 1..(@bitmap.width-1)
- for m in -1..1
- for n in -1..1
- if m != 0 and n != 0
- a = @bitmap.get_pixel(j+m,i+n)
- re = re + a.red
- gr = gr + a.green
- bl = bl + a.blue
- end
- end
- end
- b = @bitmap.get_pixel(j,i)
- re = (b.red-re/8).abs
- gr = (b.green-gr/8).abs
- bl = (b.blue-bl/8).abs
- if (re+gr+bl) > ra
- @bitmap.set_pixel(j,i,Color.new(255, 255, 255, b.alpha))
- else
- @bitmap.set_pixel(j,i,Color.new(0, 0, 0, b.alpha))
- end
- end
- if j % 639 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_bw2
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- re = (a.green-a.blue+a.green+a.red).abs
- re = re*a.red/256
- re = 255 if re > 255
- gr = (a.blue-a.green+a.blue+a.red).abs
- gr = gr*a.red/256
- gr = 255 if gr > 255
- bl = (a.blue-a.green+a.blue+a.red).abs
- bl = bl*a.green/256
- bl = 255 if bl > 255
- ma = (re+gr+bl)/3
- @bitmap.set_pixel(j,i,Color.new(ma, ma, ma, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_alien
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- re = (a.green-a.blue)**2/128
- re = 255 if re > 255
- gr = (a.red-a.blue)**2/128
- gr = 255 if gr > 255
- bl = (a.red-a.green)**2/128
- bl = 255 if bl > 255
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_monotone
- ccr = 255
- ccg = 255
- ccb = 50
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- ma = (a.red+a.green+a.blue)/3
- re = ma*ccr/255
- gr = ma*ccg/255
- bl = ma*ccb/255
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_enhance
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- re = a.red**2/255
- gr = a.green**2/255
- bl = a.blue**2/255
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_undead
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- re = a.green*a.blue/255
- gr = a.red*a.blue/255
- bl = a.red*a.green/255
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_wtf
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- re = Math.sin(Math.atan2(a.green, a.blue))*255
- gr = Math.sin(Math.atan2(a.blue, a.red))*255
- bl = Math.sin(Math.atan2(a.red, a.green))*255
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, a.alpha))
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
-
- def self.shader_plexiglass
- pow = 200
- lig_x = @bitmap.width/2
- lig_y = @bitmap.height/2
- rr = Math.hypot(lig_x,lig_y)
- rc = rr**2
- for i in 0..@bitmap.height
- for j in 0..@bitmap.width
- a = @bitmap.get_pixel(j,i)
- len = (j-lig_x)**2+(i-lig_y)**2
- if len < rc
- dis = Math.sqrt(len);
- bri = pow*(rr-dis)/rr
- re = a.red+bri
- gr = a.green+bri
- bl = a.blue+bri
- al = a.alpha+bri
- re = 255 if re > 255
- gr = 255 if gr > 255
- bl = 255 if bl > 255
- al = 255 if al > 255
- @bitmap.set_pixel(j,i,Color.new(re, gr, bl, al))
- end
- end
- if j % 640 == 0 and j != 0
- self.contents.blt(0,0,@bitmap,@bitmap.rect)
- Graphics.update
- end
- end
- return @bitmap
- end
Expand to see the code.
As a final note, your "Hyper Emboss" filter is looking very similar to Photoshop's "Glowing Edges" filter.
_________________
Just call me Glitch.
|
|