Recent

Author Topic: BCFilters - the most easy filters in the world =)  (Read 6410 times)

lainz

  • Guest
BCFilters - the most easy filters in the world =)
« on: February 24, 2013, 04:11:05 am »
Well, I'm a newby in pixel filters, but I've done some of the most simple, some are available in bgrabitmap and lazpaint, but I like to play with those things!

I'm using ScanLine that's available in BGRABitmap.

The most nice thing of all is combine the filters in different ways, you can get some nice effects =) Also combine with BGRA blend modes , bgra filters and you're in the way of nicethings!

The filters in this example (7zip attached):
Code: [Select]
{ Invert colors, keep alpha }
procedure Invert(Bitmap: TBGRABitmap);
{ Invert colors, advanced options }
procedure Invert(Bitmap: TBGRABitmap; touchR, touchG, touchB, touchA: boolean);

{ GrayScale, keep alpha }
procedure GrayScale(Bitmap: TBGRABitmap);
{ GrayScale, keep alpha, pallete }
procedure GrayScale(Bitmap: TBGRABitmap; pallete: byte);
{ GrayScale, alpha 255}
procedure GrayScaleA(Bitmap: TBGRABitmap);

{ Noise random color, keep alpha }
procedure Noise(Bitmap: TBGRABitmap);
{ Noise random color, advanced options }
procedure Noise(Bitmap: TBGRABitmap; touchR, touchG, touchB, touchA: boolean);
{ Noise random color, random alpha }
procedure NoiseA(Bitmap: TBGRABitmap);

{ Noise random color, set max posible values }
procedure NoiseMax(Bitmap: TBGRABitmap; maxR, maxG, maxB, maxA: byte);
{ Noise random color, set max posible values, advanced options }
procedure NoiseMax(Bitmap: TBGRABitmap; maxR, maxG, maxB, maxA: byte;
  touchR, touchG, touchB, touchA: boolean);

{ Noise black and white, keep alpha }
procedure NoiseBW(Bitmap: TBGRABitmap);
{ Noise black and white, random alpha }
procedure NoiseBWA(Bitmap: TBGRABitmap);

{ TV Lines Horizontal }
procedure TVScanLinesH(Bitmap: TBGRABitmap);
{ TV Lines Vertical }
procedure TVScanLinesV(Bitmap: TBGRABitmap);
{ TV Dots }
procedure TVDots(Bitmap: TBGRABitmap);

{ Black and White, middle 128 }
procedure BlackAndWhite(Bitmap: TBGRABitmap);
{ Black and White, custom middle }
procedure BlackAndWhite(Bitmap: TBGRABitmap; middle: byte);

You can call quickly a filter with this procedure:

Code: [Select]
{ Filters that only need Bitmap as parameter }
procedure SimpleFilter(Bitmap: TBGRABitmap; Filter: TBCSimpleFilter);

Enjoy! Of course those are not optimized (I think), if you really want to use GrayScale and Invert, there are some available in BGRABitmap and lazpaint.
« Last Edit: March 09, 2013, 10:23:42 pm by lainz »

lainz

  • Guest
Re: BCFilters - the most easy filters in the world =)
« Reply #1 on: February 24, 2013, 05:57:15 pm »
Update (only the bcfilters pas file attached)
- Added GrayScale with pallete (you set the ammount of levels of gray you need)
- Added BlackAndWhite with middle (the value that separate black / white, default 128).

Enjoy.

PD: you can create a starfield simply adding a TrackBar and calling:

  Noise(Bitmap);
  BlackAndWhite(Bitmap, TrackBar1.Position); 
« Last Edit: February 24, 2013, 08:23:44 pm by lainz »

circular

  • Hero Member
  • *****
  • Posts: 3446
    • Personal webpage
Re: BCFilters - the most easy filters in the world =)
« Reply #2 on: February 24, 2013, 06:37:29 pm »
Yes, that's how you can do filters.

Some little advice :
- if you apply something to all pixels, you don't need to use Scanline, you can set your pointer to Data, and then do "for i := NbPixels-1 downto 0"
- if you want to invert a byte, you can do "not value" instead of "255-value"
Conscience is the debugger of the mind

lainz

  • Guest
Re: BCFilters - the most easy filters in the world =)
« Reply #3 on: February 24, 2013, 07:05:09 pm »
Ok I'll update soon.

I'm thinking how I can do a better black and white, like a progressive black and white (I remember that from corel photo paint).

I will try calling BlackAndWhite(Bitmap, n); 255 times and then blend all the images.

circular

  • Hero Member
  • *****
  • Posts: 3446
    • Personal webpage
Re: BCFilters - the most easy filters in the world =)
« Reply #4 on: February 24, 2013, 07:12:07 pm »
Don't do that  :D

You can apply do like grayscale, but before storing the value, apply some function to it.

For example : round(127.5+127.5*exp(-abs(value-128))*sign(value-128))
Conscience is the debugger of the mind

lainz

  • Guest
Re: BCFilters - the most easy filters in the world =)
« Reply #5 on: February 24, 2013, 08:26:29 pm »
Ok =) I'll try

New download, in the first post:
- I've updated with your suggestions.
- And I've added TVDots, also I've updated test, now you can apply BlackAndWhite or GrayScale whith a TrackBar to choose the value.

j0x

  • Full Member
  • ***
  • Posts: 126
Re: BCFilters - the most easy filters in the world =)
« Reply #6 on: March 07, 2013, 12:39:32 pm »
can you do Instagram Retro Filter Effects? and hopefully it will be added to LazPaint at some point, i googled and found that their is no Instagram Filters that is free and open source yet

lainz

  • Guest
Re: BCFilters - the most easy filters in the world =)
« Reply #7 on: March 07, 2013, 10:09:57 pm »
give me a website with the "original" and "result" images

it's possible using the current LazPaint with a bit of imagination... the instagram filters are really a combination of multiple filters, like color, light, partial blur, masks with patterns.... etc, search in google 'photoshop instagram filters and you'll see

grayscale was added "BGRA 7.1 - TBGRABitmap : InplaceGrayscale and grayscale task -> so you don't need to allocate a new bitmap to apply grayscale".

j0x

  • Full Member
  • ***
  • Posts: 126
Re: BCFilters - the most easy filters in the world =)
« Reply #8 on: March 08, 2013, 04:48:53 am »
give me a website with the "original" and "result" images

i do not know if this can be helpful but here goes - http://blog.spoongraphics.co.uk/articles/10-photoshop-actions-to-create-instagram-style-effects

lainz

  • Guest
Re: BCFilters - the most easy filters in the world =)
« Reply #9 on: March 08, 2013, 02:10:03 pm »
Ok let me try.

 

TinyPortal © 2005-2018