Source language: Translate to:

Image Plugin - Simple drawing pane

Questions about NeoBook PlugIns

Moderator: Neosoft Support

Re: Image Plugin - Simple drawing pane

Postby schmutly » Sat Nov 23, 2013 6:21 am

ok,i am working on it now and saw email popup.
Will try that. Hans i am a bit confused where to put the
script when i am doing a rubberband to get the rectangle.
I almost got it working in the hpwImageFrameRect
i used the hpwImageGetRectArea "imageholder" "[SelColor]" "2"
to get the x1,x2,y1,y2 are of rectangle "imageholder" i want then
i used the results i sAw in the debugger into those
settings for hpwImageGetRectArea ,
namely,
imageholder_GetAreaEndX
imageholder_GetAreaEndY
imageholder_GetAreaStartX
imageholder_GetAreaStartY
I thought surely that would work but maybe those settings need to go
into the script and im just not doing it correclty.
Dont worry yourself , i will work this out..just need to think a little
on how these few commands work and i am sure i will get it.
Will go and try your suggestion below while i nut the other out.
Take care,
Rob
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: Image Plugin - Simple drawing pane

Postby HPW » Sat Nov 23, 2013 6:43 am

Hello,

Just played a bit with hpwImageGetRectArea and noticed that there is a bit missing for the workflow.
hpwImageGetRectArea sets only the start-Settings for the select process.
But since the select process happens interactiv after that, there is a need for a OnGetArea-event.
I think I have to further improve the command with a action-Parameter.

For now this must go in a seperate button:

Code: Select all
hpwImageFrameRect "RGetAreaImage" "[RGetAreaImage_GetAreaStartX]" "[RGetAreaImage_GetAreaStartY]" "[RGetAreaImage_GetAreaEndX]" "[RGetAreaImage_GetAreaEndY]" "clBlue" "2"


Regards
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Image Plugin - Simple drawing pane

Postby schmutly » Sat Nov 23, 2013 6:57 am

Ahh..Hans :)
I was actually close.
On your page 7 you have "get area" button.
Then you select a rectangle area onto object.
That area you stretched out disappears..i understand that all
it did was grab those x1,y1,x2,y2.
THEN .if you click the NEW button you just gave me it DRAWS that box
onto where you outlined the box to go.
What im trying to do is get those BOTH Actions to work together
so that once its outlined as you let go mouse it draws those lines.
So.....i am ASSUMING i put that button script into the "left mouse up"
but not sure where..
So...both those commands (both buttons) work perfect but id like to
do it in 1 step..so its almost there.
Probably something easy but i want to try and get it.
Thanks for your efforts..im finding this fun and really should go
to bed,,maybe a few hours :P
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: Image Plugin - Simple drawing pane

Postby HPW » Sat Nov 23, 2013 8:01 am

Just upload a new hpwImage 2.59:

http://www.hpwsoft.de/anmeldung/html1/n ... book5.html

Action: hpwImageSetActions - Can now delete Actions by setting to empty string.
Action: hpwImageGetRectArea - LeftClickUp processing is now handle before LeftClickUp-Action code

So after some more thinking, not a new action event was needed.
But the current actions needed some fixes. (As notes above)

Caution: In Page 7 GetArea-Button there is a call to hpwImageSetActions.
In its action-code is also a call to hpwImageSetActions itself.
Don't open the action wizard of a command in the action wizard of the same command! This will throw an access-violation in neobook.
You can use the action-editor but edit this command by hand.

So as you tried, the draw-action is performed when GetArea ended with LeftClickUp.
Then the SetActions.command wiped out the action, so it is no more fired on other LeftClickUp. Kind of SelfDestruction.
Of cource you can also call a sub-routine and do your work in the subroutine-editor.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Image Plugin - Simple drawing pane

Postby schmutly » Sat Nov 23, 2013 8:29 am

