ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Filling shapes with an image

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Scally Posted - Apr 22 2018 : 10:59:53
Is it possible to place an image inside polygon, circle, rect and other closed shapes? The fill is not color, but iebitmap, so that the images do not go beyond the shape.
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Apr 22 2018 : 19:47:42
Hi

Probably the easiest way is to add a layer mask to your image, See the LayersEditing\LayerMask demo:



You can make your mask, for example, by creating a shape layer and converting it to a mask layer. Something like:

procedure Tfmain.btnAddShapeMaskClick(Sender: TObject);
var
  prevLayer: TIELayer;
begin
  // Create a star shape, Fill area will be black for now
  ImageEnView1.LayersInsert( ImageEnView1.LayersCurrent + 1, iesStar5 );
  ImageEnView1.CurrentLayer.FillColor    := clBlack;
  ImageEnView1.CurrentLayer.BorderWidth  := 0;

  // Convert shape layer to an image layer
  ImageEnView1.CurrentLayer.ConvertToImageLayer( 1 );

  // Make 256 color and negative (so black becomes white transparency
  TIEImageLayer( ImageEnView1.CurrentLayer ).Bitmap.PixelFormat := ie8g;
  ImageEnView1.Proc.Negative();

  // Set this layer as a mask
  ImageEnView1.CurrentLayer.IsMask := True;

  // Layer must be hidden to work as mask
  ImageEnView1.CurrentLayer.Visible := False;

  // Make it the cover the underlying image
  prevLayer := ImageEnView1.Layers[ ImageEnView1.LayersCurrent - 1];
  ImageEnView1.CurrentLayer.PosX   := prevLayer.PosX;
  ImageEnView1.CurrentLayer.PosY   := prevLayer.PosY;
  ImageEnView1.CurrentLayer.Width  := prevLayer.Width;
  ImageEnView1.CurrentLayer.Height := prevLayer.Height;
end;





Nigel
Xequte Software
www.imageen.com