zoukankan      html  css  js  c++  java
  • GdiPlus[8]: IGPTextureBrush 之 WrapMode 属性


    示例图片:



    示例代码:

    uses GdiPlus;
    
    procedure TForm1.FormPaint(Sender: TObject);
    var
      Graphics: IGPGraphics;
      Image: IGPImage;
      Brush: IGPTextureBrush;
      Rect: TGPRect;
    begin
      ChDir('C:\GdiPlusImg\');
      Image := TGPImage.Create('HouseAndTree.gif');
      Brush := TGPTextureBrush.Create(Image);
      Graphics := TGPGraphics.Create(Handle);
      Rect.Initialize(Image.Width, Image.Height, Image.Width * 2, Image.Height * 2);
    
      Graphics.Clear($FFFFFFFF);
      Graphics.DrawImage(Image, 0, 0, Image.Width, Image.Height);
    
      //Brush.WrapMode := WrapModeTile; //默认
      Graphics.FillRectangle(Brush, Rect);
    
      Brush.WrapMode := WrapModeTileFlipX;
      Graphics.TranslateTransform(0, Rect.Y + Rect.Height);
      Graphics.FillRectangle(Brush, Rect);
    
      Brush.WrapMode := WrapModeTileFlipY;
      Graphics.TranslateTransform(Rect.X + Rect.Width, -Graphics.Transform.OffsetY);
      Graphics.FillRectangle(Brush, Rect);
    
      Brush.WrapMode := WrapModeTileFlipXY;
      Graphics.TranslateTransform(0, Rect.Y + Rect.Height);
      Graphics.FillRectangle(Brush, Rect);
    end;
    
  • 相关阅读:
    Java SE——线程介绍
    Vue
    Spring asm
    spring 自定义标签的实现
    Spring InitializingBean 接口以及Aware接口实现的原理
    值传递与引用传递
    redis学习
    ssm多数据源配置
    redis 启动
    json的设置
  • 原文地址:https://www.cnblogs.com/del/p/1623216.html
Copyright © 2011-2022 走看看