Re: Help neded from Win32 devs!

From: Tomas Frydrych <tomasfrydrych_at_yahoo.co.uk>
Date: Tue Sep 28 2004 - 20:49:30 CEST

I have an implementation of this ready, but am not sure how to test
it works -- what is this used for?

Tomas

Subject: Help neded from Win32 devs!
From: Martin Sevior <msevior@physics.unimelb.edu.au>
Send reply to: msevior@physics.unimelb.edu.au
To: abiword-dev@abisource.com
Organization: University of Melbourne
Date sent: Tue, 28 Sep 2004 13:56:15 +1000

>
> Hi Guys,
> I just found out that win32 has not yet implemented the
> method...
> virtual GR_Image * createImageSegment(GR_Graphics * pG, const UT_Rect
> & rec)
> {UT_return_val_if_fail(UT_NOT_IMPLEMENTED,NULL)};
>
> In gr_Win32Graphics.
>
> Without it, visual drag and drop of text will not work. Nor will typing
> over background images work.
>
> Here is the code from the unix platfrom.
>
> Can someone have a go at implementing this? We absolutely need it
> for 2.2.
>
> Thanks!
>
> Martin
>
> /*!
> * The idea is to create a
> * new image from the rectangular segment in device units defined by
> * UT_Rect rec. The Image should be deleted by the calling routine.
> */
> GR_Image * GR_UnixImage::createImageSegment(GR_Graphics * pG,const
> UT_Rect & rec)
> {
> UT_sint32 x = pG->tdu(rec.left);
> UT_sint32 y = pG->tdu(rec.top);
> if(x < 0)
> {
> x = 0;
> }
> if(y < 0)
> {
> y = 0;
> }
> UT_sint32 width = pG->tdu(rec.width);
> UT_sint32 height = pG->tdu(rec.height);
> UT_sint32 dH = getDisplayHeight();
> UT_sint32 dW = getDisplayWidth();
> if(height > dH)
> {
> height = dH;
> }
> if(width > dW)
> {
> width = dW;
> }
> if(x + width > dW)
> {
> width = dW - x;
> }
> if(y + height > dH)
> {
> height = dH - y;
> }
> if(width < 0)
> {
> x = dW -1;
> width = 1;
> }
> if(height < 0)
> {
> y = dH -1;
> height = 1;
> }
> UT_String sName("");
> getName(sName);
> UT_String sSub("");
> UT_String_sprintf(sSub,"_segemnt_%d_%d_%d_%d",x,y,width,height);
> sName += sSub;
> GR_UnixImage * pImage = new GR_UnixImage(sName.c_str());
> UT_ASSERT(m_image);
> pImage->m_image = gdk_pixbuf_new_subpixbuf(m_image,x,y,width,height);
> //
> // gdk_pixbuf_new_subpixbuf shares pixels with the original pixbuf and
> // so puts a reference on m_image.
>
> g_object_unref(G_OBJECT(m_image));
> UT_ASSERT(G_OBJECT(m_image)->ref_count == 1);
> //
> // Make a copy so we don't have to worry about ref counting the orginal.
> //
> pImage->m_image = gdk_pixbuf_copy(pImage->m_image);
> return static_cast<GR_Image *>(pImage);
> }
>
>
Received on Tue Sep 28 20:49:10 2004

This archive was generated by hypermail 2.1.8 : Tue Sep 28 2004 - 20:49:10 CEST