I have spent a couple of days trying to work this out but can't get anything to work. I think I need to create a bitmap, draw to it and then display the bitmap, but I have tried many different permutations and all to no avail. I am particularly confused by the many types of bitmap.
Ideally I would use NanoVG, but I would appreciate anything.
Here are some my failed workings. It is a mess but hopefully someone can see if I'm thinking along the right lines or not:
Code:
//IGRAPHICS_NANOVG is defined already it
//seems so maybe I should be using
//that instead of LICE_DrawQBezier.
#define IGRAPHICS_LICE
#undef IGRAPHICS_NANOVG
Code:
//This is definitely attached and at
//one point drew white, which I assume
/is a blank bitmap.
class bezierWindow : public IControl
{
public:
bezierWindow(
IRECT bounds,
int paramIdx = kNoParameter,
IActionFunction aF = nullptr) :
IControl(bounds, paramIdx, aF){}
virtual ~bezierWindow() {}
virtual void Draw(IGraphics& pGraphics) override
{
IColor white(255, 255, 255, 255);
IColor blackBlue(255, 22, 24, 32);
IColor grey(255, 51, 51, 60);
IColor gridBlue(255, 40, 182, 231);
IColor curveBlue(255, 143, 213, 237);
pGraphics.FillRect(blackBlue, mRECT, 0);
pGraphics.DrawRect(grey, mRECT, 0, 2.0);
//pGraphics.GetDrawBitmap(),
int width = (int)(mRECT.W() + 0.5);
int height = (int)(mRECT.H() + 0.5);
LICE_MemBitmap liceBitmap = {width, height, 4 };
//APIBitmap apiBitmap = {
liceBitmap,
mRECT.W(),
mRECT.H(),
1,
1.0
};
APIBitmap apiBitmap = {&liceBitmap, width, height, 1, 1.0};
IBitmap drawing = {&apiBitmap, 1, false, "" };
//IBitmap drawing = {&liceBitmap, 1, false, "" };
//pGraphics.DrawBitmap
LICE_DrawQBezier(
(&liceBitmap),
//(&liceBitmap),
//(LICE_IBitmap*)(&liceBitmap),
mRECT.L,
mRECT.T,
mRECT.L + mRECT.W()*0.8,
mRECT.T + mRECT.H()*0.8,
mRECT.R,
mRECT.B,
LICE_RGBA(255, 0, 255, 255), 0.9, LICE_BLIT_MODE_COPY, true, 4
);
IBlend normalBlend = { kBlendNone , 1.0 };
pGraphics.DrawBitmap(drawing, mRECT, 1, &normalBlend);
//pGraphics.DrawBitmap(drawing, mRect);
SetDirty();
//LICE_pixel color, float alpha, int mode, bool aa, double tol)
}
};