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
 rubber stamping shapes

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
email_toan Posted - Apr 21 2025 : 10:18:07
I'd like to allow users to add shape layers, however I'd like to temporarily change the mouse cursor to the selected shape. That way, users can preview and position the shape prior to "rubber stamping" the shape layer. It is similar to Photoshop Brush where the cursor changes to a circle.

I was thinking of creating a temporary layer and responding to mousemove event, but wanted to know if there is an easier way or if the feature already exists.

Any help would be appreciated.
7   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Apr 25 2025 : 21:43:26
Sorry, I am unable to reproduce that.

Nigel
Xequte Software
www.imageen.com
email_toan Posted - Apr 25 2025 : 18:27:25
Yes, if I don't do that, the cursor eventually disappears after several image loads.
xequte Posted - Apr 25 2025 : 17:12:07
Sorry, do you mean this is needed:

ImageEnView1.SetZoneCursorBitmap( nil);
ImageEnView1.IO.LoadFromFile( 'D:\image.jpg' );
ImageEnView1.SetZoneCursorBitmap( fCursorBMP );


Nigel
Xequte Software
www.imageen.com
email_toan Posted - Apr 25 2025 : 13:13:56
OK, I found the issue. I needed to call SetZoneCursorBitmap(nil) prior to reloading with new a background image.
xequte Posted - Apr 25 2025 : 00:56:16
Hi

Can you test setting

ZoneCursor := iecsDefault;

Afterwards?

Also, ensure you call Update().

Nigel
Xequte Software
www.imageen.com
email_toan Posted - Apr 24 2025 : 17:29:02
Thanks for the code Nigel.

I'm running into an issue where passing Nil to SetZoneCursorBitmap sometime causes the cursor to disappear.

I've tried setting the self.cursor to crDefault on top of passing Nil to SetZoneCursorBitmap. It doesn't seem to resolve the issue.

Suggestions?

tn
xequte Posted - Apr 21 2025 : 21:50:11
Yes, you can do it like this:

procedure Tfmain.btnStarStampClick(Sender: TObject);
const
  Stamp_Border_Color = clRed;
  Stamp_Border_Width = 2;
  Stamp_Fill_Color   = clYellow;
  Stamp_Shape        = iesStar5;
  Stamp_Width        = 50;
  Stamp_Height       = 50;
var
  cursorBMP: TIEBitmap;
begin
  // Add a star every time the layer clicks on the image
  // Note: Can also use OnNewLayer event to customize layer

  // Set default styles
  ImageEnView1.LayerDefaults.Clear();
  ImageEnView1.LayerDefaults.Values[ IELP_BorderColor ] := ColorToString( Stamp_Border_Color );
  ImageEnView1.LayerDefaults.Values[ IELP_BorderWidth ] := IntToStr( Stamp_Border_Width );
  ImageEnView1.LayerDefaults.Values[ IELP_FillColor ] := ColorToString( Stamp_Fill_Color );
  // Easier to use DefaultLayerShape... ImageEnView1.LayerDefaults.Values[ IELP_Shape  ]    := IntToStr( Ord( Stamp_Shape ));
  ImageEnView1.LayerDefaults.Values[ IELP_Width ]     := IntToStr( Stamp_Width );
  ImageEnView1.LayerDefaults.Values[ IELP_Height ]    := IntToStr( Stamp_Height );

  ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loStampMode ];
  IEGlobalSettings().DefaultLayerShape := Stamp_Shape;
  ImageEnView1.MouseInteractLayers := [mlCreateShapeLayers];

  // Show a matching star shaped cursor
  cursorBMP := TIEBitmap.Create( Stamp_Width, Stamp_Height, clWhite, 0 {Transparent background} );
  try
    cursorBMP.FillWithShape( Stamp_Shape, Stamp_Width, Stamp_Height, Stamp_Border_Color, Stamp_Border_Width, Stamp_Fill_Color, True, False );
    ImageEnView1.SetZoneCursorBitmap( cursorBMP );
  finally
    cursorBMP.Free;
  end;
end;


Nigel
Xequte Software
www.imageen.com