zoukankan      html  css  js  c++  java
  • GdiPlus[16]: IGPLinearGradientBrush 之 SetBlendBellShape、SetBlendTriangularShape


    SetBlendBellShape 方法: 创建基于钟形曲线的渐变过渡过程;

    SetBlendTriangularShape 方法: 创建一个从中心色向两端单个颜色线性过渡的线性渐变过程.

    两个方法好像区别不大.

    SetBlendBellShape 测试效果图:



    SetBlendTriangularShape 测试效果图:



    SetBlendBellShape 测试代码:

    uses GdiPlus;
    
    procedure TForm1.FormPaint(Sender: TObject);
    var
      Graphics: IGPGraphics;
      Rect: TGPRectF;
      Brush: IGPLinearGradientBrush;
    begin
      Graphics := TGPGraphics.Create(Canvas.Handle);
      Rect.Initialize(10, 10, 120, 150);
      Brush := TGPLinearGradientBrush.Create(Rect, $FFFF0000, $FF0000FF, 0);
    
      Brush.SetBlendBellShape(1);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendBellShape(0.8);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
      
      Brush.SetBlendBellShape(0.5);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendBellShape(0.2);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendBellShape(0);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      //
      Graphics.TranslateTransform(-Graphics.Transform.OffsetX, Rect.Y + Rect.Height);
    
      Brush.SetBlendBellShape(1, 1);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendBellShape(1, 0.8);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
      
      Brush.SetBlendBellShape(1, 0.5);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendBellShape(1, 0.2);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendBellShape(1, 0);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    end;
    

    SetBlendTriangularShape 测试代码:

    uses GdiPlus;
    
    procedure TForm1.FormPaint(Sender: TObject);
    var
      Graphics: IGPGraphics;
      Rect: TGPRectF;
      Brush: IGPLinearGradientBrush;
    begin
      Graphics := TGPGraphics.Create(Canvas.Handle);
      Rect.Initialize(10, 10, 120, 150);
      Brush := TGPLinearGradientBrush.Create(Rect, $FFFF0000, $FF0000FF, 0);
    
      Brush.SetBlendBellShape(1);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendTriangularShape(0.8);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
      
      Brush.SetBlendTriangularShape(0.5);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendTriangularShape(0.2);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendTriangularShape(0);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      //
      Graphics.TranslateTransform(-Graphics.Transform.OffsetX, Rect.Y + Rect.Height);
    
      Brush.SetBlendTriangularShape(1, 1);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendTriangularShape(1, 0.8);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
      
      Brush.SetBlendTriangularShape(1, 0.5);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendTriangularShape(1, 0.2);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    
      Brush.SetBlendTriangularShape(1, 0);
      Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
      Graphics.FillEllipse(Brush, Rect);
    end;
    
  • 相关阅读:
    tomcat-1
    oscache-2
    oscache-3
    oscache-1
    oscache-4
    缓存概要
    Criterion & DetachedCriteria
    Hibernate <查询缓存>
    Hibernate <二级缓存>
    Hibernate <一级缓存>
  • 原文地址:https://www.cnblogs.com/del/p/1624159.html
Copyright © 2011-2022 走看看