Photo Manipulation: Lomography
Download this plugin here:
Lomography.zip 5.42K
1496 downloads How to install plugins: http://www.boltbait....lingEffects.asp
If that doesn't work, post your troubles here: http://forums.getpai...roubleshooting/

CodeLab source code here:
// Author: BoltBait
// Submenu: Photo
// Name: Lomography
// URL: http://www.BoltBait.com/pdn
#region UICode
int Amount1=-10; // [-100,0] Exposure
#endregion
// Setup for using a specific pixel op
private UnaryPixelOps.Desaturate desaturateOp = new UnaryPixelOps.Desaturate();
// Setup for using a specific blend op
private UserBlendOps.NormalBlendOp normalOp = new UserBlendOps.NormalBlendOp();
private UserBlendOps.MultiplyBlendOp multiplyOp = new UserBlendOps.MultiplyBlendOp();
unsafe void Render(Surface dst, Surface src, Rectangle rect)
{
Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
// Delete these 2 lines if you don't need to know the center point of the current selection
int CenterX = ((selection.Right - selection.Left) / 2) + selection.Left;
int CenterY = ((selection.Bottom - selection.Top) / 2) + selection.Top;
int MaxWidth = (int)(((src.Width > src.Height)?src.Width:src.Height) * 1.2)/2;
int MinWidth = (int)(((src.Width > src.Height)?src.Width:src.Height) * 0.5)/2;
int Dif = MaxWidth - MinWidth;
// Setup for calling the Brightness and Contrast Adjustment function
BrightnessAndContrastAdjustment bacAdjustment = new BrightnessAndContrastAdjustment();
PropertyCollection bacProps = bacAdjustment.CreatePropertyCollection();
PropertyBasedEffectConfigToken bacParameters = new PropertyBasedEffectConfigToken(bacProps);
bacParameters.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Brightness, Amount1);
bacParameters.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Contrast, 45);
bacAdjustment.SetRenderInfo(bacParameters, new RenderArgs(dst), new RenderArgs(src));
// Call the Brightness and Contrast Adjustment function
bacAdjustment.Render(new Rectangle[1] {rect},0,1);
// Now in the main render loop, the dst canvas has an adjusted version of the src canvas
for (int y = rect.Top; y < rect.Bottom; y++)
{
ColorBgra* srcPtr = src.GetPointAddressUnchecked(rect.Left, y);
ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y);
for (int x = rect.Left; x < rect.Right; x++)
{
ColorBgra CurrentPixel = *dstPtr;
int a = (int)Math.Abs(CenterX - x);
int b = (int)Math.Abs(CenterY - y);
double c = Math.Sqrt( a*a + b*b );
if (c > MaxWidth)
{
CurrentPixel = ColorBgra.Black;
}
else
{
if (c >= MinWidth)
{
CurrentPixel = ColorBgra.Black;
CurrentPixel.A = (byte)(255*((-Math.Cos((c-MinWidth)/Dif * Math.PI)+1)/2));
}
else
{
CurrentPixel.A = 255;
}
}
CurrentPixel = normalOp.Apply(*dstPtr, CurrentPixel);
*dstPtr = CurrentPixel;
CurrentPixel = desaturateOp.Apply(CurrentPixel);
*dstPtr = multiplyOp.Apply(*dstPtr, CurrentPixel);
srcPtr++;
dstPtr++;
}
}
}Enjoy.

























