[cairo] cairomm 1.8.0 problem with RefPtr<>
sgoericke at vandalay.org
sgoericke at vandalay.org
Tue Mar 24 07:42:26 PDT 2009
Hi Jonathon,
sorry that i've missed to provide these infos so here they are:
System: GNU/Linux (Distribution: Arch Linux)
Arch: 32bit i686
glibc version: 2.9-4
libstdc++ verion: 5.0.7 and 6.0.10
I use the Eclipse CDT IDE Version: 3.4.2
Here is the "original" gcc-error message:
**** Build of configuration Debug for project sg777xp ****
make all
Building file: ../src/pfd_display.cpp
Invoking: GCC C++ Compiler
g++ -DLIN -I"/home/sven/devel/eclipse-projects/sg777xp/inc" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/pfd_display.d" -MT"src/pfd_display.d" -o"src/pfd_display.o" "../src/pfd_display.cpp"
In file included from /home/sven/devel/eclipse-projects/sg777xp/inc/pfd_display.h:11,
from ../src/pfd_display.cpp:7:
/usr/include/cairomm-1.0/cairomm/context.h:50: error: expected ‘,’ or ‘...’ before ‘<’ token
...
and much more.
I'll quote the source code of the affected files pfd_display.cpp and .h . Not much stuff as i said i'm new to cairo, i used MS GDI+ on Windows before.
/*
* pfd_display.h
*
* Created on: Mar 21, 2009
* Author: sven
*/
#ifndef PFD_DISPLAY_H_
#define PFD_DISPLAY_H_
#include <cairomm-1.0/cairomm/cairommconfig.h>
#include <cairomm-1.0/cairomm/context.h>
#include <cairomm-1.0/cairomm/surface.h>
#include <string>
class PFDDisplay
{
public:
PFDDisplay(unsigned int size_x, unsigned int size_y);
~PFDDisplay();
void Draw();
unsigned char* get_buffer();
private:
unsigned int m_size_x;
unsigned int m_size_y;
unsigned char* m_buffer;
int m_stride;
Cairo::RefPtr<Cairo::ImageSurface> m_surface;
Cairo::RefPtr<Cairo::Context> m_cairo;
};
#endif /* PFD_DISPLAY_H_ */
/*
* pfd_display.cpp
*
* Created on: Mar 21, 2009
* Author: sven
*/
#include <pfd_display.h>
using namespace Cairo;
PFDDisplay::PFDDisplay(unsigned int size_x, unsigned int size_y) :
m_size_x( size_x),
m_size_y( size_y),
m_buffer( new unsigned char[size_x * size_y * 4] ),
m_stride( ImageSurface::format_stride_for_width (FORMAT_ARGB32, size_y) ),
m_surface( ImageSurface::create (m_buffer, FORMAT_ARGB32, size_x, size_y, m_stride) ),
m_cairo( Context::create(m_surface) )
{
}
PFDDisplay::~PFDDisplay()
{
delete m_buffer;
}
void PFDDisplay::Draw()
{
m_cairo->rectangle( 0.0, 0.0, 512, 512);
m_cairo->set_source_rgba( 0.0, 0.0, 0.0, 1.0 );
m_cairo->fill();
m_cairo->save(); // save the state of the context
Matrix theMatrix = Matrix(
0.0, 0.0,
0.0, 1.0,
0.0, 0.0);
m_cairo->transform (theMatrix);
// m_cairo->scale( (m_size_x/512.0), (m_size_x/512.0) );
// m_cairo->rectangle( 0.0, 0.0, 512, 512);
// m_cairo->set_source_rgba( 1.0, 0.0, 0.0, 0.5 );
// m_cairo->fill();
// m_cairo->fill();
m_cairo->rectangle( 0.0, 256.0, 170.0, 256.0 );
m_cairo->set_source_rgba(1.0, 0.0, 0.0, 1.0);
m_cairo->fill();
m_cairo->rectangle( 170.0, 256.0, 170.0, 256.0 );
m_cairo->set_source_rgba(0.0, 1.0, 0.0, 1.0);
m_cairo->fill();
m_cairo->rectangle( 340.0, 256.0, 170.0, 256.0 );
m_cairo->set_source_rgba(0.0, 0.0, 1.0, 1.0);
m_cairo->fill();
m_cairo->rectangle( 0.0, 0.0, 170.0, 256.0 );
m_cairo->set_source_rgba(1.0, 0.0, 0.0, 0.3);
m_cairo->fill();
m_cairo->rectangle( 170.0, 0.0, 170.0, 256.0 );
m_cairo->set_source_rgba(0.0, 1.0, 0.0, 0.3);
m_cairo->fill();
m_cairo->rectangle( 340.0, 0.0, 170.0, 256.0 );
m_cairo->set_source_rgba(0.0, 0.0, 1.0, 0.3);
m_cairo->fill();
m_cairo->save();
// draw the text
m_cairo->move_to( 30, 30 );
m_cairo->set_source_rgba(1.0, 1.0, 1.0, 1.0);
Cairo::TextExtents extents;
std::string text("cairo");
m_cairo->select_font_face("DejaVu Sans Mono", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL);
m_cairo->set_font_size(32);
Cairo::FontOptions font_options;
font_options.set_hint_style(Cairo::HINT_STYLE_NONE);
font_options.set_hint_metrics(Cairo::HINT_METRICS_OFF);
font_options.set_antialias(Cairo::ANTIALIAS_GRAY);
m_cairo->set_font_options(font_options);
m_cairo->set_source_rgba(1.0, 1.0, 1.0, 1.0);
m_cairo->translate( 330.0, 330.0 );
m_cairo->get_text_extents(text, extents);
m_cairo->show_text("cairo");
m_cairo->restore();
// m_cairo->restore();
// m_cairo->save(); // save the state of the context
// m_cairo->rectangle( 30.0, 30.0, 90, 90 );
// m_cairo->set_source_rgba(0.0, 1.0, 0.0, 1.0);
// m_cairo->fill(); // fill image with the color
// m_cairo->restore();
// m_cairo->save(); // save the state of the context
// m_cairo->rectangle( 80.0, 80.0, 130, 130 );
// m_cairo->set_source_rgba(0.0, 0.0, 1.0, 0.0);
// m_cairo->fill(); // fill image with the color
// m_cairo->restore();
// m_cairo->restore();
}
unsigned char* PFDDisplay::get_buffer()
{
return m_buffer;
}
>sgoericke at vandalay.org wrote:
>> Hi there,
>>
>> i recently started with cairo and cairomm. The first things with cairomm
>1.6.4 compiled fine. I updated to cairomm 1.8.0 (as it includes some new
>stuff) but i get now compile-errors in gcc similar to:
>>
>> context.h:50 error: expected ',' or '...' before token '<'
>>
>> (similar because i'm currently at school and can't check it at home).
>>
>> Do i miss something? I used the ImageSurface.cc example from the cairomm
>website but the error remains. Thanks in advance for any help.
>>
>> Best regards,
>> Sven
>> _______________________________________________
>> cairo mailing list
>> cairo at cairographics.org
>> http://lists.cairographics.org/mailman/listinfo/cairo
>
>
>Can you give me a bit more information about what platform you're using, etc?
>
>--
>jonner
More information about the cairo
mailing list