Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
fudadmin is currently offline  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 #13551 is a reply to message #13547] Mon, 14 January 2008 19:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Actually, it would be interesting to discuss whether my "printing RLE" is a good idea or not...

Mirek
Re: DrawAggData.cpp and internal AggDrawData formats [message #13554 is a reply to message #13551] Mon, 14 January 2008 19:08 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
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?
Re: DrawAggData.cpp and internal AggDrawData formats [message #13555 is a reply to message #13554] Mon, 14 January 2008 19:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
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 Smile

Mirek
Re: DrawAggData.cpp and internal AggDrawData formats [message #13556 is a reply to message #13555] Mon, 14 January 2008 19:43 Go to previous messageGo to next message
fudadmin is currently offline  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 Smile

Mirek


Would you like to say you never tried it? Shocked
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?
Re: DrawAggData.cpp and internal AggDrawData formats [message #13569 is a reply to message #13556] Tue, 15 January 2008 05:02 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
I'll try my old agg_report package a bit later.
Re: DrawAggData.cpp and internal AggDrawData formats [message #13618 is a reply to message #13556] Thu, 17 January 2008 16:38 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
BTW, speaking about it, are you aware about any Cairo vs AGG benchmarks?

Mirek
Previous Topic: how to commit to bazaar on sourceforge?
Next Topic: RMI
Goto Forum:
  


Current Time: Thu Mar 28 20:58:48 CET 2024

Total time taken to generate the page: 0.02061 seconds