Wow thanks Hans :D
That did it.
Actually, in the "get area button" on page 7 i put these BOTH together in button and it worked
hpwImageGetRectArea "RGetAreaImage" "clRed" "2"
hpwImageSetActions "RGetAreaImage" "hpwImageFrameRect [#34]RGetAreaImage[#34] [#34][#91]RGetAreaImage_GetAreaStartX[#93][#34] [#34][#91]RGetAreaImage_GetAreaStartY[#93][#34] [#34][#91]RGetAreaImage_GetAreaEndX[#93][#34] [#34][#91]RGetAreaImage_GetAreaEndY[#93][#34] [#34]clBlue[#34] [#34]2[#34]" " " " " " " " " " " " "

So excellent :)
I will put this into my pub and try it.
Again, thanks for your perseverance and helping me out.
Hope i wasn't a pain, and i learned a lot by examining all these events and
scripts, and that's the point..I'm learning. :)
Cheers,
Robbie
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: Image Plugin - Simple drawing pane

Postby HPW » Sat Nov 23, 2013 8:41 am

Hello,

As shown in my demo, do not forget to reset the Action. If not, the draw Action is performed in any other LeftClick.

As you see my plugins are still work in progress, so I also have to learn further.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Image Plugin - Simple drawing pane

Postby HPW » Mon Nov 25, 2013 3:05 pm

Just upload a new hpwImage 2.60:

http://www.hpwsoft.de/anmeldung/html1/n ... book5.html

Nested calls of command-wizards no longer throw an access-violation.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Image Plugin - Simple drawing pane

Postby schmutly » Wed Feb 19, 2014 4:07 am

Hello Hans,
I cant find any docs but can you tell me where you get
the RGetAreaImage_--->GetAreaStartX <--- part?
I see the RGetAreaImage is this rectangle object but MUST those
coordinates for X1,Y1,X2,Y2 BE in that format:
ie: rectangle_GetAreaStartX ?
Im having trouble now with the hpwImageSetActions as in your Pub on
page 7, the GET AREA..i noticed this:
Image
Actually, i have the LClickX,Y ect show in MY debug window but the GetArea variables
don't show now and im not sure why.
Any ideas?
Robbie

AHHH:
There definately is SOMETHNG i am missing.
I copied all the objects on page 7 CTRL+A and created new Pub, pasted them in
and when you RUN this new PUB the DRAWLINES work and the DRAWPIXELS work but the Get Area does not
if the SetVar "[hpwImagePrepareGetRectArea]" "1" is GREYED out.
So there obviouly is some parameters or variables to pre-set but i cant see what.
I DID notice this:
SetVar "[hpwImagePrepareStamp]" "0"
SetVar "[hpwImagePrepareGetRectArea]" "1"
and a few others but i cant seem to find the docs that explain why/where these have to be set FIRST.
If i grey out the .SetVar "[hpwImagePrepareStamp]" "0" then it doesn't work (cant see rubber-band select moving)
but i tried pasting those preset variables & its not working. Yes...it was working, just trying to get some direction
in what i may have forgotten or placed in wrong order...Ill keep checking and come back later with findings.
Thanks Hans,
robbie

UPDATE:

Got it working again with those parameters in the right place, :D
but the top question about the Getarea and any docs am i missing somewhere?
Thanks :wink:
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: Image Plugin - Simple drawing pane

Postby HPW » Wed Feb 19, 2014 10:54 am

Hello,

Since I am developping my plugins mainly for my own needs, the priority is not to deliver fool-proof Software with top-doku.
This would go beyond Freeware. Providing command wizards for all commands is yet a lot work.

So the demo Pubs are the main source for self-study the command logic.

>>SetVar "[hpwImagePrepareGetRectArea]" "1"

This flag is set to provide a backbuffer during hpwImageCreate.
That is needed when you drag the Getarea-Rectangle over the Screen to restore the Background.

Also use:
SetVar "[hpwImageDoubleBuffered]" "TRUE"
to provide flickerfree dragging.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Image Plugin - Simple drawing pane

Postby schmutly » Thu Feb 20, 2014 12:37 am

Ok, no probs..got it Hans.
I must be getting old and didn't see a typo in
one of the variables, namely,[imageholder_GetAreaStartY]
was [imageholder_GetArreaStartY]. seems like you would'nt
miss that but you'd be surprised. :oops:
Thanks for the tips.
Rob
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: Image Plugin - Simple drawing pane

