• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GDI_GetObjPtr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GDI_GetObjPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ GDI_GetObjPtr函数的具体用法?C++ GDI_GetObjPtr怎么用?C++ GDI_GetObjPtr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GDI_GetObjPtr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: get_brush_bitmap_info

BOOL get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void **bits, UINT *usage )
{
    BRUSHOBJ *brush;
    BOOL ret = FALSE;

    if (!(brush = GDI_GetObjPtr( handle, OBJ_BRUSH ))) return FALSE;

    if (!brush->info)
    {
        BITMAPOBJ *bmp = GDI_GetObjPtr( brush->bitmap, OBJ_BITMAP );

        if (bmp)
        {
            store_bitmap_bits( brush, bmp );
            GDI_ReleaseObj( brush->bitmap );
        }
    }
    if (brush->info)
    {
        memcpy( info, brush->info, get_dib_info_size( brush->info, brush->usage ));
        if (info->bmiHeader.biBitCount <= 8 && !info->bmiHeader.biClrUsed)
            fill_default_color_table( info );
        *bits = brush->bits.ptr;
        *usage = brush->usage;
        ret = TRUE;
    }
    GDI_ReleaseObj( handle );
    return ret;
}
开发者ID:bpon,项目名称:wine,代码行数:29,代码来源:brush.c


示例2: REGION_FrameRgn

/*
 *           REGION_FrameRgn
 * Create a region that is a frame around another region.
 * Expand all rectangles by +/- x and y, then subtract original region.
 */
BOOL
REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y )
{
    BOOL bRet;
    MWRGNOBJ *srcObj = (MWRGNOBJ*) GDI_GetObjPtr( hSrc, OBJ_REGION );

    if (srcObj->rgn->numRects != 0) 
    {
	MWRGNOBJ* destObj = (MWRGNOBJ*) GDI_GetObjPtr( hDest, OBJ_REGION );
	RECT *pRect, *pEndRect;
	RECT tempRect;

	EMPTY_REGION( destObj->rgn );
	
	pEndRect = srcObj->rgn->rects + srcObj->rgn->numRects;
	for(pRect = srcObj->rgn->rects; pRect < pEndRect; pRect++)
	{
	    tempRect.left = pRect->left - x;        
	    tempRect.top = pRect->top - y;
	    tempRect.right = pRect->right + x;
	    tempRect.bottom = pRect->bottom + y;
	    GdUnionRectWithRegion( &tempRect, destObj->rgn );
	}
	GdSubtractRegion( destObj->rgn, destObj->rgn, srcObj->rgn );
	bRet = TRUE;
    }
    else
	bRet = FALSE;
    return bRet;
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:35,代码来源:winrgn.c


示例3: CombineRgn

/*
 * Note: The behavior is correct even if src and dest regions are the same.
 */
INT WINAPI
CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
{
    MWRGNOBJ *destObj = (MWRGNOBJ *) GDI_GetObjPtr( hDest, OBJ_REGION);
    INT result = ERRORREGION;

    /*TRACE(region, " %04x,%04x -> %04x mode=%x\n", hSrc1, hSrc2, hDest,mode);*/

    if (destObj)
    {
	MWRGNOBJ *src1Obj = (MWRGNOBJ *) GDI_GetObjPtr( hSrc1, OBJ_REGION);

	if (src1Obj)
	{
	    /*TRACE(region, "dump:\n");
	    if(TRACE_ON(region)) 
	        REGION_DumpRegion(src1Obj->rgn);*/
	    if (mode == RGN_COPY)
	    {
		GdCopyRegion( destObj->rgn, src1Obj->rgn );
		result = destObj->rgn->type;
	    }
	    else
	    {
		MWRGNOBJ *src2Obj = (MWRGNOBJ *) GDI_GetObjPtr( hSrc2, OBJ_REGION);

		if (src2Obj)
		{
		    /*TRACE(region, "dump:\n");
		    if(TRACE_ON(region)) 
		        REGION_DumpRegion(src2Obj->rgn);*/
		    switch (mode)
		    {
		    case RGN_AND:
			GdIntersectRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn);
			break;
		    case RGN_OR:
			GdUnionRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn );
			break;
		    case RGN_XOR:
			GdXorRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn );
			break;
		    case RGN_DIFF:
			GdSubtractRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn );
			break;
		    }
		    result = destObj->rgn->type;
		}
	    }
	}
	/*TRACE(region, "dump:\n");
	if(TRACE_ON(region)) 
	    REGION_DumpRegion(destObj->rgn);*/
    }
    return result;
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:59,代码来源:winrgn.c


