setting the brushColor to transparent color
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 16
- Joined: Sun Apr 09, 2006 9:49 pm
- Location: Irvine, CA, USA
setting the brushColor to transparent color
Hi all,
I posted this question on the rev-list and got no answer as yet. So here goes.
Can the brushColor have a transparency to it?
eg: in my application, the user can import a snapshot and then with a click of a button, set the tool to a brush and then pick a color (yellow) to hilite part of the imported image. Such as using the Sharpie Highlighter on a printed document.
So the color has to have transparency setting. Otherwise using the brush will just wipe over with the selected yellow.
TIA,
Mark Stuart
I posted this question on the rev-list and got no answer as yet. So here goes.
Can the brushColor have a transparency to it?
eg: in my application, the user can import a snapshot and then with a click of a button, set the tool to a brush and then pick a color (yellow) to hilite part of the imported image. Such as using the Sharpie Highlighter on a printed document.
So the color has to have transparency setting. Otherwise using the brush will just wipe over with the selected yellow.
TIA,
Mark Stuart
-
- Livecode Opensource Backer
- Posts: 16
- Joined: Sun Apr 09, 2006 9:49 pm
- Location: Irvine, CA, USA
re: setting the brushColor to transparent color
Ouch!
Danke Klaus.
I'll submit an enhancement request.
Danke Klaus.
I'll submit an enhancement request.
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Hi Mark,
you could probably overlay your snapshot with an empty image of the same size and set the transparency of this image to about 50 to 60. Then your user can hilite the part of the imported image with a yellow 'pen' on your overlay.
Depending on your needs this might work. If you want to preserve the markings you could again take a snapshot?
regards
Bernd
you could probably overlay your snapshot with an empty image of the same size and set the transparency of this image to about 50 to 60. Then your user can hilite the part of the imported image with a yellow 'pen' on your overlay.
Depending on your needs this might work. If you want to preserve the markings you could again take a snapshot?
regards
Bernd
-
- Livecode Opensource Backer
- Posts: 16
- Joined: Sun Apr 09, 2006 9:49 pm
- Location: Irvine, CA, USA
Bernd,
I did as you suggested, and that worked for me.
On a test stack, I imported an image, added an image object (the overlay), set the Blending level to 60. Manually selected the brush and set the color. "Swiped" over the image and walla - it works, I have transparency on the overlay.
Now to make it work like SnagIt - hold mouse down and drag, creates a square/oblong shape with handles to allow the user to move the overlay and change its shape/dimensions. Cool.
Thanx,
Mark Stuart
I did as you suggested, and that worked for me.
On a test stack, I imported an image, added an image object (the overlay), set the Blending level to 60. Manually selected the brush and set the color. "Swiped" over the image and walla - it works, I have transparency on the overlay.
Now to make it work like SnagIt - hold mouse down and drag, creates a square/oblong shape with handles to allow the user to move the overlay and change its shape/dimensions. Cool.
Thanx,
Mark Stuart
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Hi Mark,
glad it worked for you.
just in case you want to 'freeze' the changes to the pict and you want to do it with a snapshot you will want to use the global coordinates to reference the area of the first image, since refering to the rect of the first image gives you a snapshot without the overlay.
if you refer to the first image:
above code as a reminder (to myself)..., because I ran into this problem
cheers
Bernd
glad it worked for you.
just in case you want to 'freeze' the changes to the pict and you want to do it with a snapshot you will want to use the global coordinates to reference the area of the first image, since refering to the rect of the first image gives you a snapshot without the overlay.
if you refer to the first image:
Code: Select all
put the rect of image "NameOfFirstImage" into myRect
put item 1 to 2 of myRect into tTopLeft
put item 3 to 4 of myRect into tBottomRight
put globalloc(tTopLeft) into item 1 to 2 of myRect
put globalloc(tBottomRight) into item 3 to 4 of myRect
import snapshot from rect myRect
cheers
Bernd
-
- Livecode Opensource Backer
- Posts: 16
- Joined: Sun Apr 09, 2006 9:49 pm
- Location: Irvine, CA, USA
Hi Bernd,
Haven't tried your code as yet, but does it capture the "overlay" as well?
What I would like to do...
Option to "flatten the image" to not only capture the original image, but also the "additions" by the user into the "overlay" image. Basically, this would combine all overlays into one image.
cheers,
Mark Sruart
Haven't tried your code as yet, but does it capture the "overlay" as well?
What I would like to do...
Option to "flatten the image" to not only capture the original image, but also the "additions" by the user into the "overlay" image. Basically, this would combine all overlays into one image.
cheers,
Mark Sruart
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Location: Aalst, Belgium
- Contact:
Another solution for 'flattening' your image is to group the two (or more) images and then use the following one-liner:
Instead of PNG, you can also use JPEG or GIF. If your software has a trial version, you could add a translucent field with white text to the mix in order to watermark the image.
The advantage of this approach is that it's done entirely in Revolution's back-buffer, and a suddenly appearing overlapping window can't interfere with it.
Hope this helped,
Jan Schenkel.
Code: Select all
export snapshot from group "ImageAndOverlays" to file theFilePath as PNG
The advantage of this approach is that it's done entirely in Revolution's back-buffer, and a suddenly appearing overlapping window can't interfere with it.
Hope this helped,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Hi Mark,
If you take the snapshot from the global coordinates as in the code I posted it "flattens" the image, i.e. takes a snapshot from the original image and the second image with the marks.
Also Jan posted a different approach to flattening the image by grouping them.
BTW you probably could do similar things with graphics on top of your first image, should work just as well and depending on what you want might be a consideration (it would probably easier to implement an undo among other things) just set the opaque of the graphic to false, adjust color
"set the foregroundcolor of graphic "xyz" to red" etc.
regards
If you take the snapshot from the global coordinates as in the code I posted it "flattens" the image, i.e. takes a snapshot from the original image and the second image with the marks.
Also Jan posted a different approach to flattening the image by grouping them.
BTW you probably could do similar things with graphics on top of your first image, should work just as well and depending on what you want might be a consideration (it would probably easier to implement an undo among other things) just set the opaque of the graphic to false, adjust color
"set the foregroundcolor of graphic "xyz" to red" etc.
regards