Home » Developing U++ » U++ Developers corner » DrawAggData.cpp and internal AggDrawData formats
DrawAggData.cpp and internal AggDrawData formats [message #13547] |
Mon, 14 January 2008 17:26  |
 |
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
some of my thinking...
1. If I grasped correctly, AggUpp would need DrawAggData.cpp
as in Draw DrawRasterData.cpp:
#include "Draw.h"
NAMESPACE_UPP
struct cDrawRasterData : DataDrawer {
int cx;
StringStream ss;
One<StreamRaster> raster;
RescaleImage si;
virtual void Open(const String& data, int cx, int cy);
virtual void Render(ImageBuffer& ib);
};
void cDrawRasterData::Open(const String& data, int _cx, int cy)
{
cx = _cx;
ss.Open(data);
raster = StreamRaster::OpenAny(ss);
if(raster)
si.Create(Size(cx, cy), *raster, raster->GetSize());
}
void cDrawRasterData::Render(ImageBuffer& ib) //agg image buffer would already contain RLE format?
{
for(int y = 0; y < ib.GetHeight(); y++)
si.Get(ib[y]);
}
INITBLOCK
{
DataDrawer::Register<cDrawRasterData>("image_data");
};
void DrawRasterData(Draw& w, int x, int y, int cx, int cy, const String& data)
{
w.DrawData(x, y, cx, cy, data, "image_data");
}
END_UPP_NAMESPACE
with changes something like:
#include <Draw/Draw.h> //or "AggUpp.h"
NAMESPACE_UPP
struct cDrawAggData : DataDrawer {
int cx;
StringStream ss;
One<StreamAgg> raster;
RescaleAggImage si; //do we need this for agg or extend Render?
virtual void Open(const String& data, int cx, int cy);
virtual void Render(ImageBuffer& ib); //agg sh
};
void cDrawAggData::Open(const String& data, int _cx, int cy)
{
cx = _cx;
ss.Open(data);
raster = StreamRaster::OpenAny(ss);
if(raster)
si.Create(Size(cx, cy), *raster, raster->GetSize());
}
void cDrawAggData::Render(ImageBuffer& ib)
{
for(int y = 0; y < ib.GetHeight(); y++)
si.Get(ib[y]);
}
INITBLOCK
{
DataDrawer::Register<cDrawAggData>("agg_image_data");
};
void DrawAggData(Draw& w, int x, int y, int cx, int cy, const String& data)
{
w.DrawData(x, y, cx, cy, data, "agg_image_data"); //or "agg_data"
}
END_UPP_NAMESPACE
2. In general, what kind of data format would we need for agg?
A. RLE compressed agg_image_data as raster (for printing only?) with a difference that we use different Rescale and produce a new ImageBuffer
B. Kind of WMF - "SVG internal byte compiled" -> w.DrawData(x, y, cx, cy, data, "agg_svg_internal_data");
C. other - sequence of some commands - what and how?
|
|
|
|
|
|
Re: DrawAggData.cpp and internal AggDrawData formats [message #13556 is a reply to message #13555] |
Mon, 14 January 2008 19:43   |
 |
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
luzr wrote on Mon, 14 January 2008 18:23 |
fudadmin wrote on Mon, 14 January 2008 13:08 |
luzr wrote on Mon, 14 January 2008 18:00 | Actually, it would be interesting to discuss whether my "printing RLE" is a good idea or not...
Mirek
|
IMO, it's a fantastic thing to save bandwidth, time and space (until vector hardware comes to life). Does anyone suspect any cons?
|
Who knows. Perhaps we should try to send some actual graphics to printer before making conclusions 
Mirek
|
Would you like to say you never tried it? 
Couldn't we just assume that, if white (or no color) filled rectangle printing is faster than sending pixels, then it's worth it, could we?
Also, could we save something (time and space?) by using cached
agg or svg images with this technique in... let's say future upp web browser?
|
|
|
|
|
Goto Forum:
Current Time: Sun May 11 19:48:37 CEST 2025
Total time taken to generate the page: 0.00566 seconds
|