示例4: EqualRgn

BOOL WINAPI
EqualRgn( HRGN hrgn1, HRGN hrgn2 )
{
    MWRGNOBJ *obj1, *obj2;

    if ((obj1 = (MWRGNOBJ *) GDI_GetObjPtr( hrgn1, OBJ_REGION ))) 
	if ((obj2 = (MWRGNOBJ *) GDI_GetObjPtr( hrgn2, OBJ_REGION ))) 
	    return GdEqualRegion(obj1->rgn, obj2->rgn);
    return FALSE;
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:10,代码来源:winrgn.c


示例5: copy_bitmap

static BOOL copy_bitmap( BRUSHOBJ *brush, HBITMAP bitmap )
{
    BITMAPINFO *info;
    BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );

    if (!bmp) return FALSE;

    if (!bmp->dib)
    {
        if ((brush->bitmap = CreateBitmap( bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
                                           bmp->bitmap.bmPlanes, bmp->bitmap.bmBitsPixel, NULL )))
        {
            if (bmp->funcs->pCopyBitmap( bitmap, brush->bitmap ))
            {
                BITMAPOBJ *copy = GDI_GetObjPtr( brush->bitmap, OBJ_BITMAP );
                copy->funcs = bmp->funcs;
                GDI_ReleaseObj( copy );
            }
            else
            {
                DeleteObject( brush->bitmap );
                brush->bitmap = 0;
            }
        }
        GDI_ReleaseObj( bitmap );
        return brush->bitmap != 0;
    }

    info = HeapAlloc( GetProcessHeap(), 0,
                      get_dib_info_size( (BITMAPINFO *)&bmp->dib->dsBmih, DIB_RGB_COLORS ));
    if (!info) goto done;
    info->bmiHeader = bmp->dib->dsBmih;
    if (info->bmiHeader.biCompression == BI_BITFIELDS)
        memcpy( &info->bmiHeader + 1, bmp->dib->dsBitfields, sizeof(bmp->dib->dsBitfields) );
    else if (info->bmiHeader.biClrUsed)
        memcpy( &info->bmiHeader + 1, bmp->color_table, info->bmiHeader.biClrUsed * sizeof(RGBQUAD) );
    if (!(brush->bits.ptr = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage )))
    {
        HeapFree( GetProcessHeap(), 0, info );
        goto done;
    }
    memcpy( brush->bits.ptr, bmp->dib->dsBm.bmBits, info->bmiHeader.biSizeImage );
    brush->bits.is_copy = TRUE;
    brush->bits.free = free_heap_bits;
    brush->info = info;
    brush->usage = DIB_RGB_COLORS;

done:
    GDI_ReleaseObj( bitmap );
    return brush->info != NULL;
}
开发者ID:bpon,项目名称:wine,代码行数:51,代码来源:brush.c


示例6: BRUSH_SelectObject

/***********************************************************************
 *           BRUSH_SelectObject
 */
static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
{
    BRUSHOBJ *brush;
    HGDIOBJ ret = 0;
    DC *dc = get_dc_ptr( hdc );

    if (!dc)
    {
        SetLastError( ERROR_INVALID_HANDLE );
        return 0;
    }

    if ((brush = GDI_GetObjPtr( handle, OBJ_BRUSH )))
    {
        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush );
        HBITMAP bitmap = brush->bitmap;
        BITMAPINFO *info;
        void *bits;
        UINT usage;

        if (bitmap && !brush->info)
        {
            BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
            /* fetch the bitmap bits if we are selecting into a different type of DC */
            if (bmp && bmp->funcs != physdev->funcs) store_bitmap_bits( brush, bmp );
            GDI_ReleaseObj( bitmap );
        }

        info   = brush->info;
        bits   = brush->bits.ptr;
        usage  = brush->usage;
        GDI_inc_ref_count( handle );
        GDI_ReleaseObj( handle );

        if (!physdev->funcs->pSelectBrush( physdev, handle, bitmap, info, bits, usage ))
        {
            GDI_dec_ref_count( handle );
        }
        else
        {
            ret = dc->hBrush;
            dc->hBrush = handle;
            GDI_dec_ref_count( ret );
        }
    }
    release_dc_ptr( dc );
    return ret;
}
开发者ID:bpon,项目名称:wine,代码行数:51,代码来源:brush.c


示例7: ExtCreateRegion

HRGN WINAPI
ExtCreateRegion(const XFORM* lpXform, DWORD dwCount, const RGNDATA* rgndata)
{
    HRGN hrgn = CreateRectRgn(0, 0, 0, 0);
    MWRGNOBJ *obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION );
    RECT *pCurRect, *pEndRect;

    /*TRACE(region, " %p %ld %p. Returning %04x\n",
		lpXform, dwCount, rgndata, hrgn);*/
    if(!hrgn)
    {
        WARN(region, "Can't create a region!\n");
	return 0;
    }
    if(lpXform)
        WARN(region, "Xform not implemented - ignoring\n");
    
    if(rgndata->rdh.iType != RDH_RECTANGLES)
    {
        WARN(region, "Type not RDH_RECTANGLES\n");
	DeleteObject( hrgn );
	return 0;
    }

    pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount;
    for(pCurRect = (RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++)
        GdUnionRectWithRegion( pCurRect, obj->rgn );

    return hrgn;
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:30,代码来源:winrgn.c


示例8: GetRegionData

DWORD WINAPI
GetRegionData(HRGN hrgn, DWORD count, LPRGNDATA rgndata)
{
    DWORD size;
    MWRGNOBJ *obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION );
    MWCLIPREGION *rgn;
    
    /*TRACE(region," %04x count = %ld, rgndata = %p\n", hrgn, count, rgndata);*/

    if(!obj) return 0;

    rgn = obj->rgn;
    size = rgn->numRects * sizeof(RECT);
    if(count < (size + sizeof(RGNDATAHEADER)) || rgndata == NULL)
        return size + sizeof(RGNDATAHEADER);

    rgndata->rdh.dwSize = sizeof(RGNDATAHEADER);
    rgndata->rdh.iType = RDH_RECTANGLES;
    rgndata->rdh.nCount = rgn->numRects;
    rgndata->rdh.nRgnSize = size;
    rgndata->rdh.rcBound.left = rgn->extents.left;
    rgndata->rdh.rcBound.top = rgn->extents.top;
    rgndata->rdh.rcBound.right = rgn->extents.right;
    rgndata->rdh.rcBound.bottom = rgn->extents.bottom;

    memcpy( rgndata->Buffer, rgn->rects, size );

    return 1;
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:29,代码来源:winrgn.c


示例9: EMFDRV_SelectObject

/***********************************************************************
 *           EMFDRV_SelectObject
 */
HGDIOBJ EMFDRV_SelectObject( DC *dc, HGDIOBJ handle )
{
    GDIOBJHDR * ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
    HGDIOBJ ret = 0;

    if (!ptr) return 0;
    TRACE("hdc=%04x %04x\n", dc->hSelf, handle );

    switch(GDIMAGIC(ptr->wMagic))
    {
      case PEN_MAGIC:
	  ret = EMFDRV_PEN_SelectObject( dc, handle );
	  break;
      case BRUSH_MAGIC:
	  ret = EMFDRV_BRUSH_SelectObject( dc, handle );
	  break;
      case FONT_MAGIC:
	  ret = EMFDRV_FONT_SelectObject( dc, handle );
	  break;
      case BITMAP_MAGIC:
	  ret = EMFDRV_BITMAP_SelectObject( dc, handle );
	  break;
    }
    GDI_ReleaseObj( handle );
    return ret;
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:29,代码来源:objects.c


示例10: GDIRealizePalette

/***********************************************************************
 *           GDIRealizePalette    (Not a Windows API)
 */
UINT WINAPI GDIRealizePalette( HDC hdc )
{
    UINT realized = 0;
    DC* dc = get_dc_ptr( hdc );

    if (!dc) return 0;

    TRACE("%p...\n", hdc );

    if( dc->hPalette == GetStockObject( DEFAULT_PALETTE ))
    {
        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRealizeDefaultPalette );
        realized = physdev->funcs->pRealizeDefaultPalette( physdev );
    }
    else if (InterlockedExchangePointer( (void **)&hLastRealizedPalette, dc->hPalette ) != dc->hPalette)
    {
        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRealizePalette );
        PALETTEOBJ *palPtr = GDI_GetObjPtr( dc->hPalette, OBJ_PAL );
        if (palPtr)
        {
            realized = physdev->funcs->pRealizePalette( physdev, dc->hPalette,
                                                        (dc->hPalette == hPrimaryPalette) );
            palPtr->unrealize = physdev->funcs->pUnrealizePalette;
            GDI_ReleaseObj( dc->hPalette );
        }
    }
    else TRACE("  skipping (hLastRealizedPalette = %p)\n", hLastRealizedPalette);

    release_dc_ptr( dc );
    TRACE("   realized %i colors.\n", realized );
    return realized;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:35,代码来源:palette.c


示例11: GetNearestPaletteIndex

/***********************************************************************
 * GetNearestPaletteIndex [[email protected]]
 *
 * Gets palette index for color.
 *
 * NOTES
 *    Should index be initialized to CLR_INVALID instead of 0?
 *
 * RETURNS
 *    Success: Index of entry in logical palette
 *    Failure: CLR_INVALID
 */
UINT WINAPI GetNearestPaletteIndex(
    HPALETTE hpalette, /* [in] Handle of logical color palette */
    COLORREF color)      /* [in] Color to be matched */
{
    PALETTEOBJ* palObj = GDI_GetObjPtr( hpalette, OBJ_PAL );
    UINT index  = 0;

    if( palObj )
    {
        int i, diff = 0x7fffffff;
        int r,g,b;
        PALETTEENTRY* entry = palObj->entries;

        for( i = 0; i < palObj->count && diff ; i++, entry++)
        {
            r = entry->peRed - GetRValue(color);
            g = entry->peGreen - GetGValue(color);
            b = entry->peBlue - GetBValue(color);

            r = r*r + g*g + b*b;

            if( r < diff ) { index = i; diff = r; }
        }
        GDI_ReleaseObj( hpalette );
    }
    TRACE("(%p,%06x): returning %d\n", hpalette, color, index );
    return index;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:40,代码来源:palette.c


示例12: SetPaletteEntries

/***********************************************************************
 * SetPaletteEntries [[email protected]]
 *
 * Sets color values for range in palette.
 *
 * RETURNS
 *    Success: Number of entries that were set
 *    Failure: 0
 */
UINT WINAPI SetPaletteEntries(
    HPALETTE hpalette,    /* [in] Handle of logical palette */
    UINT start,           /* [in] Index of first entry to set */
    UINT count,           /* [in] Number of entries to set */
    const PALETTEENTRY *entries) /* [in] Address of array of structures */
{
    PALETTEOBJ * palPtr;
    UINT numEntries;

    TRACE("hpal=%p,start=%i,count=%i\n",hpalette,start,count );

    hpalette = get_full_gdi_handle( hpalette );
    if (hpalette == GetStockObject(DEFAULT_PALETTE)) return 0;
    palPtr = GDI_GetObjPtr( hpalette, OBJ_PAL );
    if (!palPtr) return 0;

    numEntries = palPtr->count;
    if (start >= numEntries)
    {
      GDI_ReleaseObj( hpalette );
      return 0;
    }
    if (start+count > numEntries) count = numEntries - start;
    memcpy( &palPtr->entries[start], entries, count * sizeof(PALETTEENTRY) );
    GDI_ReleaseObj( hpalette );
    UnrealizeObject( hpalette );
    return count;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:37,代码来源:palette.c


示例13: GetPaletteEntries

/***********************************************************************
 * GetPaletteEntries [[email protected]]
 *
 * Retrieves palette entries.
 *
 * RETURNS
 *    Success: Number of entries from logical palette
 *    Failure: 0
 */
UINT WINAPI GetPaletteEntries(
    HPALETTE hpalette,    /* [in]  Handle of logical palette */
    UINT start,           /* [in]  First entry to receive */
    UINT count,           /* [in]  Number of entries to receive */
    LPPALETTEENTRY entries) /* [out] Address of array receiving entries */
{
    PALETTEOBJ * palPtr;
    UINT numEntries;

    TRACE("hpal = %p, count=%i\n", hpalette, count );

    palPtr = GDI_GetObjPtr( hpalette, OBJ_PAL );
    if (!palPtr) return 0;

    /* NOTE: not documented but test show this to be the case */
    if (count == 0)
    {
        count = palPtr->count;
    }
    else
    {
        numEntries = palPtr->count;
        if (start+count > numEntries) count = numEntries - start;
        if (entries)
        {
            if (start >= numEntries) count = 0;
            else memcpy( entries, &palPtr->entries[start], count * sizeof(PALETTEENTRY) );
        }
    }

    GDI_ReleaseObj( hpalette );
    return count;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:42,代码来源:palette.c


示例14: BITMAP_GetObject

/***********************************************************************
 *           BITMAP_GetObject
 */
static INT BITMAP_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
{
    INT ret;
    BITMAPOBJ *bmp = GDI_GetObjPtr( handle, OBJ_BITMAP );

    if (!bmp) return 0;

    if (!buffer) ret = sizeof(BITMAP);
    else if (count < sizeof(BITMAP)) ret = 0;
    else if (bmp->dib)
    {
	if (count >= sizeof(DIBSECTION))
	{
            DIBSECTION *dib = buffer;
            *dib = *bmp->dib;
            dib->dsBmih.biHeight = abs( dib->dsBmih.biHeight );
            ret = sizeof(DIBSECTION);
	}
	else /* if (count >= sizeof(BITMAP)) */
        {
            DIBSECTION *dib = bmp->dib;
            memcpy( buffer, &dib->dsBm, sizeof(BITMAP) );
            ret = sizeof(BITMAP);
	}
    }
    else
    {
        memcpy( buffer, &bmp->bitmap, sizeof(BITMAP) );
        ((BITMAP *) buffer)->bmBits = NULL;
        ret = sizeof(BITMAP);
    }
    GDI_ReleaseObj( handle );
    return ret;
}
开发者ID:bpon,项目名称:wine,代码行数:37,代码来源:bitmap.c


示例15: BITMAP_SetOwnerDC

/***********************************************************************
 *           BITMAP_SetOwnerDC
 *
 * Set the type of DC that owns the bitmap. This is used when the
 * bitmap is selected into a device to initialize the bitmap function
 * table.
 */
static BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev )
{
    BITMAPOBJ *bitmap;
    BOOL ret = TRUE;

    /* never set the owner of the stock bitmap since it can be selected in multiple DCs */
    if (hbitmap == GetStockObject(DEFAULT_BITMAP)) return TRUE;

    if (!(bitmap = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ))) return FALSE;

    if (!bitmap->dib && bitmap->funcs != physdev->funcs)
    {
        /* we can only change from the null driver to some other driver */
        if (bitmap->funcs == &null_driver)
        {
            if (physdev->funcs->pCreateBitmap)
            {
                ret = physdev->funcs->pCreateBitmap( physdev, hbitmap );
                if (ret)
                {
                    bitmap->funcs = physdev->funcs;
                    set_initial_bitmap_bits( hbitmap, bitmap );
                }
            }
            else bitmap->funcs = &dib_driver;  /* use the DIB driver to emulate DDB support */
        }
        else
        {
            FIXME( "Trying to select bitmap %p in different DC type\n", hbitmap );
            ret = FALSE;
        }
    }
    GDI_ReleaseObj( hbitmap );
    return ret;
}
开发者ID:bpon,项目名称:wine,代码行数:42,代码来源:bitmap.c


示例16: GetObject16

/***********************************************************************
 *           GetObject    (GDI.82)
 */
INT16 WINAPI GetObject16( HANDLE16 handle, INT16 count, LPVOID buffer )
{
    GDIOBJHDR * ptr;
    INT16 result = 0;
    TRACE("%04x %d %p\n", handle, count, buffer );
    if (!count) return 0;

    if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;

    switch(GDIMAGIC(ptr->wMagic))
    {
    case PEN_MAGIC:
        result = PEN_GetObject16( (PENOBJ *)ptr, count, buffer );
        break;
    case BRUSH_MAGIC:
        result = BRUSH_GetObject16( (BRUSHOBJ *)ptr, count, buffer );
        break;
    case BITMAP_MAGIC:
        result = BITMAP_GetObject16( (BITMAPOBJ *)ptr, count, buffer );
        break;
    case FONT_MAGIC:
        result = FONT_GetObject16( (FONTOBJ *)ptr, count, buffer );
        break;
    case PALETTE_MAGIC:
        result = PALETTE_GetObject( (PALETTEOBJ *)ptr, count, buffer );
        break;
    }
    GDI_ReleaseObj( handle );
    return result;
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:33,代码来源:gdiobj.c


示例17: UnrealizeObject

/***********************************************************************
 *           UnrealizeObject    ([email protected])
 */
BOOL WINAPI UnrealizeObject( HGDIOBJ obj )
{
    BOOL result = TRUE;
    /* Check if object is valid */

    GDIOBJHDR * header = GDI_GetObjPtr( obj, MAGIC_DONTCARE );
    if (!header) return FALSE;

    TRACE("%04x\n", obj );

    /* Unrealize object */

    switch(GDIMAGIC(header->wMagic))
    {
    case PALETTE_MAGIC:
        result = PALETTE_UnrealizeObject( obj, (PALETTEOBJ *)header );
        break;

    case BRUSH_MAGIC:
        /* Windows resets the brush origin. We don't need to. */
        break;
    }
    GDI_ReleaseObj( obj );
    return result;
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:28,代码来源:gdiobj.c


示例18: GetObjectW

/***********************************************************************
 *           GetObjectW    ([email protected])
 */
INT WINAPI GetObjectW( HANDLE handle, INT count, LPVOID buffer )
{
    GDIOBJHDR * ptr;
    INT result = 0;
    TRACE("%08x %d %p\n", handle, count, buffer );
    if (!count) return 0;

    if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;

    switch(GDIMAGIC(ptr->wMagic))
    {
    case PEN_MAGIC:
        result = PEN_GetObject( (PENOBJ *)ptr, count, buffer );
        break;
    case BRUSH_MAGIC:
        result = BRUSH_GetObject( (BRUSHOBJ *)ptr, count, buffer );
        break;
    case BITMAP_MAGIC:
        result = BITMAP_GetObject( (BITMAPOBJ *)ptr, count, buffer );
        break;
    case FONT_MAGIC:
        result = FONT_GetObjectW( (FONTOBJ *)ptr, count, buffer );
        break;
    case PALETTE_MAGIC:
        result = PALETTE_GetObject( (PALETTEOBJ *)ptr, count, buffer );
        break;
    default:
        FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr->wMagic) );
        break;
    }
    GDI_ReleaseObj( handle );
    return result;
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:36,代码来源:gdiobj.c


示例19: GetRgnBox

INT WINAPI
GetRgnBox( HRGN hrgn, LPRECT rect )
{
    MWRGNOBJ * obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION );
    if (obj)
	return GdGetRegionBox(obj->rgn, rect);
    return ERRORREGION;
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:8,代码来源:winrgn.c


示例20: GetBitmapBits

/***********************************************************************
 * GetBitmapBits [[email protected]]
 *
 * Copies bitmap bits of bitmap to buffer.
 *
 * RETURNS
 *    Success: Number of bytes copied
 *    Failure: 0
 */
LONG WINAPI GetBitmapBits(
    HBITMAP hbitmap, /* [in]  Handle to bitmap */
    LONG count,        /* [in]  Number of bytes to copy */
    LPVOID bits)       /* [out] Pointer to buffer to receive bits */
{
    char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
    BITMAPINFO *info = (BITMAPINFO *)buffer;
    struct gdi_image_bits src_bits;
    struct bitblt_coords src;
    int dst_stride, max, ret;
    BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );

    if (!bmp) return 0;

    dst_stride = get_bitmap_stride( bmp->dib.dsBm.bmWidth, bmp->dib.dsBm.bmBitsPixel );
    ret = max = dst_stride * bmp->dib.dsBm.bmHeight;
    if (!bits) goto done;
    if (count > max) count = max;
    ret = count;

    src.visrect.left = 0;
    src.visrect.right = bmp->dib.dsBm.bmWidth;
    src.visrect.top = 0;
    src.visrect.bottom = (count + dst_stride - 1) / dst_stride;
    src.x = src.y = 0;
    src.width = src.visrect.right - src.visrect.left;
    src.height = src.visrect.bottom - src.visrect.top;

    if (!get_image_from_bitmap( bmp, info, &src_bits, &src ))
    {
        const char *src_ptr = src_bits.ptr;
        int src_stride = get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );

        /* GetBitmapBits returns 16-bit aligned data */

        if (info->bmiHeader.biHeight > 0)
        {
            src_ptr += (info->bmiHeader.biHeight - 1) * src_stride;
            src_stride = -src_stride;
        }
        src_ptr += src.visrect.top * src_stride;

        if (src_stride == dst_stride) memcpy( bits, src_ptr, count );
        else while (count > 0)
        {
            memcpy( bits, src_ptr, min( count, dst_stride ) );
            src_ptr += src_stride;
            bits = (char *)bits + dst_stride;
            count -= dst_stride;
        }
        if (src_bits.free) src_bits.free( &src_bits );
    }
    else ret = 0;

done:
    GDI_ReleaseObj( hbitmap );
    return ret;
}
开发者ID:MortenRoenne,项目名称:wine,代码行数:67,代码来源:bitmap.c



注:本文中的GDI_GetObjPtr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GDI_ReleaseObj函数代码示例发布时间:2022-05-30
下一篇:
C++ GDBUS_METHOD函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap