37 const float alpha = (float)
GetValue();
40 auto nextCell = [&]() {
44 auto drawBlendPic = [
this](
IGraphics& g,
IRECT r, EBlend blend,
const char* name,
float alpha)
46 IBlend blendMode { blend, alpha };
49 g.
DrawRect(COLOR_BLACK, r,
nullptr, 1.f);
50 g.
DrawText(mText, name, r.GetFromTop(10.f));
56 drawBlendPic(g, nextCell(), EBlend::SrcOver,
"Src Over", alpha);
57 drawBlendPic(g, nextCell(), EBlend::DstOver,
"Dst Over", alpha);
58 drawBlendPic(g, nextCell(), EBlend::SrcIn,
"Src In", alpha);
59 drawBlendPic(g, nextCell(), EBlend::DstIn,
"Dst In", alpha);
60 drawBlendPic(g, nextCell(), EBlend::SrcOut,
"Src Out", alpha);
61 drawBlendPic(g, nextCell(), EBlend::DstOut,
"Dst Out", alpha);
62 drawBlendPic(g, nextCell(), EBlend::SrcAtop,
"Src Atop", alpha);
63 drawBlendPic(g, nextCell(), EBlend::DstAtop,
"Dst Atop", alpha);
64 drawBlendPic(g, nextCell(), EBlend::XOR,
"XOR", alpha);
65 drawBlendPic(g, nextCell(), EBlend::Add,
"Add", alpha);
void StartLayer(IControl *pOwner, const IRECT &r, bool cacheable=false)
Create an IGraphics layer.
Used to manage a rectangular area, independent of draw class/platform.
virtual void DrawRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
Draw a rectangle to the graphics context.
Used to manage composite/blend operations, independent of draw class/platform.
User-facing bitmap abstraction that you use to manage bitmap data, independant of draw class/platform...
Control to test blend methods.
void SetTooltip(const char *str)
Set a tooltip for the control.
void DrawText(const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend=0)
Draw some text to the graphics context in a specific rectangle.
This file contains the base IControl implementation, along with some base classes for specific types ...
The lowest level base class of an IGraphics context.
virtual void FillRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0)
Fill a rectangular region of the graphics context with a color.
A base class for knob/dial controls, to handle mouse action and Sender.
virtual void DrawFittedBitmap(const IBitmap &bitmap, const IRECT &bounds, const IBlend *pBlend=0)
Draw a bitmap (raster) image to the graphics context, scaling the image to fit the bounds...
void DrawLayer(const ILayerPtr &layer, const IBlend *pBlend=nullptr)
Draw a layer to the main IGraphics context.
IRECT GetGridCell(int row, int col, int nRows, int nColumns) const
Get a subrect (by row, column) of this IRECT which is a cell in a grid of size (nRows * nColumns) ...
double GetValue(int valIdx=0) const
Get the control's value.
ILayerPtr EndLayer()
End an IGraphics layer.
IRECT GetPadded(float padding) const
Get a copy of this IRECT with each value padded by padding N.B.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
std::unique_ptr< ILayer > ILayerPtr
ILayerPtr is a managed pointer for transferring the ownership of layers.