• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Highlighter tool
#1
Hi Mike,
I've noticed the highlighter tool draws it's lines by covering up what is in the background, instead of being transparent like a true highlighter. 
I know we can set it's transparency level so it becomes a bit transparent, but doing so we loose half of the colour of the line, and the background becomes a bit less contrasted.
In drawing apps as Photoshop the highlighter effect is made by setting overlapping mode to "multiply", so that every level can maintain full colour and contrast even if they are set to 100% opacity. Do you think it would be possible also in MSP?
Marco

Samsung Galaxy Note Pro 12,2" - Nord Stage 2 HA88
Reply
#2
I agree with mcrossy. That's an important disadvantage of MSPs highlighter tool.
Sometimes I use the highlighter of my PDFReader that has "multiply mode" and highlight directly in the PDF losing all of MSPs flexibility.
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 1803
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#3
It's definitely something I want to do, and I've tried to explore how to do it, but I haven't found anything that has worked so far. I've tried changing the way the painting of the highlighter works on Android by utilizing different PorderDuff Xfermode values, but no matter what I try, the drawing either goes on top of the image or behind it. So that approach doesn't seem to be sufficient unless I'm doing something wrong. That leads me to believe I have to modify the pixels behind on the content on the page myself instead of relying on a blending/multiplying technique. Having to modify the pixel values of the bitmap representing the page is not the simplest thing when dealing with a freeform drawing, which is why I haven't done something about this yet.

Mike
Reply
#4
(06-03-2018, 04:36 AM)Zuberman Wrote: It's definitely something I want to do, and I've tried to explore how to do it, but I haven't found anything that has worked so far. I've tried changing the way the painting of the highlighter works on Android by utilizing different PorderDuff Xfermode values, but no matter what I try, the drawing either goes on top of the image or behind it. So that approach doesn't seem to be sufficient unless I'm doing something wrong. That leads me to believe I have to modify the pixels behind on the content on the page myself instead of relying on a blending/multiplying technique. Having to modify the pixel values of the bitmap representing the page is not the simplest thing when dealing with a freeform drawing, which is why I haven't done something about this yet.

Mike

Hi Mike,

my idea could be making some kind of "mathematical operations" between graphic layers. In this way it could be possible to add or multiply, or even subtract, two or more layers so that their values combine themselves.

I've found this page: https://developer.android.com/reference/...rDuff.Mode, maybe you've already seen it, anyway it seems to have some interesting infos on blending layers. Hope it helps...


Attached Files Thumbnail(s)
   
Marco

Samsung Galaxy Note Pro 12,2" - Nord Stage 2 HA88
Reply
#5
That's exactly what I tried to use. Here's something interesting I just found though - it works perfectly when using the rectangle draw mode for the highlighter. The highlight correctly goes behind the text (as the pixels are multipled and merged). The bug appears to be with using a Path to draw the highlight in combination with the porterduff xfermode. What I'm seeing is a black box around the highlight with the hightlight behind the black text. I'm trying to look for information, but I'm really hoping this isn't a limitation in Google's code. If I can figure out how to get past the issue with the black box, then I'll have a working solution (for Android at least, I don't think Windows 10 has an equivalent).

Mike
Reply
#6
Well I found a solution. It's not the most performant, but I think in this case, having the highlighter function like people would expect is more important.

Thanks,
Mike
Reply
#7
I've found these two articles about drawing layers in Android:

https://stackoverflow.com/questions/2739...-imageview

https://developer.android.com/reference/...erDrawable

Did you already seen them?
Marco

Samsung Galaxy Note Pro 12,2" - Nord Stage 2 HA88
Reply
#8
Those aren't really applicable for this. I'm using a Canvas to draw a Path object on top of an existing ImageView. So in order to blend the pixels, I have to use a PorterDuffXferMode with the Paint object used to draw the Path. There is an issue when doing that directly on top of the ImageView though, so instead, I have to render the freeform annotation to a background bitmap, then blend the two bitmaps.

Mike
Reply
#9
Seems a good trick! ;-)
Marco

Samsung Galaxy Note Pro 12,2" - Nord Stage 2 HA88
Reply
#10
Stupid suggestion maybe, but isn't it possible to draw a Path object below an existing ImageView?
Johan
www.johanvromans.nlwww.hetgeluidvanseptember.nlwww.howsagoin.nl
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0, AirTurn Duo & Digit.
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Reply
#11
The ImageView contains an opaque bitmap (the rendered score) using RGB 565 which dramatically reduces memory usage versus using ARGB8888. Most scores don't actually have transparent backgrounds though - they have solid white. So rendering the path under the ImageView would result in no blending occurring at all. It's a good thought though, but I think the real issue here is the Android framework. If you use the PorterDuffXferMode with MULTIPLY, and you render to a hardware accelerated canvas using a path, it's going to generate that black background. This seems to be a known issue, and the answer is always to use a non-hardware accelerated canvas backed by a bitmap to draw the stuff you want to blend.

Due to the way the Windows 10 rendering framework works (where every thing you want to render has to be an individual framework element unless you use directX to render the 2D stuff yourself), I do not have a solution for how to blend highlights with the rendered score to put the highlight behind. Either I'd have to implement some very crazy code to modify the rendered bitmap itself and blend the pixels (essentially duplicating the rendering code used by frameworks like skia/cairo), or I'd have to switch my entire rendering engine to DirectX, which would probably be a nightmare and would take endless months to get everything working properly again.

Mike
Reply
#12
(06-04-2018, 03:38 AM)Zuberman Wrote: ....
If you use the PorterDuffXferMode with MULTIPLY, and you render to a hardware accelerated canvas using a path, it's going to generate that black background.
And what happens if you use ADD or other operators?
Marco

Samsung Galaxy Note Pro 12,2" - Nord Stage 2 HA88
Reply
#13
It blends incorrectly if I use ADD. I don't think it's worth testing the other ones as MULTIPLY is what I want.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.