Beispiel #1
0
/*****************************************************************************
 * GdipIsVisibleRegionRect [GDIPLUS.@]
 */
GpStatus WINGDIPAPI GdipIsVisibleRegionRect(GpRegion* region, REAL x, REAL y, REAL w, REAL h, GpGraphics *graphics, BOOL *res)
{
    HRGN hrgn;
    GpStatus stat;
    RECT rect;

    TRACE("(%p, %.2f, %.2f, %.2f, %.2f, %p, %p)\n", region, x, y, w, h, graphics, res);

    if(!region || !res)
        return InvalidParameter;

    if((stat = GdipGetRegionHRgn(region, NULL, &hrgn)) != Ok)
        return stat;

    /* infinite */
    if(!hrgn){
        *res = TRUE;
        return Ok;
    }

    SetRect(&rect, ceilr(x), ceilr(y), ceilr(x + w), ceilr(y + h));
    *res = RectInRegion(hrgn, &rect);

    DeleteObject(hrgn);

    return Ok;
}
Beispiel #2
0
static void hugsprim_RectInRegion_15(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsPtr arg2;
    HsBool res1;
    arg1 = hugs->getPtr();
    arg2 = hugs->getPtr();
    res1 = RectInRegion(arg1, arg2);
    hugs->putBool(res1);
    hugs->returnIO(hugs_root,1);
}
Beispiel #3
0
FL_API int Fl_Gdi::not_clipped(int x, int y, int w, int h)
{
    Fl_Region r = fl_clip_stack[* fl_clip_stack_pointer];
    if (!r) return 1;
    RECT rect;
    rect.left = (x - WOx) * VEx / WEx + VOx;
    rect.top = (y - WOy) * VEy / WEy + VOy;
    rect.right  = (x + w - WOx) * VEx / WEx + VOx;
    rect.bottom  = (y + h - WOy) * VEy / WEy + VOy;
    return RectInRegion(r,&rect);
}
// Return true if region contains rectangle
// Contributed by Daniel Gehriger <*****@*****.**>.
FXbool FXRegion::contains(FXint x,FXint y,FXint w,FXint h) const {
#ifdef WIN32
  RECT rect;
  rect.left   = x;
  rect.top    = y;
  rect.right  = x + w;
  rect.bottom = y + h;
  return region && RectInRegion((HRGN)region,&rect);
#else
  return XRectInRegion((Region)region,x,y,w,h);
#endif
  }
BOOL RectToAdd()
{
	RECT rect;
	BOOL result; 
	if (region==NULL) return 1;
	rect.left=left;
	rect.top=top;
	rect.right=right;
	rect.bottom=bottom;
	result= RectInRegion(region,&rect);
	return (result);
}
Beispiel #6
0
/***********************************************************************
 *           RectVisible    (GDI32.@)
 */
BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
{
    RECT tmpRect;
    BOOL ret;
    HRGN clip;
    DC *dc = DC_GetDCUpdate( hdc );
    if (!dc) return FALSE;
    TRACE("%p %ld,%ldx%ld,%ld\n", hdc, rect->left, rect->top, rect->right, rect->bottom );

    tmpRect = *rect;
    LPtoDP( hdc, (POINT *)&tmpRect, 2 );

    if ((clip = get_clip_region(dc)))
    {
        HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
        CombineRgn( hrgn, dc->hVisRgn, clip, RGN_AND );
        ret = RectInRegion( hrgn, &tmpRect );
        DeleteObject( hrgn );
    }
    else ret = RectInRegion( dc->hVisRgn, &tmpRect );
    GDI_ReleaseObj( hdc );
    return ret;
}
Beispiel #7
0
/***********************************************************************
 *           RectVisible    (GDI32.@)
 */
BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
{
    RECT tmpRect, visrect;
    BOOL ret;
    DC *dc = get_dc_ptr( hdc );
    if (!dc) return FALSE;
    TRACE("%p %s\n", hdc, wine_dbgstr_rect( rect ));

    tmpRect = *rect;
    lp_to_dp( dc, (POINT *)&tmpRect, 2 );
    order_rect( &tmpRect );

    update_dc( dc );
    ret = (!get_dc_device_rect( dc, &visrect ) || intersect_rect( &visrect, &visrect, &tmpRect ));
    if (ret && get_dc_region( dc )) ret = RectInRegion( get_dc_region( dc ), &tmpRect );
    release_dc_ptr( dc );
    return ret;
}
Beispiel #8
0
static void test_region(void)
{
    HRGN hrgn = CreateRectRgn(10, 10, 20, 20);
    RECT rc = { 5, 5, 15, 15 };
    BOOL ret = RectInRegion( hrgn, &rc);
    ok( ret, "RectInRegion should return TRUE\n");
    /* swap left and right */
    SetRect( &rc, 15, 5, 5, 15 );
    ret = RectInRegion( hrgn, &rc);
    ok( ret, "RectInRegion should return TRUE\n");
    /* swap top and bottom */
    SetRect( &rc, 5, 15, 15, 5 );
    ret = RectInRegion( hrgn, &rc);
    ok( ret, "RectInRegion should return TRUE\n");
    /* swap both */
    SetRect( &rc, 15, 15, 5, 5 );
    ret = RectInRegion( hrgn, &rc);
    ok( ret, "RectInRegion should return TRUE\n");
    DeleteObject(hrgn);
    /* swap left and right in the region */
    hrgn = CreateRectRgn(20, 10, 10, 20);
    SetRect( &rc, 5, 5, 15, 15 );
    ret = RectInRegion( hrgn, &rc);
    ok( ret, "RectInRegion should return TRUE\n");
    /* swap left and right */
    SetRect( &rc, 15, 5, 5, 15 );
    ret = RectInRegion( hrgn, &rc);
    ok( ret, "RectInRegion should return TRUE\n");
    /* swap top and bottom */
    SetRect( &rc, 5, 15, 15, 5 );
    ret = RectInRegion( hrgn, &rc);
    ok( ret, "RectInRegion should return TRUE\n");
    /* swap both */
    SetRect( &rc, 15, 15, 5, 5 );
    ret = RectInRegion( hrgn, &rc);
    ok( ret, "RectInRegion should return TRUE\n");
    DeleteObject(hrgn);
}
Beispiel #9
0
/*+/csubr/TOC/internal-------------------------------------------------------
* PlPOINTPlot - plot an array of POINT structures
*
* Purpose:
*		Plots an array of POINT structures.
*
*		If the number of points is 1, then PL_LINE... gets plotted as
*		though it were PL_POINT.
*
* Return Value:
*		PL_OK, or
*		other error codes
*
*-Date     Author		Revision
* -------- ------------	--------
* 09-27-95 R. Cole		created
*--------------------------------------------------------------------------*/
int
PlPOINTPlot(
PL_CTX	*pPlot,			// I pointer to plot context structure
HDC		hDC,			// I HDC
const RECT *pRectPts,	// I pointer to rect bounding points, or NULL
const POINT *aPts,		// I array of POINT structures
int		nPts,			// I number of array elements
int		eDrawType,		// I PL_LINE... or PL_POINT or PL_... mark
float	fPts,			// I drawing thickness or mark size, in points
COLORREF rgb)			// I color to use for drawing
{
	int		retStat=PL_OK;
	HBRUSH	hBrush=0, hOldBrush=0;
	HPEN	hPen=0, hOldPen=0;
	int		stat, j;
	RECT	rectPts;

	// If the caller has told us the RECT that bounds the points to be
	// drawn, check to see if the RECT (or a part of it) lies within
	// the area of the window that needs to be drawn.  If not, just
	// exit from this routine.
	if (pRectPts != NULL) {
		rectPts = *pRectPts;
		// Make the rect follow the Windows convention.
		rectPts.right += 1;
		rectPts.bottom += 1;

		if (pPlot->hRgnPaint != 0) {
			if (!RectInRegion(pPlot->hRgnPaint, &rectPts))
				goto done;
		}
		if (!RectVisible(hDC, &rectPts))
			goto done;
	}

	// Now draw the actual data points.  There is a separate section
	// here for each drawing type.  One of the overriding objectives
	// in how this is coded is to minimize the number of subroutine
	// calls.
	if (nPts >= 2 && eDrawType >= PL_LINE &&
					eDrawType <= PL_LINE_DASHDOTDOT) {
// Draw all "line" types.
		stat = Polyline(hDC, aPts, nPts);
		if (stat == 0) {
			// In some cases (not well understood), Polyline
			// fails.  When this happens, draw the line one
			// point at a time.
			MoveToEx(hDC, aPts[0].x, aPts[0].y, NULL);
			for (j=1; j<nPts; j++) 
				LineTo(hDC, aPts[j].x, aPts[j].y);
		}
		SetPixel(hDC, aPts[nPts-1].x, aPts[nPts-1].y, rgb);
	}
	else if (eDrawType >= PL_SQUARE && eDrawType <= PL_CROSS) {
// Draw all "plot mark" types.
		int		wid, ht;

		ht = PL_YPTS_TO_YPIX(fPts);
		wid = PL_XPTS_TO_XPIX(fPts);
		for (j=0; j<nPts; j++)  {
			retStat = PlDraw_discrete(pPlot, hDC,
				aPts[j].x, aPts[j].y,
				wid, ht, eDrawType,
				0, 0, 0, 0, 0, 0,
				rgb);
			if (retStat != PL_OK) goto done;
		}
	}
	else {
// Draw PL_POINT type.
		int		nX, nY;
		nX = PL_XPTS_TO_XPIX(fPts);
		nY = PL_YPTS_TO_YPIX(fPts);
		if (nX <= 1 && nY <= 1) {
			for (j=0; j<nPts; j++)
				SetPixel(hDC, aPts[j].x, aPts[j].y, rgb);
		}
		else {
			int		xL, xR, yB, yT;
			int		iHalfWid=(nX - 1)/2;
			int		iHalfHt=(nY - 1)/2;
			if ((hPen = CreatePen(PS_SOLID, 1, rgb)) == 0) goto gdi_error;
			/* KG */
			//hOldPen = SelectObject(hDC, hPen);
			hOldPen = (HPEN)SelectObject(hDC, hPen);
			if ((hBrush = CreateSolidBrush(rgb)) == 0) goto gdi_error;
			/* KG */
			//hOldBrush = SelectObject(hDC, hBrush);
			hOldBrush = (HBRUSH)SelectObject(hDC, hBrush);

			for (j=0; j<nPts; j++)  {
				xL = aPts[j].x - iHalfWid;
				xR = xL + nX;
				yT = aPts[j].y - iHalfHt;
				yB = yT + nY;
				Ellipse(hDC, xL, yT, xR, yB);
			}
		}
	}

done:
	if (hOldPen != 0) SelectObject(hDC, hOldPen);
	if (hPen != 0) DeleteObject(hPen);
	if (hOldBrush != 0) SelectObject(hDC, hOldBrush);
	if (hBrush != 0) DeleteObject(hBrush);
	return retStat;

gdi_error:
	retStat = PL_GDI_FAIL;
	goto done;
}
Beispiel #10
0
BOOL CPasswordSubsetDlg::OnInitDialog()
{
  CPWDialog::OnInitDialog();
  
  Fonts::GetInstance()->ApplyPasswordFont(GetDlgItem(IDC_SUBSETRESULTS));

  // Place dialog where user had it last
  CRect rect, dlgRect;
  GetWindowRect(&dlgRect);
  PWSprefs::GetInstance()->GetPrefPSSRect(rect.top, rect.bottom, 
                                          rect.left, rect.right);

  HRGN hrgnWork = GetWorkAreaRegion();
  // also check that window will be visible
  if ((rect.top == -1 && rect.bottom == -1 && rect.left == -1 && rect.right == -1) || !RectInRegion(hrgnWork, rect)){
    rect = dlgRect;
  }
  ::DeleteObject(hrgnWork);
  // Ignore size just set position
  SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);

  m_pToolTipCtrl = new CToolTipCtrl;
  if (!m_pToolTipCtrl->Create(this, TTS_BALLOON | TTS_NOPREFIX)) {
    pws_os::Trace(L"Unable To create CManagePSWDPols Dialog ToolTip\n");
    delete m_pToolTipCtrl;
    m_pToolTipCtrl = NULL;
  } else {
    EnableToolTips(TRUE);

    // Delay initial show & reshow
    int iTime = m_pToolTipCtrl->GetDelayTime(TTDT_AUTOPOP);
    m_pToolTipCtrl->SetDelayTime(TTDT_AUTOPOP, iTime * 4);
    m_pToolTipCtrl->Activate(TRUE);
    m_pToolTipCtrl->SetMaxTipWidth(500);
    AddTool(IDC_COPYPASSWORD, IDS_CLICKTOCOPYGENPSWD);
  }

  // Load bitmap
  UINT nImageID = PWSprefs::GetInstance()->GetPref(PWSprefs::UseNewToolbar) ?
                     IDB_COPYPASSWORD_NEW : IDB_COPYPASSWORD_CLASSIC;

  BOOL brc = m_CopyPswdBitmap.Attach(::LoadImage(
                                                 ::AfxFindResourceHandle(MAKEINTRESOURCE(nImageID), RT_BITMAP),
                                                 MAKEINTRESOURCE(nImageID), IMAGE_BITMAP, 0, 0,
                                                 (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_SHARED)));

  ASSERT(brc);
  if (brc) {
    FixBitmapBackground(m_CopyPswdBitmap);

    CButton *pBtn = (CButton *)GetDlgItem(IDC_COPYPASSWORD);
    ASSERT(pBtn != NULL);
    if (pBtn != NULL)
      pBtn->SetBitmap(m_CopyPswdBitmap);
  }
  ShowWindow(SW_SHOW);
  return TRUE;
}