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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 index position of the layer
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Borut

15 Posts

Posted - Feb 15 2023 :  13:41:55  Show Profile  Reply
Hi,

I am arranging a set of layers.

I am using (*for example) this line to put the 7th Layer in the set of 12 - in a random position between 0 to 11.

ImageEnViewBaseH->Layers[6]->LayerIndex=random(12);
ImageEnViewBaseH->Update();

It seems that moving a layer to a different position somehow changes the positions among the other layers too.
Do I have to do something else to preserve the order of the other layers, while moving just one layer somewhere in midst of them?

Thanks,
Borut

xequte

38182 Posts

Posted - Feb 15 2023 :  14:55:28  Show Profile  Reply
Hi Borut

Setting LayerIndex is the same as calling LayersArrange():

http://www.imageen.com/help/TImageEnView.LayersArrange.html


I would expect it to function as follows...

Base layer positions:

0: BG
1: L1
2: L2
3: L3
4: L4*
5: L5
6: L6
7: L7


Positions if Set L4 index to 2, which is same as LayersArrange(4, 2):

0: BG
1: L1
2: L4*
3: L2
4: L3
5: L5
6: L6
7: L7


Alternatively, these would be the positions if we had set L4 index to 6, which is same as LayersArrange(4, 6):

0: BG
1: L1
2: L2
3: L3
4: L5
5: L6
6: L4*
7: L7

Is that not what you are seeing?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Borut

15 Posts

Posted - Feb 16 2023 :  01:14:40  Show Profile  Reply
Hello Nigel,

thanks for your answer. I will check your advice with LayersArrange() as soon as possible, and let you know.
Thanks again,
Borut
Go to Top of Page

Borut

15 Posts

Posted - Feb 18 2023 :  17:55:09  Show Profile  Reply
Hi Nigel,

LayersArrange() does it what you said.
I found where is the problem, namely:

The particular layer is connected to his characteristic transparency alpha, (which is specifically changing over time ).


ImageEnViewBaseH->Layers[1]->Transparency= alpha[1];
..
..
..
ImageEnViewBaseH->Layers[7]->Transparency= alpha[7];

When I change the position of the layer8 with let's say LayersArrange(8,3),

it gets its new transparency value from alpha[3], and that results in strange behavior of images. Actually many layers go through this change, due to subsequent changes in their positions - after changing the initial one.

Is there a simple way to preserve the characteristics (transparency in my case) of the layers while changing their order in the set?

Thanks,
Borut
Go to Top of Page

xequte

38182 Posts

Posted - Feb 20 2023 :  00:20:33  Show Profile  Reply
Hi Borut

That should not be occurring. When you arrange layers then, *all* the properties of the layer should be moved too.

I cannot reproduce what you are seeing. Can you give me some specific steps to reproduce it?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Borut

15 Posts

Posted - Feb 22 2023 :  02:05:16  Show Profile  Reply
Hello Nigel,

I have a set of layers and a set of values that represent the transparency of the particular layer. They are connected by:
ImageEnViewBaseH->Layers[j]->Transparency= alpha[j];
The alpha[j] value for a particular layer gradually changes with time.
So at the beginning for example the seventh layer shows transparency alpha[7] (some integer value, I keep track of these values, not to exceed 255 and for some other reasons):
ImageEnViewBaseH->Layers[7]->Transparency= alpha[7];
I assume that in the moment of changing of position of the layer (let's say LayersArrange(7,3), the image in the seventh layer becomes the image in the third layer and correspondingly gets its new alpha value from alpha[3]:
ImageEnViewBaseH->Layers[j]->Transparency= alpha[j]; actually means then
ImageEnViewBaseH->Layers[7]->Transparency= alpha[3];
Since alpha[3] and alpha[7] differ in their value this results in a sudden change of the image.

Am I wrong?

Borut

P.S:
If this is actually happening, the problem for me is also, that by moving a layer I lose track of the layer.
If I want to reach a particular image (let's say the image7, which was in Layers[7] at the beginning) to do something with it, after a few repositions, it is hard to tell where it is...
Go to Top of Page

xequte

38182 Posts

Posted - Feb 22 2023 :  03:32:19  Show Profile  Reply
Hi Borut

It's hard for me to understand your usage here. Can you not just swap your alpha array items at the time you swap the layers?

If there is a bug here, and I cannot see one from what you are describing, please create a very simple demo that illustrates it and send it to me?


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Borut

15 Posts

Posted - Feb 22 2023 :  13:55:11  Show Profile  Reply
Hi Nigel,

I don't believe there is a bug, and I can swap the alpha array.
Yet, the problem of losing the track of (let's say)image7 which originally stayed in ImageEnViewBaseH->Layers[7] remains. So whenever I want to change something with image7 (change hue for example) I can not do it, because I don't exactly know where it is.

I just thought, that maybe there is a sort of index ascribed to Layers[i], which would when changed - put a layer (together with alpha property) in a particular place among other layers. In that way swapping would not be necessary and image7 would be constantly connected to ImageEnViewBaseH->Layers[7].

Borut
Go to Top of Page

xequte

38182 Posts

Posted - Feb 22 2023 :  21:28:10  Show Profile  Reply
Hi Borut

You could add your own "Index", e.g. using the Tag property:

https://www.imageen.com/help/TIELayer.Tag.html


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Borut

15 Posts

Posted - Feb 23 2023 :  01:30:42  Show Profile  Reply
Hi Nigel,

Thanks, I will try it.
Is there a way of changing the transparency of the bitmap inside a particular layer?
Something like:
ImageEnViewBaseH->CurrentLayer->Bitmap->Alpha=alpha[i];
In this case, the need for swapping etc....wouldn't be necessary, because I would be able to change the transparency of the image regardless of the position of the layer.
Thanks again.
Borut

Go to Top of Page

xequte

38182 Posts

Posted - Feb 23 2023 :  22:15:19  Show Profile  Reply
Hi Borut

It would permanently change the image alpha, but you cause use:

ImageEnViewBaseH.CurrentLayer.Bitmap.AlphaFill( alpha[i] );

http://www.imageen.com/help/TIEBitmap.AlphaFill.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Borut

15 Posts

Posted - Feb 25 2023 :  14:12:19  Show Profile  Reply
Hi Nigel,
thanks for help,
it works.
Borut
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: