Back to index

plt-scheme  4.2.1
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
wxWindowDC Class Reference

#include <WindowDC.h>

Inheritance diagram for wxWindowDC:
Inheritance graph
[legend]
Collaboration diagram for wxWindowDC:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 wxWindowDC (void)
 ~wxWindowDC (void)
Bool Blit (double xdest, double ydest, double w, double h, wxBitmap *bm, double xsrc, double ysrc, int rop=wxSOLID, wxColour *c=NULL, wxBitmap *mask=NULL)
Bool GCBlit (double xdest, double ydest, double w, double h, wxBitmap *bm, double xsrc, double ysrc, wxBitmap *mask=NULL)
Bool CanGetTextExtent (void)
Bool CanDrawBitmap (void)
void Clear (void)
void DrawArc (double x1, double y1, double x2, double y2, double xc, double yc)
void DrawEllipse (double x, double y, double w, double h)
void DrawLine (double x1, double y1, double x2, double y2)
void DrawLines (int n, wxPoint pts[], double xoff=0, double yoff=0)
void DrawPoint (double x, double y)
void DrawPolygon (int n, wxPoint pts[], double xoff=0, double yoff=0, int fill=wxODDEVEN_RULE)
void DrawRectangle (double x, double y, double w, double h)
void DrawRoundedRectangle (double x, double y, double w, double h, double radius=20)
void DrawPath (wxPath *p, double dx, double dy, int fill=wxODDEVEN_RULE)
void DrawText (char *text, double x, double y, Bool combine=FALSE, Bool use16=FALSE, int dt=0, double angle=0.0)
double GetCharHeight (void)
double GetCharWidth (void)
void GetTextExtent (const char *s, double *w, double *h, double *descent=0, double *ext_leading=0, wxFont *font=NULL, Bool combine=FALSE, Bool use16bit=FALSE, int dt=0, int len=-1)
void SetBackground (wxColour *c)
void SetBrush (wxBrush *brush)
void ResetBrush (wxBrush *brush)
void SetClippingRect (double x, double y, double w, double h)
void SetClippingRegion (wxRegion *)
wxRegionGetClippingRegion ()
void SetColourMap (wxColourMap *cmap)
void SetFont (wxFont *font)
void SetPen (wxPen *pen)
void ResetPen (wxPen *pen)
void SetTextBackground (wxColour *col)
void SetTextForeground (wxColour *col)
void SetCanvasClipping (void)
virtual void GetSize (double *w, double *h)
void TryColour (wxColour *src, wxColour *dest)
Bool GetPixel (double x, double y, wxColour *col)
void BeginSetPixel (int mini, int near_i, int near_j)
void EndSetPixel ()
void SetPixel (double x, double y, wxColour *col)
Bool BeginSetPixelFast (int x, int y, int w, int h)
void EndSetPixelFast ()
void SetPixelFast (int x, int y, int r, int g, int b)
Bool BeginGetPixelFast (int x, int y, int w, int h)
void EndGetPixelFast ()
void GetPixelFast (int x, int y, int *r, int *g, int *b)
void FillPrivateColor (wxColour *c)
virtual Bool GlyphAvailable (int c, wxFont *f=NULL)
virtual Bool Ok (void)
virtual int CacheFontMetricsKey ()
void SetAntiAlias (int v)
virtual void DrawLines (wxList *pts, double xoff=0, double yoff=0)
void DrawPoint (wxPoint *pt)
virtual void DrawPolygon (wxList *pts, double xoff=0, double yoff=0, int fill=wxODDEVEN_RULE)
virtual Bool StartDoc (char *WXUNUSED(message))
virtual void EndDoc (void)
virtual void StartPage (void)
virtual void EndPage (void)
void AutoSetTools (Bool set_auto)
void BeginDrawing (void)
virtual double DeviceToLogicalX (int x)
virtual double DeviceToLogicalXRel (int x)
virtual double UnscrolledDeviceToLogicalX (int x)
virtual double DeviceToLogicalY (int y)
virtual double DeviceToLogicalYRel (int y)
virtual double UnscrolledDeviceToLogicalY (int y)
void DrawSpline (int n, wxPoint pts[])
void DrawSpline (wxList *pts)
virtual void DrawSpline (double x1, double y1, double x2, double y2, double x3, double y3)
void EndDrawing (void)
wxColourGetBackground (void)
wxBrushGetBrush (void)
wxFontGetFont (void)
int GetMapMode (void)
Bool GetOptimization (void)
wxPenGetPen (void)
Bool GetPixel (double WXUNUSED(x), double WXUNUSED(y), wxColour *WXUNUSED(col))
void GetSizeMM (double *w, double *h)
int GetTextAlignment (void)
wxColourGetTextBackground (void)
wxColourGetTextForeground (void)
virtual int LogicalToDeviceX (double x)
virtual int LogicalToDeviceXRel (double x)
virtual int LogicalToUnscrolledDeviceX (double x)
virtual int LogicalToDeviceY (double y)
virtual int LogicalToDeviceYRel (double y)
virtual int LogicalToUnscrolledDeviceY (double y)
virtual double FLogicalToDeviceX (double x)
virtual double FLogicalToDeviceXRel (double x)
virtual double FLogicalToUnscrolledDeviceX (double x)
virtual double FLogicalToDeviceY (double y)
virtual double FLogicalToDeviceYRel (double y)
virtual double FLogicalToUnscrolledDeviceY (double y)
void SetBackgroundMode (int mode)
int GetBackgroundMode ()
void SetOptimization (Bool opt)
void SetTextAlignment (int new_alignment)
void SetDeviceOrigin (double x, double y)
void SetLogicalScale (double xs, double ys)
void SetMapMode (int mode)
virtual void SetUserScale (double xs, double ys)
void GetUserScale (double *xs, double *ys)
void GetDeviceOrigin (double *x, double *y)
int GetAntiAlias ()
virtual void SetAlpha (double d)
double GetAlpha ()
void install_cleanup ()
voidoperator new (size_t size)
voidoperator new (size_t size, GCPlacement gcp)
voidoperator new (size_t size, void *p)
voidoperator new (size_t size)
voidoperator new (size_t size, GCPlacement gcp)
void operator delete (void *obj)
void operator delete (void *, void *)
void operator delete (void *obj)
voidoperator new[] (size_t size)
voidoperator new[] (size_t size, GCPlacement gcp)
voidoperator new[] (size_t size, void *p)
void operator delete[] (void *obj)
void operator delete[] (void *, void *)

Public Attributes

Bool Colour
int device
double current_alpha
WXTYPE __type
void__gc_external

Protected Member Functions

void Initialize (wxWindowDC_Xinit *init)
void Destroy (void)
virtual void FreeGetPixelCache (void)
void CalcBoundingBox (double x, double y)
void ComputeScaleAndOrigin (void)
double XDEV2LOG (int x)
double XDEV2LOGREL (int x)
double YDEV2LOG (int y)
double YDEV2LOGREL (int y)
int XLOG2DEV (double x)
int XLOG2DEVREL (double x)
int YLOG2DEV (double y)
int YLOG2DEVREL (double y)
virtual void DrawOpenSpline (wxList *pts)

Protected Attributes

char need_x_set_font
wxWindowDC_Xintern * X
Bool auto_setting
Bool optimize
Bool ok
double mm_to_pix_x
double mm_to_pix_y
double scale_x
double scale_y
double device_origin_x
double device_origin_y
double logical_scale_x
double logical_scale_y
double user_scale_x
double user_scale_y
wxColourcurrent_background_color
wxBrushcurrent_brush
wxColourMapcurrent_cmap
wxFontcurrent_font
int current_map_mode
wxPencurrent_pen
int current_text_alignment
wxColourcurrent_text_bg
int current_text_bgmode
wxColourcurrent_text_fg
wxRegionclipping
int anti_alias

Friends

class wxWindow
class wxPostScriptDC

Detailed Description

Definition at line 123 of file WindowDC.h.


Constructor & Destructor Documentation

Definition at line 118 of file WindowDC.cc.

                           : wxDC()
{
    __type = wxTYPE_DC_CANVAS;

    device = wxDEVICE_CANVAS;

    X = new wxWindowDC_Xintern; // allocate space for X data

    PEN_GC = BRUSH_GC = TEXT_GC = BG_GC = NULL;
    USER_REG = EXPOSE_REG = CURRENT_REG = NULL;
    DPY = NULL;
    SCN = NULL;
    DRAWABLE = 0;
    DRAW_WINDOW = 0;
    WIDTH = HEIGHT = DEPTH = 0;

    X->get_pixel_image_cache = NULL;

    if (!hatch_bitmaps) {
       Display *dpy = wxAPP_DISPLAY;
       Window  win  = RootWindow(dpy, DefaultScreen(dpy));
       wxREGGLOB(hatch_bitmaps);
       hatch_bitmaps = new WXGC_ATOMIC Pixmap[num_hatches];
       hatch_bitmaps[0] = XCreateBitmapFromData(dpy, win, bdiag_bits,
                                           bdiag_width, bdiag_height);
       hatch_bitmaps[1] = XCreateBitmapFromData(dpy, win, cdiag_bits,
                                           cdiag_width, cdiag_height);
       hatch_bitmaps[2] = XCreateBitmapFromData(dpy, win, fdiag_bits,
                                           fdiag_width, fdiag_height);
       hatch_bitmaps[3] = XCreateBitmapFromData(dpy, win, cross_bits,
                                           cross_width, cross_height);
       hatch_bitmaps[4] = XCreateBitmapFromData(dpy, win, horiz_bits,
                                           horiz_width, horiz_height);
       hatch_bitmaps[5] = XCreateBitmapFromData(dpy, win, verti_bits,
                                           verti_width, verti_height);
    }

    current_background_color->CopyFrom(wxWHITE);
    current_brush = wxWHITE_BRUSH;
    current_brush->Lock(1);
    current_pen = wxBLACK_PEN;
    current_pen->Lock(1);
    current_font = wxNORMAL_FONT;

    need_x_set_font = 1;
}

Here is the call graph for this function:

Definition at line 165 of file WindowDC.cc.

{
    if (current_pen) current_pen->Lock(-1);
    if (current_brush) current_brush->Lock(-1);
    if (clipping) --clipping->locked;

    Destroy();

#ifdef USE_GL
    X->wx_gl = NULL;
#endif
}

Here is the call graph for this function:


Member Function Documentation

void wxDC::AutoSetTools ( Bool  set_auto) [inline, inherited]

Definition at line 132 of file DC.h.

       { auto_setting = set_auto; }
void wxDC::BeginDrawing ( void  ) [inline, inherited]

Definition at line 134 of file DC.h.

       {}
Bool wxWindowDC::BeginGetPixelFast ( int  x,
int  y,
int  w,
int  h 
)

Definition at line 3249 of file WindowDC.cc.