Postby UltraVox » Wed Jul 23, 2014 11:29 pm

Hello Hans,

I learned to use hpwImage 2.60 plugin and I have a question for you.

I would like to reduce (Zoom out) the size of an image within a rectangle, but not physically reduce the actual size of the image file. As in the Photoshop workspace, just zoom-out the image without changing the file. I work on very large images (2048x2048 pixels, for example), but the rectangle (workspace) is much smaller.

I think it is largely feasible but I do not know how, because I do not practice with this plugin.

Thank you for your reply.
UltraVox
 
Posts: 419
Joined: Sat Jul 28, 2007 11:14 am
Location: France

Re: Image Plugin - Simple drawing pane

Postby HPW » Thu Jul 24, 2014 1:00 am

Hello,

hpwImage is based on a simple TBitmap/TImage-object from Delphi. It can not be compared with a professional package like Photoshop.
It does not support any zooming. In fact even a photoshop has to calc a temporary new Bitmap in Memory to display it on Screen.
So maybe maybe scripting this with the scale-commands can be an Option.

Btw. hpwSimplegraph supports zooming, because the used Freeware component does support it out of the box. Maybe it can be used.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Image Plugin - Simple drawing pane

Postby UltraVox » Thu Jul 24, 2014 6:26 am

No Hans, I do not compare your plugin with Photoshop :)
It was just an example (zoom in / out).

Thank you for your reply!
UltraVox
 
Posts: 419
Joined: Sat Jul 28, 2007 11:14 am
Location: France

Re: Image Plugin - Simple drawing pane

Postby UltraVox » Fri Jul 25, 2014 3:04 am

Hans, this plugin is excellent. Lots of good things in it !

A question for you...

I do this to load a very large image :

Code: Select all
hpwImageCreate "WorkSpace" "" "" "" "" "" "" ""
hpwImageLoadFromFile "WorkSpace" "[FileWork]" "0" "0" "1" ""
hpwImageSize "[FileWork]" "[FileWork.X]" "[FileWork.Y]"
hpwImageSaveToFile "WorkSpace" "[Desktop][FileName]" "0" "0" "[FileWork.X]" "[FileWork.Y]"


The problem is that the NB Rectangle is much smaller than the image. Then, the image save has the good size (2048x2048), but the image portion saved has the size of the NB rectangle. :( So a lot of white color in the image saved, and a small portion of original image file (the NB rectangle only..)

Do you know how to save an image in a rectangle when it is larger than the rectangle ?

I also tried this :

Code: Select all
hpwImageCreate "WorkSpace" "" "" "" "" "" "" ""
hpwImageLoadFromFile "WorkSpace" "[FileWork]" "0" "0" "1" ""
hpwImageSize "[FileWork]" "[FileWork.X]" "[FileWork.Y]"
SizeObject "WorkSpace" "[FileWork.X]" "[FileWork.Y]"
hpwImageSaveToFile "WorkSpace" "[Desktop][FileName]" "0" "0" "[FileWork.X]" "[FileWork.Y]"


But it changes nothing. Do you know a solution ?
Best regards,
UltraVox
 
Posts: 419
Joined: Sat Jul 28, 2007 11:14 am
Location: France

Re: Image Plugin - Simple drawing pane

Postby HPW » Fri Jul 25, 2014 3:39 am

Hello,

hpwImage was not created with such big images in mind. Image memory is created in size of rectangle.
But over time some stuff was added.

In V 1.18 3/2003 a hpwImageSize was added to get size-info of a disk image without loading it.

in V 2.02 3/2005 [hpwImageAbsoluteXSize] and [hpwImageAbsoluteYSize] allow to create Images bigger than the rectangle (invisible)
Optional you could make a bigger invisible rectangle offscreen of your app.

You may have a look at Page 2 of the demo for handling a image inside the rectangle.

As said above, this may help, but is not so professional as found in commercial software in function like panning and scrolling.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

PreviousNext

Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 1 guest