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 previous 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?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to commit to bazaar on sourceforge?
Next Topic: RMI
Goto Forum:
  


Current Time: Mon Apr 29 10:58:37 CEST 2024

Total time taken to generate the page: 0.02948 seconds