{
  if ((x >= 0) && (y >= 0)
      && ((unsigned int)(x + w) <= X->width)
      && ((unsigned int)(y + h) <= X->height)) {

    /* Possible improvement: get only the revelant section of the
       bitmap into the image cache, instead of always the entire
       image. (In that case, use offsets in the fast Get and Put
       operations.) */

    if (X->get_pixel_image_cache
        && (X->cache_dx
            || X->cache_dy
            || (X->get_pixel_image_cache->width < (int)X->width)
            || (X->get_pixel_image_cache->height < (int)X->height))) {
      /* Need to get out of mini mode */
      EndSetPixel();
    }

    BeginSetPixel(0, 0, 0);
    return TRUE;
  } else
    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxWindowDC::BeginSetPixel ( int  mini,
int  near_i,
int  near_j 
)

Definition at line 3001 of file WindowDC.cc.

{
  unsigned int w, h, dx, dy, ni = (unsigned int)near_i, nj = (unsigned int)near_j;

  if (!DRAWABLE)
    return;

  if (X->get_pixel_image_cache)
    return;

  w = X->width;
  h = X->height;

  if (X->is_window) {
    /* Disallow: */
    return;
  }

  if (mini) {
    /* To lessen the cost of localized get-pixel and set-pixel
       in a large bitmap, we first try to get a small piece
       of the bitmap in "mini" mode. If we need more, then we'll
       jump to "whole-image" mode. */
    if (w > wxMINI_SIZE) {
      if (ni < (wxMINI_SIZE / 2))
       dx = 0;
      else if ((ni + (wxMINI_SIZE / 2)) > w)
       dx = w - wxMINI_SIZE;
      else
       dx = ni - (wxMINI_SIZE / 2);
      w = wxMINI_SIZE;
    } else
      dx = 0;
    if (h > wxMINI_SIZE) {
      if (nj < (wxMINI_SIZE / 2))
       dy = 0;
      else if ((nj + (wxMINI_SIZE / 2)) > h)
       dy = h - wxMINI_SIZE;
      else
       dy = nj - (wxMINI_SIZE / 2);
      h = wxMINI_SIZE;
    } else
      dy = 0;
  } else {
    dx = 0;
    dy = 0;
  }

  {
    XImage *img;
    img = XGetImage(DPY, DRAWABLE, dx, dy, w, h, AllPlanes, ZPixmap);
    X->get_pixel_image_cache = img;
  }
  
  X->get_pixel_cache_pos = 0;
  X->get_pixel_cache_full = FALSE;
  if (!wx_alloc_color_is_fast || (X->get_pixel_image_cache->depth == 1)) {
    XColor *cols;
    cols = new WXGC_ATOMIC XColor[NUM_GETPIX_CACHE_COLORS];
    X->get_pixel_color_cache = cols;

    if (X->get_pixel_image_cache->depth == 1) {
      cols[0].pixel = 1;
      cols[0].red = 0;
      cols[0].green = 0;
      cols[0].blue = 0;

      cols[1].pixel = 0;
      cols[1].red = 255;
      cols[1].green = 255;
      cols[1].blue = 255;
      X->get_pixel_cache_pos = 2;
    }
  }
  X->set_a_pixel = FALSE;
  X->cache_dx = dx;
  X->cache_dy = dy;
}

Here is the caller graph for this function:

Bool wxWindowDC::BeginSetPixelFast ( int  x,
int  y,
int  w,
int  h 
)

Definition at line 3143 of file WindowDC.cc.

{
  if (BeginGetPixelFast(x, y, w, h)) {
    X->set_a_pixel = TRUE;
    return TRUE;
  } else
    return FALSE;
}

Here is the call graph for this function:

Bool wxWindowDC::Blit ( double  xdest,
double  ydest,
double  w,
double  h,
wxBitmap bm,
double  xsrc,
double  ysrc,
int  rop = wxSOLID,
wxColour c = NULL,
wxBitmap mask = NULL 
) [virtual]

Implements wxDC.

Definition at line 572 of file WindowDC.cc.

{
    Bool retval = FALSE;
    wxPen *savePen, *apen;
    wxColor *saveBack;
    int scaled_width;
    int scaled_height;
    int tx, ty;
    wxBitmap *tmp = NULL, *tmp_mask = NULL;
    int should_xrender = 0;

    if (!DRAWABLE) // ensure that a drawable has been associated
      return FALSE;
    
    if (!src->Ok())
      return FALSE;

    if (src->selectedTo)
      src->selectedTo->EndSetPixel();
    if (mask && mask->selectedTo)
      mask->selectedTo->EndSetPixel();

#ifdef WX_USE_XRENDER
    /* Decide whether to use Xrender before scaling...

       Non-monochrome masks require the Xrender extension. We expect
       that Xrender it's also better when we have a monochrome mask.

       Use Xrender extension when:

         - It's available at compile time and run time
        - There's a mask or scale
        - One of:
             * the rop is ignored (because the src is not mono)
             * the rop is wxSOLID (not wxSTIPPLE, which means "opaque")
        - One of:
             * the color is ignored (because the src is not mono)
            * the color is black/unspecified

      Under other circumstances, it doesn't work right. */
    
    
    
    should_xrender= (wxXRenderHere()
                   && (mask 
                      || (WX_RENDER_CAN_SCALE && ((user_scale_x != 1.0) || (user_scale_y != 1.0))))
                   && ((src->GetDepth() > 1)
                      || ((rop == wxSOLID)
                          && (!dcolor || (!dcolor->Red() && !dcolor->Green() && !dcolor->Blue())))));

#endif

    tx = (int)XLOG2DEV(xdest);
    ty = (int)YLOG2DEV(ydest);

    w = ((src->GetWidth()  < w) ? src->GetWidth() : w);
    h = ((src->GetHeight() < h) ? src->GetHeight() : h);

    scaled_width = (int)XLOG2DEV(xdest + w) - tx;
    scaled_height = (int)YLOG2DEV(ydest + h) - ty;

    /* Handle scaling by creating a new, temporary bitmap: */
    if ((!should_xrender || !WX_RENDER_CAN_SCALE)
       && ((scaled_width != (int)w) || (scaled_height != (int)h))) {
      int retval;
      src = ScaleBitmap(src, scaled_width, scaled_height, xsrc, ysrc, w, h, DPY, &tmp, &retval, 0, 0);
      if (!src)
       return retval;
      if (mask) {
       mask = ScaleBitmap(mask, scaled_width, scaled_height, xsrc, ysrc, w, h, DPY, &tmp_mask, &retval, 
                        !should_xrender, wx_white_pixel);
       if (!mask) {
         DELETE_OBJ tmp;
         return retval;
       }
      }

      /* Temp bitmaps use only the relevant section: */
      xsrc = 0;
      ysrc = 0;
    }

    xsrc = floor(xsrc);
    ysrc = floor(ysrc);
    
#ifdef WX_USE_XRENDER
    if (should_xrender) {
      /* Using Xrender... */
      Picture destp, srcp, maskp;
      wxBitmap *free_bmp = NULL;
      int mono_src;
# ifndef WX_XR_PICTURE
      XftDraw *maskd = NULL;
# endif

      mono_src = (src->GetDepth() == 1);

      /* Create an Xrender picture for each X pixmap.
        With old XFT version, give up on caching Picture. */
# ifdef WX_OLD_XFT
      destp = wxMakeXrenderPicture(DRAWABLE, Colour);
# else
      if (!X->picture)
       InitPicture();
      destp = PICTURE;
# endif

# ifdef WX_OLD_XFT
      {
       int sd;
       Pixmap spm;
       spm = GETPIXMAP(src);
       sd = src->GetDepth();
       srcp = wxMakeXrenderPicture(spm, sd != 1);
      }
# else
      {
       long p;
       p = src->GetPicture();
       srcp = TO_PICTURE(p);
      }
# endif

      /* Mask case is more difficult if it's not 1 bit: */
      if (mask) {
       if (mask->GetDepth() == 1) {
         /* Easy: */
# ifdef WX_OLD_XFT
         Pixmap mpm;
         mpm = GETPIXMAP(mask);
         maskp = wxMakeXrenderPicture(mpm, 0);
# else
         long p;
         p = mask->GetPicture();
         maskp = TO_PICTURE(p);
# endif
       } else {
         /* Need an 8-bit alpha (grayscale) mask. */
         wxBitmap *bm;

         bm = mask->GetMaskBit();
         if (bm) {
           Pixmap bpm;
           
           bpm = GETPIXMAP(bm);

# ifdef WX_XR_PICTURE
           maskp = XRenderCreatePicture(wxAPP_DISPLAY,
                                    bpm,
                                    alpha_format,
                                    0,
                                    NULL);
# else
           maskd = XftDrawCreateAlpha(wxAPP_DISPLAY,
                                   bpm,
                                   8);
           maskp = TO_PICTURE(maskd);
# endif
           
           free_bmp = bm;
         } else
           maskp = 0;
       }
      } else
       maskp = 0;

# ifdef WX_XR_PICTURE
      /* Need to install clipping region, if any: */
      if (CURRENT_REG) {
       XRenderSetPictureClipRegion(wxAPP_DISPLAY, destp, CURRENT_REG);
      }
# endif

# if WX_RENDER_CAN_SCALE
      if ((scaled_width != (int)w) || (scaled_height != (int)h)) {
       XTransform xform;
       int ih = (int)h, iw = (int)w;

       xform.matrix[0][0] = scaled_height * iw;
       xform.matrix[0][1] = 0;
       xform.matrix[0][2] = 0;

       xform.matrix[1][0] = 0;
       xform.matrix[1][1] = scaled_width * ih; 
       xform.matrix[1][2] = 0;

       xform.matrix[2][0] = 0;
       xform.matrix[2][1] = 0;
       xform.matrix[2][2] = scaled_width * scaled_height; 

       XRenderSetPictureTransform(wxAPP_DISPLAY, srcp, &xform);
       if (maskp)
         XRenderSetPictureTransform(wxAPP_DISPLAY, maskp, &xform);
      }
# endif

      /* This is the actual blit. */
      XRenderComposite(wxAPP_DISPLAY,
                     (mask || mono_src) ? PictOpOver : PictOpSrc,
                     srcp,
                     mask ? maskp : (mono_src ? srcp : 0),
                     destp,
                     (long)xsrc, (long)ysrc,
                     (long)xsrc, (long)ysrc,
                     tx, ty,
                     scaled_width,
                     scaled_height);
      
      retval = 1; /* or so we assume */

      /* Free temporary data (old Xft) */
# ifdef WX_OLD_XFT
      XRenderFreePicture(wxAPP_DISPLAY, destp);
      XRenderFreePicture(wxAPP_DISPLAY, srcp);
      srcp = 0;
      if (!free_bmp) {
       XRenderFreePicture(wxAPP_DISPLAY, maskp);
       maskp = 0;
      }
# else
#  ifdef WX_XR_PICTURE
      if (CURRENT_REG) {
       XRenderPictureAttributes attribs;
       attribs.clip_mask = None;
       XRenderChangePicture(wxAPP_DISPLAY, destp, CPClipMask, &attribs);
      }
#  endif
# endif

      /* Free temporary data (all modes) */
      if (free_bmp) {
# ifdef WX_XR_PICTURE
       XRenderFreePicture(wxAPP_DISPLAY, maskp);
# else
       XftDrawDestroy(maskd);      
# endif
       maskp = 0;
      }

# if WX_RENDER_CAN_SCALE
      if ((srcp || maskp) 
         && ((scaled_width != (int)w) || (scaled_height != (int)h))) {
       XTransform xform;

       xform.matrix[0][0] = 1;
       xform.matrix[0][1] = 0;
       xform.matrix[0][2] = 0;

       xform.matrix[1][0] = 0;
       xform.matrix[1][1] = 1;
       xform.matrix[1][2] = 0;

       xform.matrix[2][0] = 0;
       xform.matrix[2][1] = 0;
       xform.matrix[2][2] = 1;

       if (srcp)
         XRenderSetPictureTransform(wxAPP_DISPLAY, srcp, &xform);
       if (maskp)
         XRenderSetPictureTransform(wxAPP_DISPLAY, maskp, &xform);
      }
# endif
    } else {
#endif
      /* Non-Xrender mode... */

      if (src->GetDepth() > 1) {
       /* This is color to mono/color.
          Neither rop nor dcolor matter, so use GCBlit. */
       retval = GCBlit(xdest, ydest, w, h, src, xsrc, ysrc, mask);
      } else {

       /* This is mono to mono/color */

       FreeGetPixelCache();

       savePen = current_pen;
       saveBack = new wxColour(current_background_color);
       /* Pen GC used for blit: */
       apen = wxThePenList->FindOrCreatePen(dcolor ? dcolor : wxBLACK, 0, rop);
       SetPen(apen);

       if (DRAWABLE && src->Ok()) {
         Region free_rgn = NULL;

         if (mask)
           tmp_mask = IntersectBitmapRegion(PEN_GC, EXPOSE_REG, USER_REG, mask,
                                        &free_rgn,
                                        &tx, &ty,
                                        &scaled_width, &scaled_height,
                                        &xsrc, &ysrc,
                                        DPY, wx_white_pixel);

         // Check if we're copying from a mono bitmap
         retval = TRUE;
         if ((rop == wxSOLID) || (rop == wxXOR)) {
           /* Seems like the easiest way to implement transparent backgrounds is to
              use a stipple. */
           XGCValues values;
           unsigned long mask = GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin;
           values.stipple = GETPIXMAP(src);
           values.fill_style = FillStippled;
           values.ts_x_origin = ((tx - (long)xsrc) % src->GetWidth());
           values.ts_y_origin = ((ty - (long)ysrc) % src->GetHeight());
           XChangeGC(DPY, PEN_GC, mask, &values);
           XFillRectangle(DPY, DRAWABLE, PEN_GC, tx, ty, scaled_width, scaled_height);

           /* Restore pen: */
           values.fill_style = FillSolid;
           XChangeGC(DPY, PEN_GC, GCFillStyle, &values);
         } else {
           /* Opaque (i.e., white pixels transferred as background) */
           Pixmap pm;
           pm = GETPIXMAP(src);
           XCopyPlane(DPY, pm, DRAWABLE, PEN_GC,
                     (long)xsrc, (long)ysrc,
                     scaled_width, scaled_height,
                     tx, ty, 1);
         }
         
         /* restore pen: */
         if (mask)
           SetCanvasClipping();
         
         if (free_rgn)
           XDestroyRegion(free_rgn);
       }

       SetPen(savePen);
       SetBackground(saveBack);
      }
#ifdef WX_USE_XRENDER
    }
#endif
    
    if (tmp) {
      DELETE_OBJ tmp;
    }
    if (tmp_mask) {
      DELETE_OBJ tmp_mask;
    }

    return retval; // #f => something wrong with the drawables
}

Here is the call graph for this function:

virtual int wxWindowDC::CacheFontMetricsKey ( ) [virtual]

Reimplemented from wxDC.

void wxDC::CalcBoundingBox ( double  x,
double  y 
) [protected, inherited]
Bool wxWindowDC::CanDrawBitmap ( void  ) [inline, virtual]

Implements wxDC.

Definition at line 134 of file WindowDC.h.

{ return TRUE; }
Bool wxWindowDC::CanGetTextExtent ( void  ) [inline, virtual]

Implements wxDC.

Definition at line 133 of file WindowDC.h.

{ return TRUE; }
void wxWindowDC::Clear ( void  ) [virtual]

Implements wxDC.

Definition at line 1132 of file WindowDC.cc.

{
  unsigned int w, h;
  Window wdummy; int sdummy; unsigned int udummy;
  
  if (!DRAWABLE) // ensure that a drawable has been associated
    return;
  
  FreeGetPixelCache();
  
  XGetGeometry(DPY, DRAWABLE, &wdummy, &sdummy, &sdummy,
              &w, &h, &udummy, &udummy);
  
#ifdef WX_USE_CAIRO
  if (anti_alias) {
    wxColour *c;
    int r, g, b;
    
    InitCairoDev();

    c = current_background_color;
    r = c->Red();
    g = c->Green();
    b = c->Blue();
    cairo_set_source_rgba(CAIRO_DEV, 
                          r / 255.0, g / 255.0, b / 255.0,
                          current_alpha);

    cairo_new_path(CAIRO_DEV);
    cairo_move_to(CAIRO_DEV, 0, 0);
    cairo_line_to(CAIRO_DEV, w, 0);
    cairo_line_to(CAIRO_DEV, w, h);
    cairo_line_to(CAIRO_DEV, 0, h);
    cairo_fill(CAIRO_DEV);

    return;
  }
#endif
 
  XFillRectangle(DPY, DRAWABLE, BG_GC, 0, 0, w, h);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxDC::ComputeScaleAndOrigin ( void  ) [protected, inherited]

Definition at line 93 of file DC.cc.

Here is the caller graph for this function:

void wxWindowDC::Destroy ( void  ) [protected]

Definition at line 2868 of file WindowDC.cc.

{
#ifdef WX_USE_CAIRO
    ReleaseCairoDev();
#endif

    if (PEN_GC)    XFreeGC(DPY, PEN_GC);
    if (BRUSH_GC)  XFreeGC(DPY, BRUSH_GC);
    if (TEXT_GC)   XFreeGC(DPY, TEXT_GC);
    if (BG_GC)     XFreeGC(DPY, BG_GC);
    PEN_GC = BRUSH_GC = TEXT_GC = BG_GC = NULL;

    if (CURRENT_REG) XDestroyRegion(CURRENT_REG);
    if (EXPOSE_REG) XDestroyRegion(EXPOSE_REG);
    CURRENT_REG = USER_REG = EXPOSE_REG = NULL;

#ifdef WX_USE_XRENDER
    wxFreePicture(X->picture);
    X->picture = 0;
#endif
#ifdef USE_GL
    if (X->wx_gl) {
      X->wx_gl->Reset(NULL, 0, 0);
    }
#endif
}

Here is the caller graph for this function:

virtual double wxDC::DeviceToLogicalX ( int  x) [inline, virtual, inherited]

Definition at line 136 of file DC.h.

       { return XDEV2LOG(x); }

Here is the call graph for this function:

virtual double wxDC::DeviceToLogicalXRel ( int  x) [inline, virtual, inherited]

Definition at line 138 of file DC.h.

       { return XDEV2LOGREL(x); }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual double wxDC::DeviceToLogicalY ( int  y) [inline, virtual, inherited]

Definition at line 142 of file DC.h.

       { return YDEV2LOG(y); }

Here is the call graph for this function:

virtual double wxDC::DeviceToLogicalYRel ( int  y) [inline, virtual, inherited]

Definition at line 144 of file DC.h.

       { return YDEV2LOGREL(y); }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxWindowDC::DrawArc ( double  x1,
double  y1,
double  x2,
double  y2,
double  xc,
double  yc 
) [virtual]

Implements wxDC.

Definition at line 1174 of file WindowDC.cc.

{
  int xx, yy, ww, hh;
  double xw, yh;
  double degrees1, degrees2;
  int alpha1, alpha2;

  if (!DRAWABLE) // ensure that a drawable has been associated
    return;
  
  FreeGetPixelCache();

#ifdef WX_USE_CAIRO
  if (anti_alias) {
    InitCairoDev();

    start = -start;
    end = -end;

    if (SetCairoBrush()) {
      double xx, yy, ww, hh;

      xx = SmoothingXFormXB(x);
      yy = SmoothingXFormYB(y);
      ww = SmoothingXFormW(w, x);
      hh = SmoothingXFormH(h, y);

      cairo_save(CAIRO_DEV);
      cairo_translate(CAIRO_DEV, xx, yy);
      cairo_scale(CAIRO_DEV, ww, hh);
      cairo_new_path(CAIRO_DEV);
      cairo_move_to(CAIRO_DEV, 0.5, 0.5);
      cairo_arc_negative(CAIRO_DEV, 0.5, 0.5, 0.5, start, end);
      cairo_fill(CAIRO_DEV);
      cairo_restore(CAIRO_DEV);
    }
    
    
    if (SetCairoPen()) {
      double xx, yy, ww, hh;
      cairo_matrix_p m;

      xx = SmoothingXFormX(x);
      yy = SmoothingXFormY(y);
      ww = SmoothingXFormWL(w, x);
      hh = SmoothingXFormHL(h, y);
      
      cairo_set_matrix_create(m);
      cairo_current_matrix (CAIRO_DEV, m);
      cairo_translate(CAIRO_DEV, xx, yy);
      cairo_scale(CAIRO_DEV, ww, hh);
      cairo_new_path(CAIRO_DEV);
      cairo_arc_negative(CAIRO_DEV, 0.5, 0.5, 0.5, start, end);
      cairo__set_matrix(CAIRO_DEV, m);
      cairo_stroke(CAIRO_DEV);
      cairo_matrix_destroy(m);
    }

    return;
  }
#endif

  xw = x + w, yh = y + h;
  
  xx = XLOG2DEV(x); yy = YLOG2DEV(y);
  ww = XLOG2DEV(xw) - xx; hh = YLOG2DEV(yh) - yy;
  
  degrees1 = start * RAD2DEG;
  degrees2 = end * RAD2DEG;
  alpha1 = int(degrees1 * 64.0);
  alpha2 = int((degrees2 - degrees1) * 64.0);
  while (alpha2 <= 0) {
    alpha2 += 360*64;
  }
  while (alpha1 > 360*64) {
    alpha1 -= 360*64;
  }
  
  if (current_brush && current_brush->GetStyle() != wxTRANSPARENT)
    XFillArc(DPY,DRAWABLE,BRUSH_GC,xx,yy,ww,hh,alpha1,alpha2);
  if (current_pen && current_pen->GetStyle() != wxTRANSPARENT)
    XDrawArc(DPY,DRAWABLE,PEN_GC,xx,yy,ww,hh,alpha1,alpha2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxWindowDC::DrawEllipse ( double  x,
double  y,
double  w,
double  h 
) [virtual]

Implements wxDC.

Definition at line 1258 of file WindowDC.cc.

{
  int x1, y1, w1, h1;
  double xw, yh;

  if (!DRAWABLE) // ensure that a drawable has been associated
    return;
  
  FreeGetPixelCache();

#ifdef WX_USE_CAIRO
  if (anti_alias) {
    DrawArc(x, y, w, h, 0, 2 * wxPI);
    return;
  }
#endif

  xw = x + w, yh = y + h;
  
  x1 = XLOG2DEV(x);
  y1 = YLOG2DEV(y);
  w1 = XLOG2DEV(xw) - x1;
  h1 = YLOG2DEV(yh) - y1;
  
  if (current_brush && current_brush->GetStyle() != wxTRANSPARENT)
    XFillArc(DPY, DRAWABLE, BRUSH_GC, x1, y1,
            w1 - WX_GC_CF, h1 - WX_GC_CF, 0, 64*360);
  if (current_pen && current_pen->GetStyle() != wxTRANSPARENT)
    XDrawArc(DPY, DRAWABLE, PEN_GC, x1, y1,
            w1 - WX_GC_CF, h1 - WX_GC_CF, 0, 64*360);
}

Here is the call graph for this function:

void wxWindowDC::DrawLine ( double  x1,
double  y1,
double  x2,
double  y2 
) [virtual]

Implements wxDC.

Definition at line 1290 of file WindowDC.cc.

{
    if (!DRAWABLE) // ensure that a drawable has been associated
       return;

    FreeGetPixelCache();

    if (current_pen && current_pen->GetStyle() != wxTRANSPARENT) {
#ifdef WX_USE_CAIRO
      if (anti_alias) {
       double xx1, yy1, xx2, yy2;

       InitCairoDev();
       
       SetCairoPen();

       xx1 = SmoothingXFormX(x1);
       yy1 = SmoothingXFormY(y1);
       xx2 = SmoothingXFormX(x2);
       yy2 = SmoothingXFormY(y2);

       cairo_new_path(CAIRO_DEV);
       cairo_move_to(CAIRO_DEV, xx1, yy1);
       cairo_line_to(CAIRO_DEV, xx2, yy2);
       cairo_stroke(CAIRO_DEV);
      } else
#endif
       XDrawLine(DPY, DRAWABLE, PEN_GC,
                XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2));
    }
}

Here is the call graph for this function:

void wxDC::DrawLines ( wxList pts,
double  xoff = 0,
double  yoff = 0 
) [virtual, inherited]

Definition at line 166 of file DC.cc.

{
  int n;
  wxPoint *points;

  n = list->Number();
  points = PointListToArray(list, n);

  DrawLines(n, points, xoffset, yoffset);
}

Here is the call graph for this function:

void wxWindowDC::DrawLines ( int  n,
wxPoint  pts[],
double  xoff = 0,
double  yoff = 0 
) [virtual]

Implements wxDC.

Definition at line 1322 of file WindowDC.cc.

{
  XPoint *xpts;
  int i;

  if (!DRAWABLE) // ensure that a drawable has been associated
    return;

  if (!current_pen || (current_pen->GetStyle() == wxTRANSPARENT))
    return;

  if (n < 2)
    return;

  FreeGetPixelCache();
  
#ifdef WX_USE_CAIRO
  if (anti_alias) {
    int i;

    InitCairoDev();
    
    SetCairoPen();

    cairo_new_path(CAIRO_DEV);
    cairo_move_to(CAIRO_DEV, SmoothingXFormX(pts[0].x + xoff), SmoothingXFormY(pts[0].y + yoff));
    for (i = 1; i < n; i++) {
      cairo_line_to(CAIRO_DEV, SmoothingXFormX(pts[i].x + xoff), SmoothingXFormY(pts[i].y + yoff));
    }
    cairo_stroke(CAIRO_DEV);    

    return;
  }
#endif

  xpts = new WXGC_ATOMIC XPoint[n];
  for (i=0; i<n; ++i) {
    short x, y;
    x = XLOG2DEV(pts[i].x + xoff);
    xpts[i].x = x;
    y = YLOG2DEV(pts[i].y + yoff);
    xpts[i].y = y;
  }
  XDrawLines(DPY, DRAWABLE, PEN_GC, xpts, n, 0);
}

Here is the call graph for this function:

void wxDC::DrawOpenSpline ( wxList pts) [protected, virtual, inherited]

Definition at line 286 of file DC.cc.

{
    wxPoint *p;
    double  cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
    double  x1,  y1,  x2 , y2;
    wxNode *node;

    node = pts->First();
    p = (wxPoint*)node->Data();
    x1 = p->x; y1 = p->y;

    node = node->Next();
    p = (wxPoint *)node->Data();
    x2 = p->x; y2 = p->y;

    cx1 = half(x1, x2);  cy1 = half(y1, y2);
    cx2 = half(cx1, x2); cy2 = half(cy1, y2);

    wx_spline_add_point(x1, y1);

    while ((node=node->Next()) != NULL) {
        p = (wxPoint*)node->Data();
       x1  = x2;           y1  = y2;
       x2  = p->x;         y2  = p->y;
        cx4 = half(x1, x2);   cy4 = half(y1, y2);
        cx3 = half(x1, cx4);  cy3 = half(y1, cy4);

        wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);

       cx1 = cx4;          cy1 = cy4;
        cx2 = half(cx1, x2);  cy2 = half(cy1, y2);
    }
    wx_spline_add_point(cx1, cy1);
    wx_spline_add_point(x2, y2);
    wx_spline_draw_point_array(this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxWindowDC::DrawPath ( wxPath p,
double  dx,
double  dy,
int  fill = wxODDEVEN_RULE 
) [virtual]

Implements wxDC.

Definition at line 1611 of file WindowDC.cc.

{
  double **ptss;
  int *lens, cnt, i, total_cnt, j, k, ix, iy;
  XPoint *xpts;

  if (!DRAWABLE) // ensure that a drawable has been associated
    return;

  FreeGetPixelCache();

#ifdef WX_USE_CAIRO
  if (anti_alias) {

    InitCairoDev();
    if (SetCairoBrush()) {
      if (fill == wxODDEVEN_RULE)
       cairo_set_fill_rule(CAIRO_DEV, CAIRO_FILL_RULE_EVEN_ODD);

      if (AlignSmoothing()) {
       double pw;
       pw = GetPenSmoothingOffset();
       p->Install((long)CAIRO_DEV, xoff, yoff, 
                 device_origin_x, device_origin_y, user_scale_x, user_scale_y, 
                 TRUE, pw, pw);
      } else
       p->Install((long)CAIRO_DEV, xoff, yoff, 0, 0, 1, 1, FALSE, 0, 0);
      cairo_fill(CAIRO_DEV);

      if (fill == wxODDEVEN_RULE)
       cairo_set_fill_rule(CAIRO_DEV, CAIRO_FILL_RULE_WINDING);
    }

    if (SetCairoPen()) {
      if (AlignSmoothing()) {
       double pw;
       pw = GetPenSmoothingOffset();
       p->Install((long)CAIRO_DEV, xoff, yoff, 
                 device_origin_x, device_origin_y, user_scale_x, user_scale_y, 
                 TRUE, pw, pw);
      } else
       p->Install((long)CAIRO_DEV, xoff, yoff, 0, 0, 1, 1, FALSE, 0, 0);
      cairo_stroke(CAIRO_DEV);
    }

    return;
  }
#endif

  cnt = p->ToPolygons(&lens, &ptss, user_scale_x, user_scale_y);

  if (!cnt)
    return;

  total_cnt = 0;
  for (i = 0; i < cnt; i++) {
    total_cnt += (lens[i] / 2) + 1;
  }
  
  xpts = new WXGC_ATOMIC XPoint[total_cnt];

  for (i = 0, k = 0; i < cnt; i++) {
    for (j = 0; j < lens[i]; j += 2) {
      ix = XLOG2DEV(ptss[i][j]+xoff);
      iy = YLOG2DEV(ptss[i][j+1]+yoff);
      xpts[k].x = ix;
      xpts[k].y = iy;
      k++;
    }
    ix = XLOG2DEV(ptss[i][0]+xoff);
    iy = YLOG2DEV(ptss[i][1]+yoff);
    xpts[k].x = ix;
    xpts[k].y = iy;
    k++;
  }

  if (current_brush && current_brush->GetStyle() != wxTRANSPARENT) {
    XSetFillRule(DPY, BRUSH_GC, fill_rule[fill]);
    if (cnt == 1) {
      XFillPolygon(DPY, DRAWABLE, BRUSH_GC, xpts, total_cnt, Complex, 0);
    } else {
      Region rgn = 0, rgn1;

      for (i = 0, k = 0; i < cnt; i++) {
       j = (lens[i] / 2) + 1;
       rgn1 = XPolygonRegion(xpts XFORM_OK_PLUS k, j, fill_rule[fill]);
       if (rgn) {
         /* Xoring implements the even-odd rule */
         XXorRegion(rgn, rgn1, rgn);
         XDestroyRegion(rgn1);
       } else {
         rgn = rgn1;
       }
       k += j;
      }

      if (CURRENT_REG)
       XIntersectRegion(rgn, CURRENT_REG, rgn);

      XSetRegion(DPY, BRUSH_GC, rgn);
      XFillRectangle(DPY, DRAWABLE, BRUSH_GC, 0, 0, 32000, 32000);

      if (CURRENT_REG)
       XSetRegion(DPY, BRUSH_GC, CURRENT_REG);
      else
       XSetClipMask(DPY, BRUSH_GC, None);

      XDestroyRegion(rgn);
    }      
  }
  if (current_pen && current_pen->GetStyle() != wxTRANSPARENT) {
    for (i = 0, k = 0; i < cnt; i++) {
      j = (lens[i] / 2) + 1;
      if ((i + 1 == cnt) && p->IsOpen())
       --j;
      XDrawLines(DPY, DRAWABLE, PEN_GC, xpts XFORM_OK_PLUS k, j, 0);
      k += j;
    }
  }
}

Here is the call graph for this function:

void wxDC::DrawPoint ( wxPoint pt) [inline, inherited]

Definition at line 93 of file DC.h.

{ DrawPoint(pt->x, pt->y); }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxWindowDC::DrawPoint ( double  x,
double  y 
) [virtual]

Implements wxDC.

Definition at line 1368 of file WindowDC.cc.

{
    if (!DRAWABLE) // ensure that a drawable has been associated
       return;

    FreeGetPixelCache();
    
    if (current_pen && current_pen->GetStyle() != wxTRANSPARENT)
       XDrawPoint(DPY, DRAWABLE, PEN_GC, XLOG2DEV(x), YLOG2DEV(y));
}

Here is the call graph for this function:

void wxDC::DrawPolygon ( wxList pts,
double  xoff = 0,
double  yoff = 0,
int  fill = wxODDEVEN_RULE 
) [virtual, inherited]

Definition at line 177 of file DC.cc.

{
  int n;
  wxPoint *points;

  n = list->Number();
  points = PointListToArray(list, n);

  DrawPolygon(n, points, xoffset, yoffset, fillStyle);
}

Here is the call graph for this function:

void wxWindowDC::DrawPolygon ( int  n,
wxPoint  pts[],
double  xoff = 0,
double  yoff = 0,
int  fill = wxODDEVEN_RULE 
) [virtual]

Implements wxDC.

Definition at line 1379 of file WindowDC.cc.

{
  XPoint *xpts;

  if (!DRAWABLE) // ensure that a drawable has been associated
    return;

  FreeGetPixelCache();

#ifdef WX_USE_CAIRO
  if (anti_alias) {
    InitCairoDev();

    if (SetCairoBrush()) {
      int i;     

      if (fill == wxODDEVEN_RULE)
       cairo_set_fill_rule(CAIRO_DEV, CAIRO_FILL_RULE_EVEN_ODD);
      
      cairo_new_path(CAIRO_DEV);
      cairo_move_to(CAIRO_DEV, SmoothingXFormX(pts[0].x + xoff), SmoothingXFormY(pts[0].y + yoff));
      for (i = 1; i < n; i++) {
       cairo_line_to(CAIRO_DEV, SmoothingXFormX(pts[i].x + xoff), SmoothingXFormY(pts[i].y + yoff));
      }
      cairo_fill(CAIRO_DEV); 

      if (fill == wxODDEVEN_RULE)
       cairo_set_fill_rule(CAIRO_DEV, CAIRO_FILL_RULE_WINDING);
    }

    if (SetCairoPen()) {
      int i;

      cairo_new_path(CAIRO_DEV);
      cairo_move_to(CAIRO_DEV, SmoothingXFormX(pts[0].x + xoff), SmoothingXFormY(pts[0].y + yoff));
      for (i = 1; i < n; i++) {
       cairo_line_to(CAIRO_DEV, SmoothingXFormX(pts[i].x + xoff), SmoothingXFormY(pts[i].y + yoff));
      }
      cairo_close_path(CAIRO_DEV);
      cairo_stroke(CAIRO_DEV);
    }

    return;
  }
#endif
  
  xpts = new WXGC_ATOMIC XPoint[n+1];
  for (int i=0; i<n; ++i) {
    short x, y;
    x = XLOG2DEV(pts[i].x + xoff);
    xpts[i].x = x;
    y = YLOG2DEV(pts[i].y + yoff);
    xpts[i].y = y;
  }
  xpts[n].x = xpts[0].x; // close figure
  xpts[n].y = xpts[0].y;
  if (current_brush && current_brush->GetStyle() != wxTRANSPARENT) {
    XSetFillRule(DPY, BRUSH_GC, fill_rule[fill]);
    XFillPolygon(DPY, DRAWABLE, BRUSH_GC, xpts, n, Complex, 0);
  }
  if (current_pen && current_pen->GetStyle() != wxTRANSPARENT)
    XDrawLines(DPY, DRAWABLE, PEN_GC, xpts, n+1, 0);
}

Here is the call graph for this function:

void wxWindowDC::DrawRectangle ( double  x,
double  y,
double  w,
double  h 
) [virtual]

Implements wxDC.

Definition at line 1444 of file WindowDC.cc.

{
    int x1, y1, w1, h1;
    double xw, yh;

    if (!DRAWABLE) // ensure that a drawable has been associated
       return;

    FreeGetPixelCache();
    
#ifdef WX_USE_CAIRO
    if (anti_alias) {
      double xx, yy, ww, hh;

      InitCairoDev();
      if (SetCairoBrush()) {
       xx = SmoothingXFormXB(x);
       yy = SmoothingXFormYB(y);
       ww = SmoothingXFormW(w, x);
       hh = SmoothingXFormH(h, y);

       cairo_new_path(CAIRO_DEV);
       cairo_move_to(CAIRO_DEV, xx, yy);
       cairo_line_to(CAIRO_DEV, xx+ww, yy);
       cairo_line_to(CAIRO_DEV, xx+ww, yy+hh);
       cairo_line_to(CAIRO_DEV, xx, yy+hh);
       cairo_fill(CAIRO_DEV);    
      }

      if (SetCairoPen()) {
       xx = SmoothingXFormX(x);
       yy = SmoothingXFormY(y);
       ww = SmoothingXFormWL(w, x);
       hh = SmoothingXFormHL(h, y);
      
       cairo_new_path(CAIRO_DEV);
       cairo_move_to(CAIRO_DEV, xx, yy);
       cairo_line_to(CAIRO_DEV, xx+ww, yy);
       cairo_line_to(CAIRO_DEV, xx+ww, yy+hh);
       cairo_line_to(CAIRO_DEV, xx, yy+hh);
       cairo_close_path(CAIRO_DEV);
       cairo_stroke(CAIRO_DEV);
      }

      return;
    }
#endif

    xw = x + w, yh = y + h;
   
    x1 = XLOG2DEV(x);
    y1 = YLOG2DEV(y);
    w1 = XLOG2DEV(xw) - x1;
    h1 = YLOG2DEV(yh) - y1;

    if (current_brush && current_brush->GetStyle() != wxTRANSPARENT)
      XFillRectangle(DPY, DRAWABLE, BRUSH_GC, x1, y1, w1, h1);
    if (current_pen && current_pen->GetStyle() != wxTRANSPARENT)
      XDrawRectangle(DPY, DRAWABLE, PEN_GC, x1, y1, w1 - WX_GC_CF, h1 - WX_GC_CF);
}

Here is the call graph for this function:

void wxWindowDC::DrawRoundedRectangle ( double  x,
double  y,
double  w,
double  h,
double  radius = 20 
) [virtual]

Implements wxDC.

Definition at line 1505 of file WindowDC.cc.

{
  int xx, yy, ww, hh, rr, dd;
  double xw, yh;

    if (!DRAWABLE) // ensure that a drawable has been associated
       return;

    FreeGetPixelCache();
    
    if (radius < 0.0)
      radius = - radius * ((w < h) ? w : h);

#ifdef WX_USE_CAIRO
    if (anti_alias) {
      double xx, yy, ww, hh, rr, rr2;

      InitCairoDev();
      if (SetCairoBrush()) {
       xx = SmoothingXFormXB(x);
       yy = SmoothingXFormYB(y);
       ww = SmoothingXFormW(w, x);
       hh = SmoothingXFormH(h, y);

       rr = SmoothingXFormW(radius, 0);
       rr2 = SmoothingXFormH(radius, 0);
       if (rr2 < rr)
         rr = rr2;

       cairo_move_to(CAIRO_DEV, xx, yy + rr);
       cairo_line_to(CAIRO_DEV, xx, yy + hh - rr);
       cairo_arc_negative(CAIRO_DEV, xx + rr, yy + hh - rr, rr, wxPI, 0.5 * wxPI);
       cairo_line_to(CAIRO_DEV, xx + ww - rr, yy + hh);
       cairo_arc_negative(CAIRO_DEV, xx + ww - rr, yy + hh - rr, rr, 0.5 * wxPI, 0);
       cairo_line_to(CAIRO_DEV, xx + ww, yy + rr);
       cairo_arc_negative(CAIRO_DEV, xx + ww - rr, yy + rr, rr, 2 * wxPI, 1.5 * wxPI);
       cairo_line_to(CAIRO_DEV, xx + rr, yy);
       cairo_arc_negative(CAIRO_DEV, xx + rr, yy + rr, rr, 1.5 * wxPI, wxPI);
       cairo_line_to(CAIRO_DEV, xx, yy + rr);
       cairo_fill(CAIRO_DEV);    
      }

      if (SetCairoPen()) {
       xx = SmoothingXFormX(x);
       yy = SmoothingXFormY(y);
       ww = SmoothingXFormWL(w, x);
       hh = SmoothingXFormHL(h, y);

       rr = SmoothingXFormWL(radius, 0);
       rr2 = SmoothingXFormHL(radius, 0);
       if (rr2 < rr)
         rr = rr2;

       cairo_move_to(CAIRO_DEV, xx, yy + rr);
       cairo_line_to(CAIRO_DEV, xx, yy + hh - rr);
       cairo_arc_negative(CAIRO_DEV, xx + rr, yy + hh - rr, rr, wxPI, 0.5 * wxPI);
       cairo_line_to(CAIRO_DEV, xx + ww - rr, yy + hh);
       cairo_arc_negative(CAIRO_DEV, xx + ww - rr, yy + hh - rr, rr, 0.5 * wxPI, 0);
       cairo_line_to(CAIRO_DEV, xx + ww, yy + rr);
       cairo_arc_negative(CAIRO_DEV, xx + ww - rr, yy + rr, rr, 2 * wxPI, 1.5 * wxPI);
       cairo_line_to(CAIRO_DEV, xx + rr, yy);
       cairo_arc_negative(CAIRO_DEV, xx + rr, yy + rr, rr, 1.5 * wxPI, wxPI);
       cairo_line_to(CAIRO_DEV, xx, yy + rr);
       cairo_close_path(CAIRO_DEV);
       cairo_stroke(CAIRO_DEV);
      }

      return;
    }
#endif

    xw = x + w, yh = y + h;
    
    xx = XLOG2DEV(x);       yy = YLOG2DEV(y);
    ww = XLOG2DEV(xw) - xx; hh = YLOG2DEV(yh) - yy;
    if (scale_x < scale_y)
      rr = XLOG2DEVREL(radius);
    else
      rr = YLOG2DEVREL(radius);
    dd = 2 * rr;

    if (current_brush && current_brush->GetStyle() != wxTRANSPARENT) {
       XFillRectangle(DPY, DRAWABLE, BRUSH_GC, xx+rr, yy, ww-dd, hh);
       XFillRectangle(DPY, DRAWABLE, BRUSH_GC, xx, yy+rr, ww, hh-dd);
       XFillArc(DPY, DRAWABLE, BRUSH_GC, xx, yy, dd - WX_GC_CF, dd - WX_GC_CF, 90*64, 90*64);
       XFillArc(DPY, DRAWABLE, BRUSH_GC, xx+ww-dd, yy, dd - WX_GC_CF, dd - WX_GC_CF, 0, 90*64);
       XFillArc(DPY, DRAWABLE, BRUSH_GC, xx+ww-dd, yy+hh-dd, dd - WX_GC_CF, dd - WX_GC_CF,
               270*64, 90*64);
       XFillArc(DPY, DRAWABLE, BRUSH_GC, xx, yy+hh-dd, dd - WX_GC_CF, dd - WX_GC_CF, 180*64, 90*64);
    }
    if (current_pen && current_pen->GetStyle() != wxTRANSPARENT){
        ww -= WX_GC_CF;
        hh -= WX_GC_CF;
       XDrawLine(DPY, DRAWABLE, PEN_GC, xx+rr, yy, xx+ww-rr, yy);
       XDrawLine(DPY, DRAWABLE, PEN_GC, xx+rr, yy+hh, xx+ww-rr, yy+hh);
       XDrawLine(DPY, DRAWABLE, PEN_GC, xx, yy+rr, xx, yy+hh-rr);
       XDrawLine(DPY, DRAWABLE, PEN_GC, xx+ww, yy+rr, xx+ww, yy+hh-rr);
       XDrawArc(DPY, DRAWABLE, PEN_GC, xx, yy, dd, dd, 90*64, 90*64);
       XDrawArc(DPY, DRAWABLE, PEN_GC, xx+ww-dd, yy, dd, dd, 0, 90*64);
       XDrawArc(DPY, DRAWABLE, PEN_GC, xx+ww-dd, yy+hh-dd, dd, dd,
               270*64, 90*64);
       XDrawArc(DPY, DRAWABLE, PEN_GC, xx, yy+hh-dd, dd, dd, 180*64, 90*64);
    }
}

Here is the call graph for this function:

void wxDC::DrawSpline ( int  n,
wxPoint  pts[] 
) [inherited]

Definition at line 197 of file DC.cc.

{
    wxList *list;
    list = new wxList;
    for (int i=0; i<n; ++i) {
      list->Append((wxObject*)&pts[i]);
    }
    DrawSpline(list);
    DELETE_OBJ list;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxDC::DrawSpline ( wxList pts) [inherited]

Definition at line 208 of file DC.cc.

{
    DrawOpenSpline(pts);
}

Here is the call graph for this function:

void wxDC::DrawSpline ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
) [virtual, inherited]

Definition at line 213 of file DC.cc.

{
    wxList *list;
    wxPoint *point1, *point2, *point3;

    list = new wxList;

    point1 = new wxPoint;
    point1->x = x1; point1->y = y1;
    list->Append((wxObject*)point1);

    point2 = new wxPoint;
    point2->x = x2; point2->y = y2;
    list->Append((wxObject*)point2);

    point3 = new wxPoint;
    point3->x = x3; point3->y = y3;
    list->Append((wxObject*)point3);

    DrawSpline(list);

    DELETE_OBJ list;
}

Here is the call graph for this function:

void wxWindowDC::DrawText ( char *  text,
double  x,
double  y,
Bool  combine = FALSE,
Bool  use16 = FALSE,
int  dt = 0,
double  angle = 0.0 
) [virtual]

Implements wxDC.

Definition at line 2233 of file WindowDC.cc.

{
  XFontStruct *fontinfo;
#ifdef WX_USE_XFT
  wxFontStruct *xfontinfo;
#endif
  double       cx, cy;
  int         ascent;
  int         dev_x;
  int         dev_y;
  long        textlen;
  double       e_scale_x, e_scale_y;
  double       ca, sa;
  unsigned int *text;
  

  if (!DRAWABLE) // ensure that a drawable has been associated
    return;

  if (!current_font) // a font must be associated for drawing
    return;

  /* e_scale_x and e_scale_y are the effective font scales
     considering that the font is rotated before scaled,
     and the horizontal and vertical scales can be different.
     The angle of the text is also affected if the scales
     are different; sa and ca are the effective sin and cos
     of the angle of the stretched/squashed baseline */
  if (angle == 0.0) {
    e_scale_x = scale_x;
    e_scale_y = scale_y;
    sa = 0.0;
    ca = 1.0;
  } else {
    ca = cos(angle);
    sa = sin(angle);
    if (scale_x == scale_y) {
      e_scale_x = scale_x;
      e_scale_y = scale_y;
    } else {
      double a2;
      e_scale_x = sqrt(((scale_x * ca) * (scale_x * ca)) + ((scale_y * sa) * (scale_y * sa)));
      e_scale_y = sqrt(((scale_y * ca) * (scale_y * ca)) + ((scale_x * sa) * (scale_x * sa)));
      a2 = atan2(sa * scale_y, ca * scale_x);
      ca = cos(a2);
      sa = sin(a2);
    }
  }
  
#ifdef WX_USE_XFT
  InitPicture();
  xfontinfo = (wxFontStruct*)current_font->GetInternalAAFont(scale_x, scale_y, angle);
  if (xfontinfo)
    fontinfo = NULL;
  else
#endif
    fontinfo = (XFontStruct *)current_font->GetInternalFont(e_scale_x, e_scale_y, 0.0);

  dev_x = XLOG2DEV(x);
  dev_y = YLOG2DEV(y);

  {
    double tw, th, td, ts;
    GetTextExtent(orig_text, &tw, &th, &td, &ts, current_font, combine, isUnicode, dt, -1);
    cx = (tw * e_scale_x);
    cy = (th * e_scale_y);
    ascent = (int)((th - td) * e_scale_y);
  }

  textlen = -1;
  text = convert_to_drawable_format(orig_text, dt, &textlen, cvt_buf, WX_CVT_BUF_SIZE, 
                                isUnicode, WX_XFT_ONLY(!xfontinfo));
  dt = 0;

# ifdef WX_USE_XFT
  if (xfontinfo) {
    if ((current_font->GetFamily() == wxSYMBOL)) {
      text = XlateSym(text, dt, textlen, cvt_buf, WX_CVT_BUF_SIZE);
      dt = 0;
    }
  }
#endif

#ifdef WX_USE_XFT
  if (xfontinfo) {
    int xasc;
    int v;
    XftColor col;
    /* Note: Xft wants colors with pre-multiplied alpha,
       according to my experiments. */
    col.pixel = current_text_fg->GetPixel();
    v = current_text_fg->Red();
    v = (int)(v * current_alpha);
    col.color.red = (v << 8) | v;
    v = current_text_fg->Green();
    v = (int)(v * current_alpha);
    col.color.green = (v << 8) | v;
    v = current_text_fg->Blue();
    v = (int)(v * current_alpha);
    col.color.blue = (v << 8) | v;
    col.color.alpha = (int)(current_alpha * 0xFFFF);

    if ((angle == 0.0) && (current_text_bgmode == wxSOLID)) {
      /* For B & W target, XftDrawRect doesn't seem to work right. */
      int rw;
      rw = (int)floor((x * scale_x) + device_origin_x + cx) - dev_x;
      if (Colour) {
       XftColor bg;
       bg.pixel = current_text_bg->GetPixel();
       v = current_text_bg->Red();
       v = (int)(v * current_alpha);
       bg.color.red = (v << 8) | v;
       v = current_text_bg->Green();
       v = (int)(v * current_alpha);
       bg.color.green = (v << 8) | v;
       v = current_text_bg->Blue();
       v = (int)(v * current_alpha);
       bg.color.blue = (v << 8) | v;
       bg.color.alpha = (int)(current_alpha * 0xFFFF);
       XftDrawRect(XFTDRAW, &bg, dev_x, dev_y, rw, xfontinfo->ascent + xfontinfo->descent);
      } else {
       unsigned long pixel;
       pixel = current_text_fg->GetPixel(current_cmap, IS_COLOR, 0);
       XSetForeground(DPY, TEXT_GC, pixel);
       XFillRectangle(DPY, DRAWABLE, TEXT_GC, dev_x, dev_y, rw, xfontinfo->ascent + xfontinfo->descent);
       pixel = current_text_fg->GetPixel(current_cmap, IS_COLOR, 1);
       XSetForeground(DPY, TEXT_GC, pixel);
      }
    }

    if (angle != 0.0) {
      xasc = (int)((double)ascent * sa);
      ascent = (int)((double)ascent * ca);
    } else
      xasc = 0;

    {
      wxFontStruct *this_time, *this_time_no_rotate, *no_rotate;
      int partlen, try_sub;

      try_sub = 1;

      while(textlen) {
       int nowlen;
       nowlen = textlen;
       if (nowlen > MAX_TEXT_LENGTH_FOR_MEASURE) {
         nowlen = MAX_TEXT_LENGTH_FOR_MEASURE;
       }

       if (angle != 0.0)
         no_rotate = (wxFontStruct*)current_font->GetInternalAAFont(e_scale_x, e_scale_y, 0.0);
       else
         no_rotate = xfontinfo;

       if (try_sub) {
         int index = 1, cval;
         partlen = 1;
         this_time = xfontinfo;
         this_time_no_rotate = no_rotate;
         while (1) {
           cval = text[dt];
           if (!XftGlyphExists(DPY, this_time, cval)) {
             this_time = (wxFontStruct*)current_font->GetNextAASubstitution(index, cval, scale_x, scale_y, angle);
             if (!this_time) {
              this_time = xfontinfo;
              this_time_no_rotate = no_rotate;
              break;
             }
             if (angle != 0.0)
              this_time_no_rotate = (wxFontStruct*)current_font->GetNextAASubstitution(index, cval, e_scale_x, e_scale_y, 0.0);
             else
              this_time_no_rotate = this_time;
              index++;
           } else
             break;
         }
         
         /* Get a longer range that won't need a substitution */
         if (this_time == xfontinfo) {
           while (partlen < nowlen) {
             cval = text[dt + partlen];
             if (((this_time != xfontinfo)
                 && XftGlyphExists(DPY, xfontinfo, cval))
                || !XftGlyphExists(DPY, this_time, cval))
              break;
             partlen++;
           }
         }
       } else {
         partlen = nowlen;
         this_time = xfontinfo;
         this_time_no_rotate = no_rotate;
       }

       XftDrawString32(XFTDRAW, &col, this_time, dev_x+xasc, dev_y+ascent, ((XftChar32 *)text) + dt, partlen);

       if (partlen < textlen) {
         XGlyphInfo overall;
         double w;
         XftTextExtents32(DPY, this_time_no_rotate, ((XftChar32 *)text) + dt, partlen, &overall);
         w = overall.xOff;
         if (angle != 0.0) {
           xasc += (int)((double)w * ca);
           ascent -= (int)((double)w * sa);
         } else
           xasc += (int)w;
       }

       textlen -= partlen;
       dt += partlen;
      }
    }
  } else
#endif
    {
      if ((angle == 0.0) && (current_text_bgmode == wxSOLID)) {
       if (need_x_set_font) {
         XSetFont(DPY, TEXT_GC, fontinfo->fid);
         need_x_set_font = 0;
       }
       XDrawImageString16(DPY, DRAWABLE, TEXT_GC, dev_x, dev_y+ascent, (XChar2b *)text + dt, textlen);
      } else {
       if (angle != 0.0) {
         double offset;
         double quadrant, pie = 3.14159;
         int the_x, the_y, i;
         XFontStruct *zfontinfo;
         XChar2b *text2b;
         
         zfontinfo = fontinfo;
         fontinfo = (XFontStruct *)current_font->GetInternalFont(scale_x, scale_y, angle);
         XSetFont(DPY, TEXT_GC, fontinfo->fid);

         quadrant = fmod(angle, 2 * pie);
         if (quadrant < 0)
           quadrant += (2 * pie);
         
         dev_y += (int)((double)ascent * ca);
         dev_x += (int)((double)ascent * sa);

         offset = 0.0;
         text2b = (XChar2b *)text;
         for (i = 0; i < textlen; i++) {
           int char_metric_offset;

           char_metric_offset = ((text2b[dt].byte1 - zfontinfo->min_byte1)
                              * (zfontinfo->max_char_or_byte2 - zfontinfo->min_char_or_byte2 + 1)
                              - zfontinfo->min_char_or_byte2
                              + text2b[dt].byte2);
           
           the_x = (int)((double)dev_x + offset * ca);
           the_y = (int)((double)dev_y - offset * sa);
           
           XDrawString16(DPY, DRAWABLE, TEXT_GC, the_x, the_y, text2b + dt, 1);
           dt++;
                  
           offset += (double)(zfontinfo->per_char ?
                            zfontinfo->per_char[char_metric_offset].width :
                            zfontinfo->min_bounds.width);
         }

         XSetFont(DPY, TEXT_GC, zfontinfo->fid);
       } else {
         if (need_x_set_font) {
           XSetFont(DPY, TEXT_GC, fontinfo->fid);
           need_x_set_font = 0;
         }
         XDrawString16(DPY, DRAWABLE, TEXT_GC, dev_x, dev_y+ascent, ((XChar2b *)text) + dt, textlen);
       }
      }
    }
}

Here is the call graph for this function:

virtual void wxDC::EndDoc ( void  ) [inline, virtual, inherited]

Definition at line 127 of file DC.h.

{}
void wxDC::EndDrawing ( void  ) [inline, inherited]

Definition at line 151 of file DC.h.

       {}

Definition at line 3275 of file WindowDC.cc.

{
}
virtual void wxDC::EndPage ( void  ) [inline, virtual, inherited]

Definition at line 129 of file DC.h.

{}

Definition at line 3080 of file WindowDC.cc.

{
  if (!X->get_pixel_image_cache)
    return;

  if (X->set_a_pixel) {
    int w, h, dx, dy;
    w = X->get_pixel_image_cache->width;
    h = X->get_pixel_image_cache->height;
    dx = X->cache_dx;
    dy = X->cache_dy;
    
    XPutImage(DPY, DRAWABLE, PEN_GC, X->get_pixel_image_cache, 0, 0, dx, dy, w, h);
  }

  if (X->get_pixel_image_cache) {
    XDestroyImage(X->get_pixel_image_cache);
    X->get_pixel_image_cache = NULL;
    X->get_pixel_color_cache = NULL;
  }
}

Here is the caller graph for this function:

Definition at line 3152 of file WindowDC.cc.

{
}

Definition at line 2033 of file WindowDC.cc.

{
  XColor xcol;
  int free = 0;
  XGCValues values;
  int mask = 0;
  GC agc;
  double w, h;
  Colormap cm;

  if (!DRAWABLE)
    return;

  xcol.red = c->Red() << SHIFT;
  xcol.green = c->Green() << SHIFT;
  xcol.blue = c->Blue() << SHIFT;

  cm = GETCOLORMAP(current_cmap);

  if (XAllocColor(wxAPP_DISPLAY, cm, &xcol) == 1) {
    wxQueryColor(wxAPP_DISPLAY, cm, &xcol);
    c->Set(xcol.red >> SHIFT, xcol.green >> SHIFT, xcol.blue >> SHIFT);
    free = 1;
  } else {
    xcol.pixel = wx_black_pixel;
    c->Set(0, 0, 0);
  }

  values.foreground = xcol.pixel;
  values.fill_style = FillSolid;
  mask |= GCForeground | GCFillStyle;

  agc = XCreateGC(DPY, DRAWABLE, mask, &values);
  
  GetSize(&w, &h);

  XFillRectangle(DPY, DRAWABLE, agc, 0, 0, (int)w, (int)h);

  XFreeGC(DPY, agc);

  if (free)
    XFreeColors(wxAPP_DISPLAY, cm, &xcol.pixel, 1, 0);
}

Here is the call graph for this function:

virtual double wxDC::FLogicalToDeviceX ( double  x) [inline, virtual, inherited]

Definition at line 189 of file DC.h.

       { return XLOG2DEV(x); }

Here is the call graph for this function:

virtual double wxDC::FLogicalToDeviceXRel ( double  x) [inline, virtual, inherited]

Definition at line 191 of file DC.h.

       { return XLOG2DEVREL(x); }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual double wxDC::FLogicalToDeviceY ( double  y) [inline, virtual, inherited]

Definition at line 195 of file DC.h.

       { return YLOG2DEV(y); }

Here is the call graph for this function:

virtual double wxDC::FLogicalToDeviceYRel ( double  y) [inline, virtual, inherited]

Definition at line 197 of file DC.h.

       { return YLOG2DEVREL(y); }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual double wxDC::FLogicalToUnscrolledDeviceX ( double  x) [inline, virtual, inherited]

Definition at line 193 of file DC.h.

       { return XLOG2DEV(x); }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual double wxDC::FLogicalToUnscrolledDeviceY ( double  y) [inline, virtual, inherited]

Definition at line 199 of file DC.h.

       { return YLOG2DEV(y); }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxWindowDC::FreeGetPixelCache ( void  ) [protected, virtual]

Definition at line 3243 of file WindowDC.cc.

{
  if (X->get_pixel_image_cache) 
    EndSetPixel();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bool wxWindowDC::GCBlit ( double  xdest,
double  ydest,
double  w,
double  h,
wxBitmap bm,
double  xsrc,
double  ysrc,
wxBitmap mask = NULL 
)

Definition at line 918 of file WindowDC.cc.

{
  /* A non-allocating (of collectable memory) blit, but may allocate
     when bmask is non-NULL.  Note that there's no rop or color. We do
     the simplest thing (wxSOLID with black) always. */
  Bool retval = FALSE;
  int scaled_width;
  int scaled_height;
  GC agc;

    if (!DRAWABLE) // ensure that a drawable has been associated
      return FALSE;
    
    if (!src->Ok())
      return FALSE;

    FreeGetPixelCache();

    if (src->selectedTo)
      src->selectedTo->EndSetPixel();
    
    xsrc = floor(xsrc);
    ysrc = floor(ysrc);

    scaled_width = src->GetWidth()  < XLOG2DEVREL(w) ? src->GetWidth()  : XLOG2DEVREL(w);
    scaled_height = src->GetHeight() < YLOG2DEVREL(h) ? src->GetHeight() : YLOG2DEVREL(h);

    if (DRAWABLE && src->Ok()) {
      XGCValues values;
      int mask = 0;
      Region free_rgn = (Region)NULL;
      int tx, ty;
      wxBitmap *tmp_mask;

      tx = XLOG2DEV(xdest);
      ty = YLOG2DEV(ydest);

      if ((DEPTH == 1) && (src->GetDepth() > 1)) {
       /* May need to flip 1 & 0... */
       if (wx_black_pixel == 1) {
         mask = GCFunction;
         values.function = GXcopyInverted;
       }
      }

      agc = XCreateGC(DPY, DRAWABLE, mask, &values);
      tmp_mask = IntersectBitmapRegion(agc, EXPOSE_REG, USER_REG, bmask, 
                                   &free_rgn,
                                   &tx, &ty,
                                   &scaled_width, &scaled_height,
                                   &xsrc, &ysrc,
                                   DPY, wx_white_pixel);
         
      retval = TRUE;
      if ((src->GetDepth() == 1) || (DEPTH == 1)) {
       /* mono to color/mono  or  color/mono to mono */
       Pixmap pm;
       pm = GETPIXMAP(src);
       XCopyPlane(DPY, pm, DRAWABLE, agc,
                 (long)xsrc, (long)ysrc,
                 scaled_width, scaled_height,
                 tx, ty, 1);
      } else if (src->GetDepth() == (int)DEPTH) {
       /* color to color */
       Pixmap pm;
       pm = GETPIXMAP(src);
       XCopyArea(DPY, pm, DRAWABLE, agc,
                (long)xsrc, (long)ysrc,
                scaled_width, scaled_height,
                tx, ty);
      } else
       retval = FALSE;

      XFreeGC(DPY, agc);

      if (free_rgn)
       XDestroyRegion(free_rgn);

      if (tmp_mask)
       DELETE_OBJ tmp_mask;
    }

    return retval; // !retval => something is wrong with the drawables
}

Here is the call graph for this function:

Here is the caller graph for this function:

double wxDC::GetAlpha ( ) [inherited]

Definition at line 256 of file DC.cc.

{
  return current_alpha;
}
int wxDC::GetAntiAlias ( ) [inherited]

Definition at line 240 of file DC.cc.

{
  return anti_alias;
}
wxColour * wxDC::GetBackground ( void  ) [inherited]

Definition at line 74 of file DC.cc.

                                 {
  wxColour *c;
  c = new wxColour();
  c->CopyFrom(current_background_color);
  return c;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int wxDC::GetBackgroundMode ( ) [inline, inherited]

Definition at line 205 of file DC.h.

       { return current_text_bgmode; }
wxBrush* wxDC::GetBrush ( void  ) [inline, inherited]

Definition at line 154 of file DC.h.

       { return current_brush; }
double wxWindowDC::GetCharHeight ( void  ) [virtual]

Implements wxDC.

Definition at line 2508 of file WindowDC.cc.

{
  double w, h, descent, topspace;

  if (!current_font) // no font
    return YDEV2LOGREL(12);

  GetTextExtent("x", &w, &h, &descent, &topspace, current_font, 0, 0, 0);

  return h;
}

Here is the call graph for this function:

double wxWindowDC::GetCharWidth ( void  ) [virtual]

Implements wxDC.

Definition at line 2520 of file WindowDC.cc.

{
  double w, h, descent, topspace;

  if (!current_font) // no font
    return YDEV2LOGREL(12);

  GetTextExtent("x", &w, &h, &descent, &topspace, current_font, 0, 0, 0);

  return w;
}

Here is the call graph for this function:

Implements wxDC.

Definition at line 2786 of file WindowDC.cc.

{
  return clipping;
}
void wxDC::GetDeviceOrigin ( double *  x,
double *  y 
) [inline, inherited]

Definition at line 219 of file DC.h.

Here is the caller graph for this function:

wxFont* wxDC::GetFont ( void  ) [inline, inherited]

Definition at line 156 of file DC.h.

       { return current_font; }
int wxDC::GetMapMode ( void  ) [inline, inherited]

Definition at line 158 of file DC.h.

       { return current_map_mode; }
Bool wxDC::GetOptimization ( void  ) [inline, inherited]

Definition at line 160 of file DC.h.

       { return optimize; }
wxPen* wxDC::GetPen ( void  ) [inline, inherited]

Definition at line 162 of file DC.h.

       { return current_pen; }
Bool wxDC::GetPixel ( double   WXUNUSEDx,
double   WXUNUSEDy,
wxColour WXUNUSEDcol 
) [inline, inherited]

Definition at line 164 of file DC.h.

       { return FALSE; }
Bool wxWindowDC::GetPixel ( double  x,
double  y,
wxColour col 
)

Definition at line 2938 of file WindowDC.cc.

{
  int i, j;
  Bool mini = 1;
  unsigned int w, h;

  if (!DRAWABLE)
    return FALSE;

  i = XLOG2DEV(x);
  j = YLOG2DEV(y);

  w = X->width;
  h = X->height;

  if (i < 0 || (unsigned int)i >= w
      || j < 0 || (unsigned int)j >= h)
    return FALSE;

#define NUM_GETPIX_CACHE_COLORS 256

  if (X->get_pixel_image_cache
      && ((i < X->cache_dx)
         || (i >= X->cache_dx + X->get_pixel_image_cache->width)
         || (j < X->cache_dy)
         || (j >= X->cache_dy + X->get_pixel_image_cache->height))) {
    /* Turns out that getting a small part wasn't such a
       good idea. Go into whole-image mode. */
    EndSetPixel();
    mini = 0;
  }

  if (!X->get_pixel_image_cache) {
    BeginSetPixel(mini, i, j);

    if (X->get_pixel_image_cache->depth == 1) {
      XColor *get_pixel_color_cache;
      
      get_pixel_color_cache = X->get_pixel_color_cache;
      
      get_pixel_color_cache[0].pixel = 1;
      get_pixel_color_cache[0].red = 0;
      get_pixel_color_cache[0].green = 0;
      get_pixel_color_cache[0].blue = 0;

      get_pixel_color_cache[1].pixel = 0;
      get_pixel_color_cache[1].red = 255;
      get_pixel_color_cache[1].green = 255;
      get_pixel_color_cache[1].blue = 255;
      
      X->get_pixel_cache_pos = 2;
    }
  }

  {
    int r, g, b;
    GetPixelFast(i, j, &r, &g, &b);
    col->Set(r, g, b);
  }

  return TRUE;
}

Here is the call graph for this function:

void wxWindowDC::GetPixelFast ( int  x,
int  y,
int r,
int g,
int b 
)

Definition at line 3279 of file WindowDC.cc.

{
  unsigned long pixel;

  pixel = XGetPixel(X->get_pixel_image_cache, i, j);

  if ((wx_alloc_color_is_fast == 2) 
      && (X->get_pixel_image_cache->depth != 1)) {
    *r = ((pixel >> wx_simple_r_start) & 0xFF);
    *g = ((pixel >> wx_simple_g_start) & 0xFF);
    *b = ((pixel >> wx_simple_b_start) & 0xFF);
  } else {
    XColor xcol;

    if (!wx_alloc_color_is_fast
       || (X->get_pixel_image_cache->depth == 1)) {
      int get_pixel_cache_pos, k;
      XColor *get_pixel_color_cache;
      Bool get_pixel_cache_full;

      get_pixel_cache_pos = X->get_pixel_cache_pos;
      get_pixel_color_cache = X->get_pixel_color_cache;
      get_pixel_cache_full = X->get_pixel_cache_full;

      for (k = get_pixel_cache_pos; k--; ) {
       if (get_pixel_color_cache[k].pixel == pixel) {
         *r = get_pixel_color_cache[k].red;
         *g = get_pixel_color_cache[k].green;
         *b = get_pixel_color_cache[k].blue;
         return;
       }
      }

      if (get_pixel_cache_full) {
       for (k = NUM_GETPIX_CACHE_COLORS; k-- > get_pixel_cache_pos; ) {
         if (get_pixel_color_cache[k].pixel == pixel) {
           *r = get_pixel_color_cache[k].red;
           *g = get_pixel_color_cache[k].green;
           *b = get_pixel_color_cache[k].blue;
           return;
         }
       }
      }
    }
  
    xcol.pixel = pixel;
    {
      Colormap cm;
      cm = GETCOLORMAP(current_cmap);
      wxQueryColor(wxAPP_DISPLAY, cm, &xcol);
    }

    if (!wx_alloc_color_is_fast) {
      int get_pixel_cache_pos;
      XColor *get_pixel_color_cache;
    
      get_pixel_cache_pos = X->get_pixel_cache_pos;
      get_pixel_color_cache = X->get_pixel_color_cache;

      get_pixel_color_cache[get_pixel_cache_pos].pixel = pixel;
      get_pixel_color_cache[get_pixel_cache_pos].red = xcol.red >> SHIFT;
      get_pixel_color_cache[get_pixel_cache_pos].green = xcol.green >> SHIFT;
      get_pixel_color_cache[get_pixel_cache_pos].blue = xcol.blue >> SHIFT;
    
      if (++get_pixel_cache_pos >= NUM_GETPIX_CACHE_COLORS) {
       get_pixel_cache_pos = 0;
       X->get_pixel_cache_full = TRUE;
      }

      X->get_pixel_cache_pos = get_pixel_cache_pos;
    }

    *r = (xcol.red >> SHIFT);
    *g = (xcol.green >> SHIFT);
    *b = (xcol.blue >> SHIFT);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxWindowDC::GetSize ( double *  w,
double *  h 
) [virtual]

Reimplemented from wxDC.

Definition at line 2791 of file WindowDC.cc.

{
  Window wdummy; int sdummy; unsigned int udummy, width, height;

  if (DRAWABLE) {
    XGetGeometry(DPY, DRAWABLE, &wdummy, &sdummy, &sdummy,
               &width, &height, &udummy, &DEPTH);
    
    *w = width;
    *h = height;
  } else {
    *w = *h = 0;
  }
}

Here is the caller graph for this function:

void wxDC::GetSizeMM ( double *  w,
double *  h 
) [inline, inherited]

Definition at line 169 of file DC.h.

       { GetSize(w, h); *w/=(scale_x*mm_to_pix_x); *h/=(scale_y*mm_to_pix_y); }

Here is the call graph for this function:

int wxDC::GetTextAlignment ( void  ) [inline, inherited]

Definition at line 171 of file DC.h.

wxColour* wxDC::GetTextBackground ( void  ) [inline, inherited]

Definition at line 173 of file DC.h.

       { return current_text_bg; }

Here is the caller graph for this function:

void wxWindowDC::GetTextExtent ( const char *  s,
double *  w,
double *  h,
double *  descent = 0,
double *  ext_leading = 0,
wxFont font = NULL,
Bool  combine = FALSE,
Bool  use16bit = FALSE,
int  dt = 0,
int  len = -1 
) [virtual]

Implements wxDC.

Definition at line 2648 of file WindowDC.cc.

{
  wxFont *font_to_use;
  double v;

  if (!DRAWABLE) // ensure that a drawable has been associated
    return;

  font_to_use = _font ? _font : current_font;
  if (!font_to_use) {
    wxError("set a font before calling GetTextExtent", "wxWindowDC");
    if (_w)
      *_w = -1.0;
    if (_h)
      *_h = -1.0;
    return;
  }

  wxGetTextExtent(DPY, scale_x, scale_y,
                orig_s, _w, _h, _descent, _topspace, 
                font_to_use, combine, isUnicode, dt, len);

  if (_w) {
    v = XDEV2LOGREL((int)*_w);
    *_w = v;
  }
  if (_h) {
    v = YDEV2LOGREL((int)*_h);
    *_h = v;
  }
  if (_descent) {
    v = YDEV2LOGREL((int)*_descent);
    *_descent = v;
  }
  if (_topspace) {
    v = YDEV2LOGREL((int)*_topspace);
    *_topspace = v;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

wxColour* wxDC::GetTextForeground ( void  ) [inline, inherited]

Definition at line 175 of file DC.h.

       { return current_text_fg; }

Here is the caller graph for this function:

void wxDC::GetUserScale ( double *  xs,
double *  ys 
) [inline, inherited]

Definition at line 217 of file DC.h.

      { *xs = user_scale_x; *ys = user_scale_y; }

Here is the caller graph for this function:

Bool wxWindowDC::GlyphAvailable ( int  c,
wxFont f = NULL 
) [virtual]

Implements wxDC.

Definition at line 2690 of file WindowDC.cc.

{
  if (!font)
    font = current_font;

  return font->ScreenGlyphAvailable(c);
}

Here is the call graph for this function:

void wxWindowDC::Initialize ( wxWindowDC_Xinit *  init) [protected]

Definition at line 2810 of file WindowDC.cc.

{
    Drawable GC_drawable; // necessary create a GC (needed for depth,...)
    wxFont *font;
    XGCValues values;
    unsigned long mask;
    int width, height;

    DPY = init->dpy; SCN = init->scn;

    if (init->drawable) {
      Window wdummy; int sdummy; unsigned int udummy;
      // I have a specified drawable -> get width, height, and depth
      GC_drawable = DRAWABLE = init->drawable;
      XGetGeometry(DPY, DRAWABLE, &wdummy, &sdummy, &sdummy,
                 &WIDTH, &HEIGHT, &udummy, &DEPTH);
    } else {
      GC_drawable = wxAPP_ROOT; // defaults to root
      DEPTH = wxDisplayDepth(); // depth is display depth
    }
    Colour = (DEPTH != 1); // accept everything else than depth one as colour display
    if (!Colour && anti_alias)
      anti_alias = 0;

#ifdef WX_USE_XRENDER
    X->picture = 0;
#endif

    values.foreground = wx_black_pixel;
    values.background = wx_white_pixel;
    values.graphics_exposures = FALSE;
    values.line_width = 1;
    mask = GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth;
    PEN_GC   = XCreateGC(DPY, GC_drawable, mask, &values);
    TEXT_GC  = XCreateGC(DPY, GC_drawable, mask, &values);
    values.foreground = wx_white_pixel;
    values.background = wx_black_pixel;
    BG_GC    = XCreateGC(DPY, GC_drawable, mask, &values);
    BRUSH_GC = XCreateGC(DPY, GC_drawable, mask, &values);

    // set drawing tools
    SetTextForeground(current_text_fg);
    SetTextBackground(current_text_bg);
    SetBackground(current_background_color); 
    ResetBrush(current_brush);
    ResetPen(current_pen);

    font = current_font;
    current_font = NULL;
    SetFont(font ? font : wxNORMAL_FONT);

    // set display scaling
    width  = WidthOfScreen(SCN);
    height = HeightOfScreen(SCN);
    mm_to_pix_x = ((double)width)  / ((double)WidthMMOfScreen(SCN));
    mm_to_pix_y = ((double)height) / ((double)HeightMMOfScreen(SCN));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 99 of file wxGC.cxx.

{
  GC_finalization_proc old_fn;
  void *old_data;

# ifdef MZ_PRECISE_GC
#  define ALLOW_NON_BASE 0
#  define CHECK_BASE 0
# else
#  ifdef wx_xt
#   define ALLOW_NON_BASE 0
#   define CHECK_BASE 0
#  else
#   ifdef WIN32
#    define ALLOW_NON_BASE 0
#    define CHECK_BASE 1
#    define CRASH_ON_NONBASE 1
#   else
#    define ALLOW_NON_BASE 1
#    define CHECK_BASE 0
#   endif
#  endif
# endif

# if CHECK_BASE || ALLOW_NON_BASE
  if (GC_base(this) != (void *)this) {
#  if ALLOW_NON_BASE
    return;
#  else
#   ifdef CRASH_ON_NONBASE
    *(long *)0x0 = 1;
#   else
    printf("Clean-up object is not the base object\n");
    abort();
#   endif
#  endif
  }
# endif

  GC_register_finalizer_ignore_self(gcOBJ_TO_PTR(this), 
                                CAST_GCP GC_cleanup, NULL, 
                                CAST_GCPP &old_fn, &old_data);

# if CHECK_BASE
  if (old_fn) {
#  ifdef CRASH_ON_NONBASE
       *(long *)0x0 = 1;
#  else
    printf("Object already has a clean-up\n");
    abort();
#  endif
  }
# endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int wxDC::LogicalToDeviceX ( double  x) [inline, virtual, inherited]

Definition at line 177 of file DC.h.

       { return XLOG2DEV(x); }

Here is the call graph for this function:

virtual int wxDC::LogicalToDeviceXRel ( double  x) [inline, virtual, inherited]

Definition at line 179 of file DC.h.

       { return XLOG2DEVREL(x); }

Here is the call graph for this function:

virtual int wxDC::LogicalToDeviceY ( double  y) [inline, virtual, inherited]

Definition at line 183 of file DC.h.

       { return YLOG2DEV(y); }

Here is the call graph for this function:

virtual int wxDC::LogicalToDeviceYRel ( double  y) [inline, virtual, inherited]

Definition at line 185 of file DC.h.

       { return YLOG2DEVREL(y); }

Here is the call graph for this function:

virtual int wxDC::LogicalToUnscrolledDeviceX ( double  x) [inline, virtual, inherited]

Definition at line 181 of file DC.h.

       { return XLOG2DEV(x); }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int wxDC::LogicalToUnscrolledDeviceY ( double  y) [inline, virtual, inherited]

Definition at line 187 of file DC.h.

       { return YLOG2DEV(y); }

Here is the call graph for this function:

Here is the caller graph for this function:

Bool wxWindowDC::Ok ( void  ) [virtual]

Reimplemented from wxDC.

Definition at line 2932 of file WindowDC.cc.

{
  return !!DRAWABLE;
}
void gc::operator delete ( void obj) [inline, inherited]
void gc::operator delete ( void obj) [inline, inherited]

Definition at line 287 of file gc_cpp.h.

                                           {
    GC_FREE( obj );}

Here is the caller graph for this function:

void gc::operator delete ( void ,
void  
) [inline, inherited]

Definition at line 291 of file gc_cpp.h.

{}
void gc::operator delete[] ( void obj) [inline, inherited]

Definition at line 305 of file gc_cpp.h.

                                             {
    gc::operator delete( obj );}

Here is the call graph for this function:

void gc::operator delete[] ( void ,
void  
) [inline, inherited]

Definition at line 309 of file gc_cpp.h.

{}
void* gc::operator new ( size_t  size) [inline, inherited]
void* gc::operator new ( size_t  size,
GCPlacement  gcp 
) [inline, inherited]
void * gc::operator new ( size_t  size) [inline, inherited]

Definition at line 273 of file gc_cpp.h.

                                           {
    return GC_MALLOC( size );}

Here is the caller graph for this function:

void * gc::operator new ( size_t  size,
GCPlacement  gcp 
) [inline, inherited]

Definition at line 276 of file gc_cpp.h.

                                                            {
    if (gcp == UseGC) 
        return GC_MALLOC( size );
    else if (gcp == PointerFreeGC)
       return GC_MALLOC_ATOMIC( size );
    else
        return GC_MALLOC_UNCOLLECTABLE( size );}
void * gc::operator new ( size_t  size,
void p 
) [inline, inherited]

Definition at line 284 of file gc_cpp.h.

                                                    {
    return p;}
void * gc::operator new[] ( size_t  size) [inline, inherited]

Definition at line 296 of file gc_cpp.h.

                                             {
    return gc::operator new( size );}

Here is the call graph for this function:

void * gc::operator new[] ( size_t  size,
GCPlacement  gcp 
) [inline, inherited]

Definition at line 299 of file gc_cpp.h.

                                                              {
    return gc::operator new( size, gcp );}

Here is the call graph for this function:

void * gc::operator new[] ( size_t  size,
void p 
) [inline, inherited]

Definition at line 302 of file gc_cpp.h.

                                                      {
    return p;}

Definition at line 1775 of file WindowDC.cc.

{
  XGCValues     values;
  unsigned long mask;
  wxBitmap *bm;
  unsigned long pixel;
  int bstyle;

  if (!DRAWABLE)
    return;

  if (current_brush) current_brush->Lock(-1);

  if (!(current_brush = brush)) // nothing to do without brush
    return;

  if (current_brush) current_brush->Lock(1);

  // for XChangeGC
  mask = GCFillStyle | GCForeground | GCFunction;

  values.fill_style = FillSolid;
  bstyle = brush->GetStyle();
  if (bstyle == wxCOLOR) {
    pixel = wxCTL_HIGHLIGHT_PIXEL;
  } else {
    wxColour *bcol;
    bcol = brush->GetColour();
    pixel = bcol->GetPixel(current_cmap, IS_COLOR, 1);
  }
  if (bstyle == wxXOR) {
    XGCValues values_req;
    XGetGCValues(DPY, BRUSH_GC, GCBackground, &values_req);
    values.foreground = pixel ^ values_req.background;
    values.function = GXxor;
  } else if (bstyle == wxCOLOR) {
    values.foreground = pixel;
    values.function = GXorReverse;
  } else {
    values.foreground = pixel;
    values.function = GXcopy;
  }

  bm = brush->GetStipple();
  if (bm && !bm->Ok())
    bm = NULL;

  if (bm) {
    Pixmap stipple = (Pixmap)0; // for FillStippled
    Pixmap tile    = (Pixmap)0; // for FillTiled
    if (bm->GetDepth() == 1) {
      if (bm->selectedTo) bm->selectedTo->EndSetPixel();
      stipple = GETPIXMAP(bm);
      values.fill_style = ((brush->GetStyle()==wxSTIPPLE) ? FillOpaqueStippled : FillStippled);
    } else if (bm->GetDepth() == (signed)DEPTH) {
      if (bm->selectedTo) bm->selectedTo->EndSetPixel();
      tile = GETPIXMAP(bm);
      values.fill_style = FillTiled;
    } // else wrong depth
    if (stipple) {
      values.stipple = stipple;
      mask |= GCStipple;
    }
    if (tile) {
      values.tile = tile;
      mask |= GCTile;
      values.foreground = wx_black_pixel;
      values.function = GXcopy;
    }
  } else {
    int style;
    style = brush->GetStyle();
    if (wxIS_HATCH(style)) {
      Pixmap stipple = (Pixmap)0; // for FillStippled
      stipple = hatch_bitmaps[style-wxFIRST_HATCH];
      values.fill_style = FillStippled;
      if (stipple) {
       values.stipple = stipple;
       mask |= GCStipple;
      }
    }
  }
  XChangeGC(DPY, BRUSH_GC, mask, &values);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1889 of file WindowDC.cc.

{
  XGCValues     values;
  unsigned long mask;
  wxBitmap *bm;
  int scale;
  int style, doXor, js, cs, pw;
  unsigned long pixel;

    if (!DRAWABLE) /* MATTHEW: [5] */
      return;

    if (current_pen) current_pen->Lock(-1);
    
    if (!(current_pen = pen)) // nothing to do without pen
      return;

    if (current_pen) current_pen->Lock(1);

    // for XChangeGC
    mask = (GCCapStyle  | GCFillStyle | GCForeground
           | GCJoinStyle | GCLineStyle | GCLineWidth
           | GCFunction);

    cs = pen->GetCap();
    values.cap_style  = cap_style[cs];
    values.fill_style = FillSolid;
    js = pen->GetJoin();
    values.join_style = join_style[js];
    values.line_style = LineSolid;
    pw = pen->GetWidth();
    scale = XLOG2DEVREL(pw);
    values.line_width = scale;
    style = pen->GetStyle();
    if (style == wxCOLOR) {
      pixel = wxCTL_HIGHLIGHT_PIXEL;
    } else {
      wxColour *pcol;
      pcol = pen->GetColour();
      pixel = pcol->GetPixel(current_cmap, IS_COLOR, 1);
    }
    doXor = 0;

    switch (style) {
    case wxXOR:
      doXor = 1;
      break;
    case wxXOR_DOT:
    case wxXOR_SHORT_DASH:
    case wxXOR_LONG_DASH:
    case wxXOR_DOT_DASH:
      doXor = 1;
      style -= (wxXOR_DOT - wxDOT);
      break;
    }

    if (doXor) {
      XGCValues values_req;
      XGetGCValues(DPY, PEN_GC, GCBackground, &values_req);
      values.foreground = pixel ^ values_req.background;
      values.function = GXxor;
    } else if (style == wxCOLOR) {
      values.foreground = pixel;
      values.function = GXorReverse;
    } else {
      values.foreground = pixel;
      values.function = GXcopy;
    }

    bm = pen->GetStipple();
    if (bm && !bm->Ok())
      bm = NULL;

    if (bm) {
      Pixmap stipple = (Pixmap)0; // for FillStippled
      Pixmap tile    = (Pixmap)0; // for FillTiled
      if (bm->GetDepth() == 1) {
       if (bm->selectedTo) bm->selectedTo->EndSetPixel();
       stipple = GETPIXMAP(bm);
       values.fill_style = FillStippled;
      } else if (bm->GetDepth() == (signed)DEPTH) {
       if (bm->selectedTo) bm->selectedTo->EndSetPixel();
       tile = GETPIXMAP(bm);
       values.fill_style = FillTiled;
      } // else wrong depth
      if (stipple) {
       values.stipple = stipple;
       mask |= GCStipple;
      }
      if (tile) {
       values.tile = tile;
       mask |= GCTile;
       values.foreground = wx_black_pixel;
       values.function = GXcopy;
      }
    } else {
      if (wxIS_DASH(style) || style==wxUSER_DASH) {
       int           num_dash;
       wxDash        *dashdef, *scaleddef;
       if (style==wxUSER_DASH) {
         num_dash = pen->GetDashes(&dashdef);
       } else {
         num_dash = num_dashes[style-wxFIRST_DASH];
         dashdef  = dashdefs[style-wxFIRST_DASH];
       }
       if ((scaleddef = new WXGC_ATOMIC wxDash[num_dash])) {
         int dscale = scale, i;
         if (!dscale) dscale = 1;
         for (i = 0; i < num_dash; i++) {
           scaleddef[i] = dscale * dashdef[i];
         }
         XSetDashes(DPY, PEN_GC, 0, (char*)scaleddef, num_dash);
       } else { // not enough memory to scale
         XSetDashes(DPY, PEN_GC, 0, (char*)dashdef, num_dash);
       }
       values.line_style = LineOnOffDash;
      }
    }
    XChangeGC(DPY, PEN_GC, mask, &values);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxDC::SetAlpha ( double  d) [virtual, inherited]

Definition at line 251 of file DC.cc.

void wxWindowDC::SetAntiAlias ( int  v) [virtual]

Reimplemented from wxDC.

Definition at line 3929 of file WindowDC.cc.

{
#ifdef WX_USE_CAIRO
  if (v != anti_alias) {
    /* In case we go from aligned to not: */
    X->reset_cairo_clip = 1;
  }
    
  wxDC::SetAntiAlias(v);
#endif
}

Implements wxDC.

Definition at line 1736 of file WindowDC.cc.

{
  int style;
  unsigned long pixel;

  if (!DRAWABLE)
    return;
  
  if (c != current_background_color)
    current_background_color->CopyFrom(c);
  
  pixel = current_background_color->GetPixel(current_cmap, IS_COLOR, 0);
  
  if (DRAW_WINDOW)
    XSetWindowBackground(DPY, DRAW_WINDOW, pixel);
  XSetForeground(DPY, BG_GC, pixel);
  XSetBackground(DPY, PEN_GC, pixel);
  XSetBackground(DPY, BRUSH_GC, pixel);
  
  // use the correct pixel values for XOR
  
  style = current_pen->GetStyle();
  if ((style >= wxXOR_DOT) && (style <= wxXOR_DOT_DASH))
    style = wxXOR;
  if (current_pen && ((style == wxXOR) || (style == wxCOLOR)))
    ResetPen(current_pen);
  
  if (current_brush && (current_brush->GetStyle() == wxXOR))
    ResetBrush(current_brush);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxDC::SetBackgroundMode ( int  mode) [inline, inherited]

Definition at line 203 of file DC.h.

       { current_text_bgmode = mode; }
void wxWindowDC::SetBrush ( wxBrush brush) [virtual]

Implements wxDC.

Definition at line 1767 of file WindowDC.cc.

{
  if (brush == current_brush)
    return;

  ResetBrush(brush);
}

Here is the call graph for this function:

Definition at line 2895 of file WindowDC.cc.

{
    if (!DRAWABLE)
       return;

#ifdef WX_USE_CAIRO
    X->reset_cairo_clip = 1;
#endif

    if (CURRENT_REG)
       XDestroyRegion(CURRENT_REG);
    if (USER_REG || EXPOSE_REG) {
       CURRENT_REG = XCreateRegion();
       XIntersectRegion(EXPOSE_REG ? EXPOSE_REG : USER_REG,
                      USER_REG ? USER_REG : EXPOSE_REG,
                      CURRENT_REG);
       XSetRegion(DPY, PEN_GC, CURRENT_REG);
       XSetRegion(DPY, BRUSH_GC, CURRENT_REG);
       XSetRegion(DPY, BG_GC, CURRENT_REG);
       XSetRegion(DPY, TEXT_GC, CURRENT_REG);
#ifdef WX_USE_XFT
       if (XFTDRAW)
         XftDrawSetClip(XFTDRAW, CURRENT_REG);
#endif
    } else {
       CURRENT_REG = NULL;
       XSetClipMask(DPY, PEN_GC, None);
       XSetClipMask(DPY, BRUSH_GC, None);
       XSetClipMask(DPY, BG_GC, None);
       XSetClipMask(DPY, TEXT_GC, None);
#ifdef WX_USE_XFT
       if (XFTDRAW)
         XftDrawSetClip(XFTDRAW, None);
#endif
    }
}

Here is the caller graph for this function:

void wxWindowDC::SetClippingRect ( double  x,
double  y,
double  w,
double  h 
) [virtual]

Implements wxDC.

Definition at line 2753 of file WindowDC.cc.

{
  wxRegion *r;
  r = new wxRegion(this);
  r->SetRectangle(x, y, w, h);

  SetClippingRegion(r);
}

Here is the call graph for this function:

Implements wxDC.

Definition at line 2762 of file WindowDC.cc.

{
  if (clipping)
    --clipping->locked;

  clipping = r;

  if (clipping)
    clipping->locked++;

  if (r) {
    if (r->rgn) {
      USER_REG = r->rgn;
    } else {
      /* NULL r->rgn means empty region */
      if (!empty_rgn)
       empty_rgn = XCreateRegion();
      USER_REG = empty_rgn;
    }
  } else
    USER_REG = NULL;
  SetCanvasClipping();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxWindowDC::SetColourMap ( wxColourMap cmap) [virtual]

Implements wxDC.

Definition at line 1860 of file WindowDC.cc.

{
  current_cmap = new_cmap ? new_cmap : wxAPP_COLOURMAP;
  
  if (DRAW_WINDOW) {
    Window w;
    Colormap cm;
    w = DRAW_WINDOW;
    cm = CMAP;
    XSetWindowColormap(DPY, w, cm);
  }
}
void wxDC::SetDeviceOrigin ( double  x,
double  y 
) [inherited]

Definition at line 99 of file DC.cc.

Here is the call graph for this function:

void wxWindowDC::SetFont ( wxFont font) [virtual]

Implements wxDC.

Definition at line 2698 of file WindowDC.cc.

{
  if (!DRAWABLE)
    return;

  if (!(current_font = font)) // nothing to do without a font
    return;

  need_x_set_font = 1;
}

Here is the caller graph for this function:

void wxDC::SetLogicalScale ( double  xs,
double  ys 
) [inherited]

Definition at line 106 of file DC.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

void wxDC::SetMapMode ( int  mode) [inherited]

Definition at line 113 of file DC.cc.

Here is the call graph for this function:

void wxDC::SetOptimization ( Bool  opt) [inline, inherited]

Definition at line 207 of file DC.h.

       { optimize = opt; }
void wxWindowDC::SetPen ( wxPen pen) [virtual]

Implements wxDC.

Definition at line 1881 of file WindowDC.cc.

{
  if (pen == current_pen)
    return;

  ResetPen(pen);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxWindowDC::SetPixel ( double  x,
double  y,
wxColour col 
)

Definition at line 3102 of file WindowDC.cc.

{
  int i, j;
  int w, h;
  int red, green, blue;

  i = XLOG2DEV(x);
  j = YLOG2DEV(y);

  BeginSetPixel(1, i, j);

  if (i < 0 || i >= (int)X->width
      || j < 0 || j >= (int)X->height)
    return;

  w = X->get_pixel_image_cache->width;
  h = X->get_pixel_image_cache->height;

  if (X->get_pixel_image_cache
      && ((i < X->cache_dx)
         || (i >= X->cache_dx + w)
         || (j < X->cache_dy)
         || (j >= X->cache_dy + h))) {
    /* Turns out that getting a small part wasn't such a
       good idea. Go into whole-image mode. */
    EndSetPixel();
    BeginSetPixel(0, i, j);
  }

  if (!X->get_pixel_image_cache)
    return;

  red = col->Red();
  green = col->Green();
  blue = col->Blue();

  X->set_a_pixel = TRUE;

  SetPixelFast(i - X->cache_dx, j - X->cache_dy, red, green, blue);
}

Here is the call graph for this function:

void wxWindowDC::SetPixelFast ( int  x,
int  y,
int  r,
int  g,
int  b 
)

Definition at line 3156 of file WindowDC.cc.

{
  int k;
  unsigned long pixel;
  XImage *get_pixel_image_cache;

  get_pixel_image_cache = X->get_pixel_image_cache;

  if (get_pixel_image_cache->depth == 1) {
    if ((red == 255) && (green == 255) && (blue == 255))
      pixel = 0;
    else
      pixel = 1;
  } else {
    if (wx_alloc_color_is_fast == 2) {
      pixel = ((red << wx_simple_r_start) 
              | (green << wx_simple_g_start)
              | (blue << wx_simple_b_start));
    } else {
      XColor xcol;

      if (!wx_alloc_color_is_fast) {
       int get_pixel_cache_pos;
       XColor *get_pixel_color_cache;
       Bool get_pixel_cache_full;

       get_pixel_cache_pos = X->get_pixel_cache_pos;
       get_pixel_color_cache = X->get_pixel_color_cache;
       get_pixel_cache_full = X->get_pixel_cache_full;

       for (k = get_pixel_cache_pos; k--; ) {
         if ((get_pixel_color_cache[k].red == red)
             && (get_pixel_color_cache[k].green == green)
             && (get_pixel_color_cache[k].blue == blue)) {
           pixel = get_pixel_color_cache[k].pixel;
           goto put;
         }
       }
      
       if (get_pixel_cache_full) {
         for (k = NUM_GETPIX_CACHE_COLORS; k-- > get_pixel_cache_pos; ) {
           if ((get_pixel_color_cache[k].red == red)
              && (get_pixel_color_cache[k].green == green)
              && (get_pixel_color_cache[k].blue == blue)) {
             pixel = get_pixel_color_cache[k].pixel;
             goto put;
           }
         }
       }
      }

      xcol.red = red << 8;
      xcol.green = green << 8;
      xcol.blue = blue << 8;
      
      {
       Colormap cm;
       cm = GETCOLORMAP(current_cmap);
       wxAllocColor(DPY, cm, &xcol);
      }
      
      pixel = xcol.pixel;
    }
    
    if (!wx_alloc_color_is_fast) {
      int get_pixel_cache_pos;
      XColor *get_pixel_color_cache;

      get_pixel_cache_pos = X->get_pixel_cache_pos;
      get_pixel_color_cache = X->get_pixel_color_cache;

      get_pixel_color_cache[get_pixel_cache_pos].pixel = pixel;
      get_pixel_color_cache[get_pixel_cache_pos].red = red;
      get_pixel_color_cache[get_pixel_cache_pos].green = green;
      get_pixel_color_cache[get_pixel_cache_pos].blue = blue;
      
      if (++(X->get_pixel_cache_pos) >= NUM_GETPIX_CACHE_COLORS) {
       X->get_pixel_cache_pos = 0;
       X->get_pixel_cache_full = TRUE;
      }
    }
  }

 put:
  pixel = XPutPixel(get_pixel_image_cache, i, j, pixel);  
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxDC::SetTextAlignment ( int  new_alignment) [inline, inherited]

Definition at line 209 of file DC.h.

       { current_text_alignment = new_alignment; }

Implements wxDC.

Definition at line 2724 of file WindowDC.cc.

{
    unsigned long pixel;

    if (!DRAWABLE) /* MATTHEW: [5] */
       return;

    if (!col)
      return;
    if (col != current_text_bg)
      current_text_bg->CopyFrom(col);
    pixel = current_text_bg->GetPixel(current_cmap, IS_COLOR, 0);
    XSetBackground(DPY, TEXT_GC, pixel);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements wxDC.

Definition at line 2709 of file WindowDC.cc.

{
    unsigned long pixel;

    if (!DRAWABLE)
       return;

    if (!col)
      return;
    if (col != current_text_fg)
      current_text_fg->CopyFrom(col);
    pixel = current_text_fg->GetPixel(current_cmap, IS_COLOR, 1);
    XSetForeground(DPY, TEXT_GC, pixel);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxDC::SetUserScale ( double  xs,
double  ys 
) [virtual, inherited]

Definition at line 135 of file DC.cc.

Here is the call graph for this function:

virtual Bool wxDC::StartDoc ( char *  WXUNUSEDmessage) [inline, virtual, inherited]

Definition at line 126 of file DC.h.

{ return TRUE; }
virtual void wxDC::StartPage ( void  ) [inline, virtual, inherited]

Definition at line 128 of file DC.h.

{}
void wxWindowDC::TryColour ( wxColour src,
wxColour dest 
) [virtual]

Implements wxDC.

Definition at line 2010 of file WindowDC.cc.

{
  XColor xcol;

  if (!DRAWABLE)
    return;

  xcol.pixel = src->GetPixel(current_cmap, IS_COLOR, 1);

  if (IS_COLOR) {
    Colormap cm;
    cm = GETCOLORMAP(current_cmap);
    wxQueryColor(wxAPP_DISPLAY, cm, &xcol);
    
    dest->Set(xcol.red >> SHIFT, xcol.green >> SHIFT, xcol.blue >> SHIFT);
  } else if (xcol.pixel == 1) { /* not wx_black_pixel */
    dest->Set(0, 0, 0);
  } else {
    dest->Set(255, 255, 255);
  }
}

Here is the call graph for this function:

virtual double wxDC::UnscrolledDeviceToLogicalX ( int  x) [inline, virtual, inherited]

Definition at line 140 of file DC.h.

       { return XDEV2LOG(x); }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual double wxDC::UnscrolledDeviceToLogicalY ( int  y) [inline, virtual, inherited]

Definition at line 146 of file DC.h.

       { return YDEV2LOG(y); }

Here is the call graph for this function:

Here is the caller graph for this function:

double wxDC::XDEV2LOG ( int  x) [inline, protected, inherited]

Definition at line 264 of file DC.h.

      { return (double(x) / scale_x) - device_origin_x; }

Here is the caller graph for this function:

double wxDC::XDEV2LOGREL ( int  x) [inline, protected, inherited]

Definition at line 266 of file DC.h.

      { return double(double(x) / scale_x); }

Here is the caller graph for this function:

int wxDC::XLOG2DEV ( double  x) [inline, protected, inherited]

Definition at line 272 of file DC.h.

      { double a = (x * scale_x) + device_origin_x;
       return (int)floor(a); }

Here is the caller graph for this function:

int wxDC::XLOG2DEVREL ( double  x) [inline, protected, inherited]

Definition at line 275 of file DC.h.

      { double a = x * scale_x;
       return (int)floor(a); }

Here is the caller graph for this function:

double wxDC::YDEV2LOG ( int  y) [inline, protected, inherited]

Definition at line 268 of file DC.h.

      { return (double(y) / scale_y) - device_origin_y; }

Here is the caller graph for this function:

double wxDC::YDEV2LOGREL ( int  y) [inline, protected, inherited]

Definition at line 270 of file DC.h.

      { return double(double(y) / scale_y); }

Here is the caller graph for this function:

int wxDC::YLOG2DEV ( double  y) [inline, protected, inherited]

Definition at line 278 of file DC.h.

      { double a = (y * scale_y) + device_origin_y;
       return (int)floor(a); }

Here is the caller graph for this function:

int wxDC::YLOG2DEVREL ( double  y) [inline, protected, inherited]

Definition at line 281 of file DC.h.

      { double a = y * scale_y;
       return (int)floor(a); }

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class wxPostScriptDC [friend]

Definition at line 229 of file WindowDC.h.

friend class wxWindow [friend]

Definition at line 228 of file WindowDC.h.


Member Data Documentation

Definition at line 146 of file wxGC.h.

WXTYPE wxObject::__type [inherited]

Definition at line 77 of file Object.h.

int wxDC::anti_alias [protected, inherited]

Definition at line 259 of file DC.h.

Bool wxDC::auto_setting [protected, inherited]

Definition at line 241 of file DC.h.

wxRegion* wxDC::clipping [protected, inherited]

Definition at line 258 of file DC.h.

Bool wxDC::Colour [inherited]

Definition at line 237 of file DC.h.

double wxDC::current_alpha [inherited]

Definition at line 239 of file DC.h.

wxColour* wxDC::current_background_color [protected, inherited]

Definition at line 248 of file DC.h.

wxBrush* wxDC::current_brush [protected, inherited]

Definition at line 249 of file DC.h.

wxColourMap* wxDC::current_cmap [protected, inherited]

Definition at line 250 of file DC.h.

wxFont* wxDC::current_font [protected, inherited]

Definition at line 251 of file DC.h.

int wxDC::current_map_mode [protected, inherited]

Definition at line 252 of file DC.h.

wxPen* wxDC::current_pen [protected, inherited]

Definition at line 253 of file DC.h.

int wxDC::current_text_alignment [protected, inherited]

Definition at line 254 of file DC.h.

wxColour* wxDC::current_text_bg [protected, inherited]

Definition at line 255 of file DC.h.

int wxDC::current_text_bgmode [protected, inherited]

Definition at line 256 of file DC.h.

wxColour* wxDC::current_text_fg [protected, inherited]

Definition at line 257 of file DC.h.

int wxDC::device [inherited]

Definition at line 238 of file DC.h.

double wxDC::device_origin_x [protected, inherited]

Definition at line 245 of file DC.h.

double wxDC::device_origin_y [protected, inherited]

Definition at line 245 of file DC.h.

double wxDC::logical_scale_x [protected, inherited]

Definition at line 246 of file DC.h.

double wxDC::logical_scale_y [protected, inherited]

Definition at line 246 of file DC.h.

double wxDC::mm_to_pix_x [protected, inherited]

Definition at line 243 of file DC.h.

double wxDC::mm_to_pix_y [protected, inherited]

Definition at line 243 of file DC.h.

char wxWindowDC::need_x_set_font [protected]

Definition at line 231 of file WindowDC.h.

Bool wxDC::ok [protected, inherited]

Definition at line 241 of file DC.h.

Bool wxDC::optimize [protected, inherited]

Definition at line 241 of file DC.h.

double wxDC::scale_x [protected, inherited]

Definition at line 244 of file DC.h.

double wxDC::scale_y [protected, inherited]

Definition at line 244 of file DC.h.

double wxDC::user_scale_x [protected, inherited]

Definition at line 246 of file DC.h.

double wxDC::user_scale_y [protected, inherited]

Definition at line 246 of file DC.h.

wxWindowDC_Xintern* wxWindowDC::X [protected]

Definition at line 238 of file WindowDC.h.


The documentation for this class was generated from the following files: