Hi Evan,
I, too, after Ian, doubt it's possible to accelerate text drawing on macOS by caching images. But, FLTK 1.4 contains the code to get the proper alpha channel of antialiased text, because it's used to draw text on GL scenes. Use this virtual member function of class Fl_Gl_Window_Driver :
virtual char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs); where str is the UTF8 text to draw, n is its length w, h is the size of the desired image containing the drawn text fs is the font size (the current font is used) This function returns a char array of size w * h containing the adequate alpha channel for the text.
The effect of this function as antialiased text is visible with any text-drawing, GL-using FLTK program (e.g., test/cube).
The macOS implementation of this virtual function, Fl_Cocoa_Gl_Window_Driver::alpha_mask_for_string, builds a CGContextRef for a CGBitmapContext which contains a depth-4 pre-multiplied byte array that can also be used to create an adequate depth-4 Fl_RGB_Image object.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/3eba37f5-d5a5-43ee-9f6d-408853080601n%40googlegroups.com.
[ Direct Link to Message ] |