Author |
Topic  |
|
PeterPanino
   
951 Posts |
Posted - Sep 21 2020 : 17:40:40
|
How can I access the Shape images?
I would like to present the shapes to the user not only in a ComboBox but as THUMBNAILS in a Thumbnail View, like in Explorer. |
|
xequte
    
38798 Posts |
Posted - Sep 21 2020 : 19:41:46
|
Hi Peter
Please see the examples at IEDrawShape showing how to output all shapes:
http://www.imageen.com/help/IEDrawShape.html
You can also quickly draw shapes to a combo or list box:
http://www.imageen.com/help/IEDrawShapeToComboListBoxItem.html
or TImageEnMView:
http://www.imageen.com/help/AddShapesToImageEnMView.html:
// Save all shapes as gif files
for shp := Low(TIEShape) to High(TIEShape) do
begin
bmp := TIEBitmap.Create;
bmp.Allocate( Thumb_Size, Thumb_Size );
bmp.Fill(clWhite );
IEDrawShape( bmp.IECanvas, shp, 0, 0, bmp.Width, bmp.Height, iebTrue, clNone, 0, $00FF8000 );
bmp.write( 'D:\' + IEShapeToStr( shp ) +'.gif');
bmp.free;
end;
Nigel Xequte Software www.imageen.com
|
 |
|
PeterPanino
   
951 Posts |
Posted - Sep 22 2020 : 11:03:22
|
Generally: As combo- or list-boxes have only a 1-dimensional selection functionality, a 2-dimensional selection mode offered by thumbnail-views is a better UI-choice for 2-dimensional items like shapes. |
 |
|
xequte
    
38798 Posts |
|
PeterPanino
   
951 Posts |
Posted - Sep 22 2020 : 19:00:59
|
Thanks for the link! |
 |
|
PeterPanino
   
951 Posts |
Posted - Sep 23 2020 : 05:25:14
|
The TImageEnMView makes a nice selector
I am sure there is a method to give back the selected correct internal Shape index number even if parameter UniqueOnly = True? |
 |
|
PeterPanino
   
951 Posts |
Posted - Sep 23 2020 : 10:05:43
|
This is how I fill a TImageEnMView with shapes taking their colors from the current text-layer:

However, I was not able to figure out how to set the color of the area outside of the shape:

Can this color be set? |
 |
|
PeterPanino
   
951 Posts |
Posted - Sep 23 2020 : 10:21:40
|
Well, when setting AlphaFill = True the area gets filled. It seems to take its color from BackgroundColor in OnGetColors.
The documentation says: "AlphaFill uses an alpha background". Does this mean that the area outside of the shape is made transparent so that the background color shines through?
|
 |
|
PeterPanino
   
951 Posts |
Posted - Sep 23 2020 : 10:48:58
|
I am always amazed how enormous the possibilities of ImageEn are! |
 |
|
xequte
    
38798 Posts |
Posted - Sep 23 2020 : 17:32:22
|
Thanks for your compliments, Peter,
In 9.2.0 (next week), if you have used AddShapesToImageEnMView, you can access the shape of an item by typecastings its tag as TIEShape, e.g.
// Get selected shape
shp := TIEShape( ImageEnMView1.ImageTag[ ImageEnMView1.SelectedImage ]);
ShowMessage( IEShapeToStr( shp ));
Regarding your draw issue, the images you are adding to the TImageEnMView probably do not have alpha. Can you show me your fill code?
Nigel Xequte Software www.imageen.com
|
 |
|
PeterPanino
   
951 Posts |
Posted - Sep 25 2020 : 10:08:48
|
Hi Nigel,
good. Currently, I get the shape by:
procedure TForm1.ImageEnMView1Select(Sender: TObject; idx: Integer);
begin
ImageEnView1.Layers[FLayerIndex].BorderShape := TIEShape(idx);
end;
But accessing the shape from the shape-image tag is indeed a very good idea because it compensates for possible errors when UniqueOnly = True.
The problem with setting the color of the mentioned shape area has been solved by setting AlphaFill to True and with a smart color-management. |
 |
|
xequte
    
38798 Posts |
Posted - Sep 27 2020 : 16:11:52
|
Nicely done, Peter.
9.2.0 is out now too.
Nigel Xequte Software www.imageen.com
|
 |
|
PeterPanino
   
951 Posts |
Posted - Sep 27 2020 : 17:10:30
|
I've read the details. Looks very good. |
 |
|
|
Topic  |
|