Error while loading an Image
Sergio Arroutbi
sarroutbi at yahoo.es
Tue Aug 14 01:57:19 PDT 2007
Sorry, I forgot to mention that I had initialized all the Image Handlers.
Thanks anyway.
Regards,
Sergio.
----- Mensaje original ----
De: Lloyd <lloyd at cdactvm.in>
Para: wx-users at lists.wxwidgets.org
Enviado: martes, 14 de agosto, 2007 4:32:05
Asunto: Re: Error while loading an Image
Did you forget to initialize the image handler?
if so, see ::wxInitAllImageHandlers()
Regards,
Lloyd
On Tue, 2007-08-14 at 08:06 +0000, Sergio Arroutbi wrote:
> Hello.
>
> I am trying to load an image. I would like to associate that image to a wxPanel.
>
> However, I am getting an error:
>
> (<unknown>:20551): Gtk-CRITICAL **: gtk_window_set_default_size: assertion `width >= -1' failed
>
> (<unknown>:20551): Gtk-CRITICAL **: gtk_window_set_default_size: assertion `width >= -1' failed
>
> I am trying to associate the image just like this:
>
> image_ = new wxImage();
> imagen_->LoadFile(wxT("imagen_fondo.jpg"), wxBITMAP_TYPE_JPEG, -1);
>
> panel = new ImagePanel(NULL, imagenFondoCuandoNoCamaras);
>
>
> And then I plot the image in the wxPanel via "onPaint event".
>
> void ImagePanel::OnPaint(wxPaintEvent &event)
> {
> if (!image)
> {
> event..Skip();
> return;
> }
>
> wxPaintDC dc(this);
>
> wxMemoryDC memDC;
> wxSize size = GetClientSize();
>
> wxBitmap bitmap(image->Scale(size.GetWidth() - 6, size.GetHeight() - 6));
>
> if (bitmap.GetPalette())
> {
> memDC.SetPalette(*bitmap.GetPalette());
> dc.SetPalette(*bitmap.GetPalette());
> }
>
> memDC.SelectObject(bitmap);
>
> dc.Blit(3, 3, bitmap.GetWidth(), bitmap.GetHeight(), &memDC, 0, 0, wxCOPY, FALSE);
>
> memDC.SelectObject(wxNullBitmap);
> }
>
> // --------------------------------------------------------
> // Event table
>
> BEGIN_EVENT_TABLE(ImagePanel, wxPanel)
> // Paint event for the panel
> EVT_PAINT(ImagePanel::OnPaint)
> END_EVENT_TABLE()
>
>
> Anyway, the error only appears when performing :
>
> imagen_->LoadFile(wxT("imagen_fondo.jpg"), wxBITMAP_TYPE_JPEG, -1);
>
> So, If I let the code with no call to "LoadFile" method, I get the panel with no image, obviously.
>
> Can anyone help, please ???
>
> Thanks a lot for your help.
>
>
>
>
>
> ____________________________________________________________________________________
> Sé un Mejor Amante del Cine
> ¿Quieres saber cómo? ¡Deja que otras personas te ayuden!
> http://advision.webevents.yahoo.com/reto/entretenimiento.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
______________________________________
Scanned and protected by Email scanner
---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
____________________________________________________________________________________
Sé un Mejor Amante del Cine
¿Quieres saber cómo? ¡Deja que otras personas te ayuden!
http://advision.webevents.yahoo.com/reto/entretenimiento.html
More information about the wx-users
mailing list