Highlight(Overlay) specific area on UIImage - ios

I am developing a book app. Book pages are images. At a time one image is shown on iphone screen. Image contains lines(Paragraphs). I want to highlight the whole paragraph on touch on that. Is it possible to highlight the paragraph or make overlay on the whole paragraph or change the color of that paragraph. Any Help please?

As your book page is an image, the only way you can do it is to either change the image or add a view on top with a color and an alpha value. With the latter you also overlay the letters of course, so the effect will kind of blurry your text.
Next to that, recognising the paragraph won't be trivial, depending on your image quality. The same counts for changing the image - if your background is not a clean color you have to introduce some threshold for which color is the background color and should be changed to the highlight color.
For how to change the color of specific pixels in an UIImage see here:
iPhone : How to change color of particular pixel of a UIImage?

Related

Crop text image within background using OpenCV

I would like to extract the letter from the blue images shown below.
Ideally, the result would be a cropped black letter image on a white background as shown below.
There may be functions of CV that would enable me to go this effectively.
I think this would be a more simple thing to do if the original letters weren't white. It would be more simple to crop the image to the extent of the letter and change the font color to black.
Appreciate any help.
Image example 1
Image example 2
Result

How to display a background image for a kivy button unchanged?

I want to use a background image for a kivy button. I have used the following builder string:
<MenuScreen>:
BoxLayout:
Button:
background_normal: './Pictures/my_background.png'
The image is displayed, however, it is much darker than expected and partially inverted. What do I have to do in order to display my original image without changes?
The resulting button
Original image
I think your problem is that the two colors in your image are grey and transparent (the white appearing areas are actually transparent in your image). In a Button, the background_normal image is multiplied by the background_color which is also a shade of grey by default. So what you end up with is the background grey showing through your transparent areas (white areas above) and your grey appearing everywhere else. So there is not much contrast. See the Button Docs for more information.
You can modify your image (using something like Gimp) to replace the transparent areas with a white color, and perhaps change the grey colors in your image with black. The distortion of the image is due to Kivy fitting your image to the button size.
Here is your image edited as I described. You should be able to click on it and download it.

How to convert uitextview' text into a mask on a background image in iOS

I am trying to create uitextview' text as a mask for background image so that I can color text dynamically with respect to the image behind. I can make that thing through the design application by converting text into outline paths and use it as a mask to the background image. Here is the link for a sample text
However fail to do that in iOS, as I need to convert textview text into path which is somewhat very problematic for me.
I would be happy if someone at least show me the general way to do that.
Thanks
You can place the uitextview (with a black text) on a white background and take a snapshot of that view, like this:
How Do I Take a Screen Shot of a UIView?
Then, you can use the resulting image as a mask on your background image, like this: How to Mask an UIImageView
I hope this helps. Good Luck!

Detect if colour beneath UIVisualEffectView is light

Because the UIImageView in the background is very light, you can't see the text in the foreground on top of the UIVisualEffectView. I want to detect whether the background is light or not and if so, change the text colour to something darker. How can I do this?
To detect the dominant color of a UIView it takes two steps. First is to capture the image data of the view as described here: How to capture UIView to UIImage without loss of quality on retina display
Second is to determine what the dominant color of the view is as described here:
How does the algorithm to color the song list in iTunes 11 work?
And then make your adjustments based on the result.
Personally, I would simply use a dark text color for the light blur. Or continue with the light text and use the dark blur effect. Or set a tint color on a navigation bar.

make button glyph have a transparent background in delphi 7?

I have four TSpeedButton objects, each with a BMP file assigned as a glyph for the button image. For whatever reason, delphi has decided that two of the button images should have a transparent background and two should have a white background. I created the bitmaps myself, so they are all saved at the same color depth and are using pure white (not some shade of almost white) for the background and have background color in all four corner pixels of the image.
Why would some of the glyph images show up with a transparent background and some not? What is the criterion for making the background transparent? How can I make my button images all have transparent backgrounds instead of half of them having transparent backgrounds?
Ken's comment
Delphi's glyph handling uses the pixel in the lower-left corner to determine the transparent color. All pixels that match that color should be shown as transparent. Does the lower-left pixel color match in all of the glyphs, and does it match the areas you want to be transparent? (Without the images, it's hard to tell what the problem is, but I thought I'd post this as a potential for investigation.)
appeared to hold the correct answer (sorry, can't accept a comment as the right answer!). The image I was using had a shadow reaching to the lower left corner so it was almost white in that corner and exactly white in all the other corners.
I had a similar problem with D5 and I cludged a fix for this as I never found out why it was happening.
Define the image size one Row taller than the actual image/glyph is. This will force the image to be written starting at the top left and stop just before the last row. That will force the use of a non-transparent color and the extra row below the image is not visually noticeable.

Resources