Even this snippet which saves as .png has the same problem. I doubt I'll find out how to fix this.
// ==PREPROCESSOR==
// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"
// @import "%fb2k_component_path%samples\complete\js\helpers.js"
// ==/PREPROCESSOR==
var font = _.gdiFont("Segoe UI", 72, 1);
var white = _.RGB(255, 255, 255);
var img = gdi.CreateImage(400, font.Height);
var gb = img.GetGraphics();
gb.gdiDrawText("JScript", font, white, 0, 0, 400, font.Height, CENTRE | DT_VCENTER)
img.ReleaseGraphics(gb);
img.SaveAs("z:\\test.png"); //png is default, no need to specify type
As I know, gdidrawtext() needs a background to run, and if it is running on a transparent background, as in the snippet above, it will use black (0-0-0) as a background by default.
So, technically, there is no bug in that snippet. And my real problem is, in a temp graphic part, even if a (colorful) background is defined before, the gdidrawtext() still runs as the background is black; while the problem don't appear with normal gr. in on_paint() callbacks.
Hope I successfully delivered what I thought...
// ==PREPROCESSOR==
// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"
// @import "%fb2k_component_path%samples\complete\js\helpers.js"
// ==/PREPROCESSOR==
var font = _.gdiFont("Segoe UI", 72, 1);
var white = _.RGB(255, 255, 255);
var img = gdi.CreateImage(400, font.Height);
var gb = img.GetGraphics();
//Pre-define a background
gb.FillSolidRect(0, 0, 400, font.Height, 0xffabcdef);
gb.gdiDrawText("JScript", font, white, 0, 0, 400, font.Height, CENTRE | DT_VCENTER);
img.ReleaseGraphics(gb);
img.SaveAs("z:\\test.png"); //png is default, no need to specify type
Hope this may somehow result a smooth image...