Page 2 of 2

Re: Merge & Position any no. of Images

Posted: Sun Mar 08, 2020 5:13 am
by RASHAD
Thanks KCC
Previous Posts updated

Re: Merge & Position any no. of Images

Posted: Sun Mar 08, 2020 11:14 am
by Lord
Hi!
davido wrote:...
2a. The pictures can be lost in all four directions.
...
Maybe a #PB_Canvas_ClipMouse is helpfull?

Edit:
I almost forgot:
#PB_Canvas_Keyboard has also to be added in order get mousewheel working.
At least here.

Re: Merge & Position any no. of Images

Posted: Sun Mar 08, 2020 1:30 pm
by ChrisR
Hi Rashad,
For the Added transparency effect as per infratec suggestion
You forgot to change the 2 lines that Bernd was referring to

Code: Select all

;DrawImage(ImageID(Images()\img),Images()\x,Images()\y) ==>
DrawAlphaImage(ImageID(Images()\img),Images()\x,Images()\y,Images()\alphatest) ; draw all images with z-order
 
;Procedure AddImage(x,y,img,alphatest=0) ==>
Procedure AddImage(x,y,img,alphatest=255)
I feel like a small newbie next to all of you and I have a lot to learn from all of you.
Thanks for sharing, it's very nice

Re: Merge & Position any no. of Images

Posted: Sun Mar 08, 2020 2:51 pm
by RASHAD
Thanks ChrisR
Sorry,I am doing these changes blindly after you and infratec
I spent a lot of time to get any images that can show me that effect
But without any success
Just added the changes and the necessary code to keep everything intact
Still doing the changes blindly after both of you :)
So you are in trouble if it did not work

Re: Merge & Position any no. of Images

Posted: Sun Mar 08, 2020 4:16 pm
by ChrisR
To get your good eyes back, I think you're playing with images that have their own transparency.
The addition here is to apply a transparency on an opaque image as below
ex with: #PB_Compiler_Home + "Examples\Sources\Data\Geebee2.bmp"

Image

RASHAD wrote:As I expected there is a problem with Procedure Bring2Top(index)
A little my fault with If ListSize(Images()) > 0 added
It seems better with If isCurrentItem

davido wrote:@RASHAD,
Could you introduce code to prevent images being moved out of bounds?
On my side I use the GridMatch procedure for that, if it can help

Code: Select all

Procedure.i GridMatch(Value.i, Min.i=0, Max.i=4096)
  If Value < Min
    ProcedureReturn Min
  ElseIf Value > Max
    ProcedureReturn Max
  Else
    ProcedureReturn Value
  EndIf
EndProcedure

;Todo also for Case 6,7,8,9 (eg case 9: If Images()\y < GadgetHeight(0)-10 : Images()\y + 1 : DrawCanvas() : EndIf)

Case #PB_EventType_MouseMove
...
;Images()\x = x - currentItemXOffset ==>
Images()\x = GridMatch(x - currentItemXOffset, 0, GadgetWidth(0)-10)
;Images()\y = y - currentItemYOffset ==>
Images()\y = GridMatch(y - currentItemYOffset, 0, GadgetHeight(0)-10)

Re: Merge & Position any no. of Images

Posted: Sun Mar 08, 2020 4:22 pm
by RASHAD
Hi ChrisR
Problem solved
I added preventing moving any image to left and top (Logic) to the 2 examples using native commands allready
I do not think that preventing moving right and bottom is a good idea while it is so easy to do it as I did for left & top
BTW :
No need for your Procedure it will be no good with grab the image by Mouse.
Thanks