Draw: ChPaintImage -> Draw9Slice

This commit is contained in:
Mirek Fidler 2025-11-20 11:18:47 +01:00
parent 3263527b95
commit d609960eb6
5 changed files with 16 additions and 15 deletions

View file

@ -300,17 +300,6 @@ Value ChLookFnImage(Draw& w, const Rect& r, const Image& img, int op, Color ink)
return ChLookFnImage(w, r, img, op, ink, img.GetHotSpot(), img.Get2ndSpot());
}
void ChPaintImage(Draw& w, const Rect& r, const Image& img, Point p1, Point p2)
{
ChLookFnImage(w, r, img, LOOK_PAINT, Null, p1, p2);
}
void ChPaintImage(Draw& w, const Rect& r, const Image& img, int margin)
{
Size sz = img.GetSize();
ChPaintImage(w, r, img, Point(margin, margin), Point(sz.cx - margin - 1, sz.cy - margin - 1));
}
Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op, Color ink)
{
if(IsType<sChLookWith>(v)) {

View file

@ -21,9 +21,6 @@ void ColoredOverride(Iml& target, Iml& source);
void ChReset();
void ChFinish();
void ChPaintImage(Draw& w, const Rect& r, const Image& img, Point p1, Point p2);
void ChPaintImage(Draw& w, const Rect& r, const Image& img, int margin);
void ChPaint(Draw& w, const Rect& r, const Value& look, Color ink = Null);
void ChPaint(Draw& w, int x, int y, int cx, int cy, const Value& look, Color ink = Null);
void ChPaintNoCache(Draw& w, int x, int y, int cx, int cy, const Value& look, Color ink = Null);

View file

@ -947,6 +947,9 @@ void DrawRectMinusRect(Draw& w, const Rect& rect, const Rect& inner, Color color
void DrawHighlightImage(Draw& w, int x, int y, const Image& img, bool highlight = true,
bool enabled = true, Color maskcolor = SColorPaper);
void Draw9Slice(Draw& w, const Rect& r, const Image& img, Point p1, Point p2);
void Draw9Slice(Draw& w, const Rect& r, const Image& img, int margin);
Color GradientColor(Color fc, Color tc, int i, int n);
void DrawTextEllipsis(Draw& w, int x, int y, int cx, const char *text, const char *ellipsis,

View file

@ -580,6 +580,18 @@ void DrawXPButton(Draw& w, Rect r, int type)
}
}
void Draw9Slice(Draw& w, const Rect& r, const Image& img, Point p1, Point p2)
{
Value ChLookFnImage(Draw& w, const Rect& r, const Image& img, int op, Color ink, Point p, Point p2);
ChLookFnImage(w, r, img, LOOK_PAINT, Null, p1, p2);
}
void Draw9Slice(Draw& w, const Rect& r, const Image& img, int margin)
{
Size sz = img.GetSize();
Draw9Slice(w, r, img, Point(margin, margin), Point(sz.cx - margin - 1, sz.cy - margin - 1));
}
static DrawingToPdfFnType sPdf;
static PdfDrawJPEGFnType sJpeg;

View file

@ -5,7 +5,7 @@ using namespace Upp;
struct MyApp : TopWindow {
void Paint(Upp::Draw& w) override {
w.DrawRect(GetSize(), White());
ChPaintImage(w, RectC(100, 100, 100, 100), CtrlsImg::OkBh(), DPI(5));
Draw9Slice(w, RectC(100, 100, 100, 100), CtrlsImg::OkBh(), DPI(5));
}
};