HI
I wanna implement the midpoint concept in Photoshop gradient using BGRA gradinet, as you can see in Screenshots attached (Left one is Photoshop gradinet for midpoint in its default position which is 50% and right one is the midpoint in 20% of the left color), the concept of midpoint in Photoshop is that we can change the location of the midpoint by dragging the icon closer to one color or the other. For example, when I drag it towards the left so it's closer to green stop. Notice the effect it's had on the gradient. With the midpoint now closer to green, I've shortened the transition area between green and the midpoint, and lengthened the transition between the midpoint and red.
it is not something i can implement by adding a middle point (a new color and a new position) in BGRA gradinet method, any idea how to implement this concept using BGRA gradinet methods?? Any idea??
(This question was raised first time in the thread:
http://forum.lazarus.freepascal.org/index.php/topic,31536.msg209491.html#msg209491and I wanted to continue it in a new topic for gaining more idea or help and to be seen as a new topic generally.)
Any help appreciated prior
Regards
Here is my code for drawing the gradinet:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, Menus,
BGRABitmap, BGRABitmapTypes, BGRAGradients, BGRAGradientScanner, BGRAResample;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormPaint(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
var
bmp: TBGRABitmap;
p1, p2: TPointF;
g: TBGRAMultiGradient;
gs: TBGRAGradientScanner;
begin
bmp := TBGRABitmap.Create(Width, Height, clWhite);
p1 := PointF(0, Height / 2);
p2 := PointF(Width, Height / 2);
g := TBGRAMultiGradient.Create([BGRA(0, 0, 255), BGRA(0, 255, 0), BGRA(255, 0, 0)], [0, 0.5, 1], True, False);
g.InterpolationFunction := @g.CosineInterpolation;
gs := TBGRAGradientScanner.Create(g, gtLinear, p1, p2);
BGRASetGamma(1.45);
bmp.FillRectAntialias(0, 0, Width, Height, gs);
bmp.SaveToFile('Pics\BGRA_50%.png');
bmp.Draw(Canvas, 0, 0);
bmp.Free;
end;
end.