Subpixel antialiasing for arbitrary paths in Cairo - cairo

Does Cairo support subpixel antialiasing on arbitrary paths?
I'm interested in subpixel antialiasing on text, but the version of Cairo that I am using is compiled without support for any underlying text rendering engine (such as Freetype). Therefore, I'm left with the User Fonts backend, which seems to use Cairo's native path rendering APIs to render the glyph contours. Is it possible to achieve LCD subpixel filtering using this codepath?

Behdad Esfahbod says this is not possible. http://lists.cairographics.org/archives/cairo/2015-February/025982.html

Related

How enable ClearType render with subpixel antialiasing on VSCode on Windows 10?

I'm working with VsCode but i noticed that ClearType was not applied on its fonts.
My windows settings has "cleartype" turned on.
Check the comparison.
How can I enable Cleartype render with subpixel antialiasing on VS Code ?
As part of November 2019 (version 1.41) Update, Visual Studio Code now has Improved font rendering (Windows, Linux) using ClearType render with subpixel antialiasing Technology.
In this release, we improved font rendering in more parts of the workbench (for Windows and Linux). The screenshots below show a before and after comparison (zoomed in to show the difference). In particular, many tree and list elements of the workbench were rendered using greyscale antialiasing and they now render with subpixel antialiasing.

How to set anti-aliasing mode for specific gtk+ application

I trying to write simple gtk+ application with pygobject that using gtk.TextView. In stock demo code I see that font sets up with Pango, but I can't find corresponding method for set up antialiasing-mode. By default font looks little ugly for me.
Does anybody know how to set anti-aliasing in gtk+ app (with python or pure C, Pango or other way)?
Well, it's not easy. Many factors interact to get the final font glyphs on your screen.
Maybe one of the easiest ways to change antialiasing globally would be to reprogram fontconfig. This article describes how to disable anti-aliasing, but it indicates where the config item is located.
Then, on a per-application basis, the actual work of drawing the characters is in the hands of Pango, but Pango may be programmed to use Xft (fontconfig) or Cairo to do the actual drawing. In case of Cairo (which seems to gather popularity), the anti-aliasing is done there. There's an article on that here on stackoverflow. Basically there's a function in the Cairo library, called 'cairo_set_aliasing'
Edit: Have a look at the XFCE window manager. In ths Settings | Appearance tool, you can change the anti aliasing 'globally', from 'none', 'slight', 'more' to 'full', and select subpixel in color or gray, horizontal/vertical and details. The code is contained in the xfce4-appearance-settings module of XFCE.
The aliasing setup is in xfce4-settings-4.12.0.tar.bz2, in dialogs/appearance-settings/main.c. I'm not sure if it actually activated there. I've quite a lot of work at the moment, but, if necessary can lend you a hand later.

Loading unicode font in OpenGL ES App

I wish to load a unicode font in my openGL ES app using freetype library. I initially considered using Arial Unicode MS, but it is too big, around 24 MB.
Is there any other unicode font available of smaller size? I also understand that some other unicode font might not be small enough to solve my problem. Is there any alternative approach to solve my issue?
I think you're referring to texture mapped fonts. As you already figured, a full Unicode font consumes rather much space. However changing the font won't make a difference as the memory requirements don't depend on the typeface, but on the resolution the glyphs rendered to a texture atlas times the amount of glyphs that are included into the set.
While texture mapped fonts were a viable option for alphabets with only a limited number of glyphs (Latin, Cyrillic, Greek, Korean, Arabic) it gets rather clumsy if you want to support full internationalization.
There are two considerable options:
Scan the text to be displayed for all glyphs required, only render and upload those; this owever won't work so well for kanji and similar large scripts.
Render the whole text using FreeType and some layout library (Pango or similar) to a buffer.
I recommend rendering using 3 times the screen resolution using grayscale antialiasing. Then modulate with a pixel aligned filter mask texture, or using a fragment shader to implement sub-pixel antialiasing.
There is possible third method, but I never implemented it myself so far: Vector Textures. In essence you implement a antialiasing spline rasterizer in the fragment shader and supply spline parameters through samplers; this allows to render crisp text utilizing GPU acceleration.

Mapping CoreGraphics Blend Modes to Porter-Duff

I have an iPhone app that does image manipulation via blending two UIImage objects via CoreGraphics, specifically CGContextSetBlendMode. I am currently researching porting it to Android. I've gone through the process of combining to Bitmap objects on Android using PorterDuff modes. However, I want much more complicate compositing. For example, I'm using kCGBlendModeHardLight for many blends:
Either multiplies or screens colors,
depending on the source image sample
color. If the source image sample
color is lighter than 50% gray, the
background is lightened, similar to
screening. If the source image sample
color is darker than 50% gray, the
background is darkened, similar to
multiplying. If the source image
sample color is equal to 50% gray, the
source image is not changed. Image
samples that are equal to pure black
or pure white result in pure black or
white. The overall effect is similar
to what you’d achieve by shining a
harsh spotlight on the source image.
Use this to add highlights to a scene.
But don't know of anyway (if it's even possible) to emulate this via Porter-Duff. Does Android not support better Image Manipulation algorithms out of the box? Is it possible to use Porter-Duff in some way to emulate more advanced blend modes?
In addition to the 12 Porter-Duff blending equations, Android supports Lighten, Darken, Multiply, Screen and soon Overlay. Unfortunately this means HardLight is not available and you would have to implement it yourself.

image effects iphone sdk

are there any tutorials for creating image effects in iphone? like glow,paper effect etc
Can anyone tell me where to start?
A glow effect is not supported by default within the iPhone SDK (specifically CoreGraphics). For the paper effect I am not sure what you are looking for.
If you insist on effects not supported by the SDK, you should try to find less platform specific sources and adapt them to the iPhone:
Glow and Shadow Effects (Windows GDI)
Another possibly great source of effect-know-how are the ImageMagick sources.
Take a look at this project: http://code.google.com/p/simple-iphone-image-processing/
It includes code that can do various image effects such as canny edge detection, histogram equalisation, skeletonisation, thresholding, gaussian blur, brightness normalisation, connected region extraction, and resizing.
Another other more low level option is to take a look at ImageMagick or FreeImage which are further image processing libraries.