mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-25 14:22:54 -06:00
.developing rainbow
git-svn-id: svn://ultimatepp.org/upp/trunk@3555 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c935495369
commit
0803e97b94
5 changed files with 64 additions and 48 deletions
|
|
@ -1,7 +1,9 @@
|
|||
class ViewDraw : public NilDraw {
|
||||
class ViewDraw : public SystemDraw {
|
||||
ImageBuffer ib;
|
||||
|
||||
public:
|
||||
ViewDraw(Ctrl *ctrl);
|
||||
~ViewDraw();
|
||||
ViewDraw(Ctrl *ctrl) : SystemDraw(ib) { _DBG_ }
|
||||
~ViewDraw() {}
|
||||
};
|
||||
|
||||
class DHCtrl : Ctrl {};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ NAMESPACE_UPP
|
|||
GuiLock __;
|
||||
}*/
|
||||
|
||||
/*
|
||||
void BackDraw::Destroy()
|
||||
{
|
||||
GuiLock __;
|
||||
|
|
@ -24,6 +25,7 @@ void BackDraw::Create(SystemDraw& w, int cx, int cy) {
|
|||
void BackDraw::Put(SystemDraw& w, int x, int y) {
|
||||
GuiLock __;
|
||||
}
|
||||
*/
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -6,28 +6,37 @@ NAMESPACE_UPP
|
|||
|
||||
class SystemDraw : public BufferPainter {
|
||||
public:
|
||||
Point GetOffset() const { return Point(0, 0); }
|
||||
bool CanSetSurface() { return false; }
|
||||
static void Flush() {}
|
||||
Point GetOffset() const { return Point(0, 0); }
|
||||
bool CanSetSurface() { return false; }
|
||||
bool Clip(const Rect& r) { return Draw::Clip(r); }
|
||||
bool Clip(int x, int y, int cx, int cy) { return Draw::Clip(x, y, cx, cy); }
|
||||
static void Flush() {}
|
||||
|
||||
SystemDraw(ImageBuffer& ib, int mode = MODE_ANTIALIASED) : BufferPainter(ib, mode) {}
|
||||
};
|
||||
|
||||
class BackDraw : public SystemDraw {
|
||||
struct BackDraw__ : public SystemDraw {
|
||||
ImageBuffer h;
|
||||
|
||||
BackDraw__() : SystemDraw(h) {}
|
||||
};
|
||||
|
||||
class BackDraw : public BackDraw__ { // Dummy only, as we are running in GlobalBackBuffer mode
|
||||
Size size;
|
||||
Draw *painting;
|
||||
Point painting_offset;
|
||||
ImageBuffer ib;
|
||||
|
||||
public:
|
||||
virtual bool IsPaintingOp(const Rect& r) const;
|
||||
|
||||
public:
|
||||
void Put(SystemDraw& w, int x, int y);
|
||||
void Put(SystemDraw& w, int x, int y) {}
|
||||
void Put(SystemDraw& w, Point p) { Put(w, p.x, p.y); }
|
||||
|
||||
void Create(SystemDraw& w, int cx, int cy);
|
||||
void Create(SystemDraw& w, int cx, int cy) {}
|
||||
void Create(SystemDraw& w, Size sz) { Create(w, sz.cx, sz.cy); }
|
||||
void Destroy();
|
||||
void Destroy() {}
|
||||
|
||||
void SetPaintingDraw(Draw& w, Point off) { painting = &w; painting_offset = off; }
|
||||
|
||||
|
|
@ -35,29 +44,29 @@ public:
|
|||
~BackDraw();
|
||||
};
|
||||
|
||||
class ImageDraw__ {
|
||||
struct ImageDraw__ {
|
||||
ImageBuffer image;
|
||||
ImageBuffer alpha;
|
||||
|
||||
ImageDraw__(int cx, int cy) : image(cx, cy), alpha(cx, cy) {}
|
||||
};
|
||||
|
||||
class ImageDraw : public BufferPainter, private ImageDraw__ {
|
||||
Size size;
|
||||
class ImageDraw : private ImageDraw__, public BufferPainter {
|
||||
BufferPainter alpha_painter;
|
||||
bool has_alpha;
|
||||
|
||||
Image Get(bool pm) const;
|
||||
|
||||
public:
|
||||
Draw& Alpha();
|
||||
|
||||
operator Image() const;
|
||||
operator Image() const { return Get(true); }
|
||||
|
||||
Image GetStraight() const;
|
||||
Image GetStraight() const { return Get(false); }
|
||||
|
||||
ImageDraw(Size sz);
|
||||
ImageDraw(int cx, int cy);
|
||||
~ImageDraw();
|
||||
}
|
||||
};
|
||||
|
||||
void DrawDragRect(SystemDraw& w, const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
|
||||
Color color, uint64 pattern);
|
||||
|
|
@ -84,7 +93,7 @@ bool FBEndSession();
|
|||
|
||||
// }
|
||||
|
||||
class PrinterJob {
|
||||
class PrinterJob { // Dummy only...
|
||||
NilDraw nil;
|
||||
Vector<int> pages;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,42 +49,54 @@ void Image::Data::PaintImp(SystemDraw& w, int x, int y, const Rect& src, Color c
|
|||
SystemData& sd = Sys();
|
||||
}
|
||||
|
||||
Image ImageDraw::Get(bool pm) const
|
||||
{
|
||||
ImageBuffer result(image.GetSize());
|
||||
const RGBA *e = image.End();
|
||||
const RGBA *p = ~image;
|
||||
RGBA *t = ~result;
|
||||
if(has_alpha) {
|
||||
const RGBA *a = ~alpha;
|
||||
while(p < e) {
|
||||
*t = *p++;
|
||||
(t++)->a = (a++)->r;
|
||||
}
|
||||
if(pm)
|
||||
Premultiply(result);
|
||||
result.SetKind(IMAGE_ALPHA);
|
||||
}
|
||||
else {
|
||||
while(p < e) {
|
||||
*t = *p++;
|
||||
(t++)->a = 255;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Draw& ImageDraw::Alpha()
|
||||
{
|
||||
has_alpha = true;
|
||||
return alpha;
|
||||
return alpha_painter;
|
||||
}
|
||||
|
||||
ImageDraw::operator Image() const
|
||||
{
|
||||
Image image;
|
||||
|
||||
return GetResult();
|
||||
}
|
||||
|
||||
Image ImageDraw::GetStraight() const
|
||||
{
|
||||
return GetResult();
|
||||
}
|
||||
|
||||
ImageDraw::ImageDraw(Size sz)
|
||||
: BufferPainter(sz.cx, sz.cy),
|
||||
alpha(sz.cx, sz.cy)
|
||||
: ImageDraw__(sz.cx, sz.cy),
|
||||
BufferPainter(image),
|
||||
alpha_painter(alpha)
|
||||
{
|
||||
has_alpha = false;
|
||||
}
|
||||
|
||||
ImageDraw::ImageDraw(int cx, int cy)
|
||||
: BufferPainter(image, cx, cy),
|
||||
alpha(alpha, cx, cy)
|
||||
: ImageDraw__(cx, cy),
|
||||
BufferPainter(image),
|
||||
alpha_painter(alpha)
|
||||
{
|
||||
has_alpha = false;
|
||||
}
|
||||
|
||||
ImageDraw::~ImageDraw()
|
||||
{
|
||||
}
|
||||
|
||||
Image Image::Arrow() { return Null; }
|
||||
Image Image::Wait() { return Null; }
|
||||
Image Image::IBeam() { return Null; }
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ void Ctrl::RefreshFBAll()
|
|||
|
||||
void Ctrl::InitFB()
|
||||
{
|
||||
Ctrl::GlobalBackBuffer();
|
||||
Ctrl::InitTimer();
|
||||
framebuffer.Create(1000, 1000);
|
||||
}
|
||||
|
|
@ -366,16 +367,6 @@ Rect Ctrl::GetDefaultWindowRect() {
|
|||
return Rect(0, 0, 100, 100);
|
||||
}
|
||||
|
||||
ViewDraw::ViewDraw(Ctrl *ctrl)
|
||||
{
|
||||
EnterGuiMutex();
|
||||
}
|
||||
|
||||
ViewDraw::~ViewDraw()
|
||||
{
|
||||
LeaveGuiMutex();
|
||||
}
|
||||
|
||||
Vector<WString> SplitCmdLine__(const char *cmd)
|
||||
{
|
||||
Vector<WString> out;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue