Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Draw::DrawImageOp optimization bug
Re: Draw::DrawImageOp optimization bug [message #19362 is a reply to message #19358] |
Fri, 28 November 2008 21:02 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
Well, I have spent last 4 hours with this problem and I really do not know what to think....
See this:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class Testcase2 : public TopWindow{
public:
typedef Testcase2 CLASSNAME;
Testcase2(){
Sizeable();
MinimizeBox();
MaximizeBox();
BackPaint();
}
Image MakeImage2(Size sz) const {
ImageBuffer ib(sz.cx / 3, sz.cy / 3);
Fill(ib, LtBlue(), ib.GetLength());
const Color c[] = { LtBlue() };
for(int y = 0; y < ib.GetWidth(); y++) {
for(int x = 0; x < ib.GetHeight(); x++)
ib[x][y] = c[2 * (x > ib.GetHeight() / 2) + (y > ib.GetWidth() / 2)];
}
return ib;
}
Image MakeImage(Size sz) const {
ImageDraw iw(sz / 3);
iw.DrawRect(sz / 3, Blue);
iw.DrawText(0, 0, "O", Roman(sz.cy / 3).Italic(), Red());
return iw;
}
Image MakeImage1(Size sz) const {
ImageBuffer ib(sz);
for(int y=0;y<sz.cy;y++){
for(int x=0;x<sz.cx;x++){
ib[y][x]=(RGBA)Color((16*y/sz.cy)<<4,(16*y/sz.cy)<<4,(16*x/sz.cx)<<4);
}
}
return ib;
}
void print(){
}
virtual void Paint(Draw &w){
Size sz = GetSize();
w.DrawRect(GetSize(), White);
w.DrawImage(0, 0, MakeImage(GetSize()));
w.DrawText(10,500,"Press 'P' to print image, 'R' to print rectangle test, 'C' to another test...");
w.DrawText(10,530,"(This really drains your ink/toner cartridge, so try e.g. Microsoft XPS Document Writer.)");
}
bool Key(dword key, int count){
PrinterJob job;
switch(key){
case K_P:
if(job.Execute()){
Draw &draw = job;
draw.StartPage();
draw.DrawImage(0, 0, MakeImage(draw.GetPagePixels()));
draw.EndPage();
}
return true;
case K_R:
if(job.Execute()){
Draw &draw = job;
draw.StartPage();
bool flag = false;
for(int y = 0; y < 100; y++)
for(int x = 0; x < 100; x++) {
draw.DrawRect(16 * x, 16 * y, 16, 16, flag ? Blue : Red);
if((Random() & 31) == 0)
flag = !flag;
}
draw.EndPage();
}
return true;
case K_C:
if(job.Execute()){
Draw &draw = job;
draw.StartPage();
for(int y = 0; y < 100; y++)
for(int x = 0; x < 100; x++)
draw.DrawRect(16 * x, 16 * y, 16, 16, Blue);
draw.EndPage();
}
return true;
}
return false;
}
};
GUI_APP_MAIN
{
Testcase2().Run();
}
Now interesting things happen when you press R or C.
These try to emulate the compression issue. When you do R, you have those line artifacts, but C seems without the issue - and only thing that has changed is the color.
Is not it really weird? (Note that it is not even related to Image).
It can also be seen with P... The areas that are "full line" are OK.
Well, I have also tried to mitigate the issue by "overpainting" rectangle (adding to height/width), but interestigly that seems to have produced other issues.
OK, enough for today, next tomorrow. We really need this working BTW.
Mirek
|
|
|
|
|
Draw::DrawImageOp optimization bug
By: Tom1 on Thu, 27 November 2008 13:52
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Fri, 28 November 2008 08:56
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Fri, 28 November 2008 10:23
|
|
|
Re: Draw::DrawImageOp optimization bug
By: rylek on Fri, 28 November 2008 13:15
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Fri, 28 November 2008 13:27
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Fri, 28 November 2008 13:29
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Fri, 28 November 2008 13:54
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Fri, 28 November 2008 14:27
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Fri, 28 November 2008 21:02
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Sat, 29 November 2008 12:54
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Mon, 01 December 2008 11:25
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Mon, 01 December 2008 12:12
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Mon, 01 December 2008 12:49
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Mon, 01 December 2008 12:57
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Mon, 01 December 2008 13:50
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Mon, 01 December 2008 14:25
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Mon, 01 December 2008 13:12
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Mon, 01 December 2008 12:41
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Mon, 01 December 2008 13:14
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Mon, 01 December 2008 14:37
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Mon, 01 December 2008 14:52
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Tue, 02 December 2008 19:15
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Tue, 02 December 2008 21:16
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Tue, 02 December 2008 21:46
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Wed, 03 December 2008 12:14
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Wed, 03 December 2008 15:03
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Wed, 03 December 2008 15:21
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Wed, 03 December 2008 15:36
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Wed, 03 December 2008 17:11
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Thu, 04 December 2008 10:22
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Thu, 04 December 2008 11:07
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Thu, 04 December 2008 11:36
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Thu, 04 December 2008 12:09
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Thu, 04 December 2008 12:36
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Thu, 04 December 2008 13:09
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Thu, 04 December 2008 15:53
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Thu, 04 December 2008 16:07
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Thu, 04 December 2008 17:46
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Fri, 05 December 2008 11:05
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Fri, 05 December 2008 11:20
|
|
|
Re: Draw::DrawImageOp optimization bug
By: Tom1 on Fri, 05 December 2008 12:13
|
|
|
Re: Draw::DrawImageOp optimization bug
By: mirek on Thu, 04 December 2008 10:19
|
Goto Forum:
Current Time: Tue May 21 18:23:17 CEST 2024
Total time taken to generate the page: 0.01545 seconds
|