var tempbmp1, tempbmp2: TBGRABitmap; begin // Background Gradient tempbmp1:=TBGRABitmap.Create(btn1.Width,btn1.Height,BGRA(104,104,104,255)); tempbmp1.Canvas.GradientFill(Rect(1,Round(btn1.Height*0.25),btn1.Width-1,btn1.Height-1),$686868,$404040,gdVertical); // Frame Border tempbmp1.Canvas.Brush.Color:=$181818; tempbmp1.Canvas.FrameRect(btn1.ClientRect); // Light Gradient tempbmp2:=TBGRABitmap.Create(btn1.Width,btn1.Height,BGRA(0,0,0,0)); tempbmp2.GradientFill(1,1,btn1.Width-1,btn1.Height-1, BGRA(255,255,255,34), BGRA(255,255,255,10), gtLinear, PointF(btn1.ClientRect.Right,btn1.ClientRect.Top), PointF(btn1.ClientRect.Right,btn1.ClientRect.Bottom), dmDrawWithTransparency,True,False); tempbmp2.AlphaFillRect(2,2,btn1.Width-2,btn1.Height-2,0); // Merge Bitmaps tempbmp1.Canvas.Draw(0,0,tempbmp2.Bitmap); // Paint in Canvas btn1.Canvas.Draw(0,0,tempbmp1.Bitmap); // Free Bitmaps tempbmp1.Free; tempbmp2.Free;end;
var backBmp, lightBmp: TBGRABitmap; gradBmp: TBitmap;begin // Background Gradient gradBmp := DoubleGradientFill( btn2.ClientRect, $FFFAF5,$FAF0E6, $F4E6DC,$F7E9DD, gdVertical,gdVertical,gdVertical,0.5); // Use as background backBmp := TBGRABitmap.Create(gradBmp); gradBmp.Free; // Light Gradient lightBmp:= TBGRABitmap.Create(btn2.Width,btn2.Height,BGRA(0,0,0,0)); lightBmp.Rectangle(0,0,btn2.Width,btn2.Height-2, BGRA(255,255,255,100), dmSet); lightBmp.SetHorizLine(0,btn2.Height-1,btn2.Width-1,BGRA(160,175,195,255)); lightBmp.SetHorizLine(0,btn2.Height-2,btn2.Width-1,BGRA(205,218,234,255)); // Merge Bitmaps backBmp.PutImage(0,0,lightBmp,dmDrawWithTransparency); lightBmp.Free; // Paint in Canvas backBmp.Draw(btn2.Canvas,0,0,True); backBmp.Free; end;
Add some pictures
tempbmp1.Canvas.Draw(0,0,tempbmp2.Bitmap);
tempbmp2.Draw(tempbmp1.Canvas,0,0,False);
var backBmp, lightBmp: TBGRABitmap; gradBmp: TBitmap;begin // Background Gradient gradBmp := DoubleGradientFill( btn2.ClientRect, $FFFAF5,$FAF0E6, $F4E6DC,$F7E9DD, gdVertical,gdVertical,gdVertical,0.5); // Use as background backBmp := TBGRABitmap.Create(gradBmp); gradBmp.Free; // Light Gradient lightBmp:= TBGRABitmap.Create(btn2.Width,btn2.Height); lightBmp.Rectangle(0,0,btn2.Width,btn2.Height-2, BGRA(255,255,255,100), BGRA(255,255,255,0), dmDrawWithTransparency); lightBmp.DrawLine(0,btn2.Height-1,btn2.Width,btn2.Height-1,BGRA(160,175,195,255),True); lightBmp.DrawLine(0,btn2.Height-2,btn2.Width,btn2.Height-2,BGRA(205,218,234,255),True); // Merge Bitmaps backBmp.PutImage(0,0,lightBmp,dmDrawWithTransparency); lightBmp.Free; // Paint in Canvas backBmp.Draw(btn2.Canvas,0,0,True); backBmp.Free;end;
What do you mean?
lightBmp.Rectangle(0,0,btn2.Width,btn2.Height-2, BGRA(255,255,255,100), dmSet); lightBmp.SetHorizLine(0,btn2.Height-1,btn2.Width-1,BGRA(160,175,195,255)); lightBmp.SetHorizLine(0,btn2.Height-2,btn2.Width-1,BGRA(205,218,234,255));
var bmp: TBGRABitmap;begin ... bmp.CanvasFP.Rectangle(20,20,500,500);end;