[6505] | 1 | /* $Id: iPictureBmp.cpp,v 1.1 2001-08-10 19:24:40 sandervl Exp $ */
|
---|
| 2 | /*
|
---|
| 3 | * OLE Picture Bitmap Strategy object
|
---|
| 4 | *
|
---|
| 5 | * 20/11/99 - New Code
|
---|
| 6 | *
|
---|
| 7 | * Copyright 1999 David J. Raison
|
---|
| 8 | *
|
---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 10 | *
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #include "oleaut32.h"
|
---|
| 14 | #include "olectl.h"
|
---|
| 15 | #include "ipicture.h"
|
---|
| 16 |
|
---|
| 17 | // ======================================================================
|
---|
| 18 | // Local Methods
|
---|
| 19 | // ======================================================================
|
---|
| 20 |
|
---|
| 21 | // ----------------------------------------------------------------------
|
---|
| 22 | // Bitmap Picture
|
---|
| 23 | // ----------------------------------------------------------------------
|
---|
| 24 | IPictureBmp::~IPictureBmp()
|
---|
| 25 | {
|
---|
| 26 | if (pPicture->fOwn)
|
---|
| 27 | {
|
---|
| 28 | // Free bitmap...
|
---|
| 29 | DeleteObject(pPicture->u.bmp.hbitmap);
|
---|
| 30 | DeleteObject(pPicture->u.bmp.hpal);
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | // ----------------------------------------------------------------------
|
---|
| 35 | // IPictureBmp::get_Handle
|
---|
| 36 | // ----------------------------------------------------------------------
|
---|
| 37 | HRESULT IPictureBmp::get_Handle(OLE_HANDLE * pHandle)
|
---|
| 38 | {
|
---|
| 39 | *pHandle = pPicture->u.bmp.hbitmap;
|
---|
| 40 | return S_OK;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | // ----------------------------------------------------------------------
|
---|
| 44 | // IPictureBmp::get_hPal
|
---|
| 45 | // ----------------------------------------------------------------------
|
---|
| 46 | HRESULT IPictureBmp::get_hPal(OLE_HANDLE * phPal)
|
---|
| 47 | {
|
---|
| 48 | *phPal = pPicture->u.bmp.hpal;
|
---|
| 49 | return S_OK;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | // ----------------------------------------------------------------------
|
---|
| 53 | // IPictureBmp::get_Type
|
---|
| 54 | // ----------------------------------------------------------------------
|
---|
| 55 | HRESULT IPictureBmp::get_Type(SHORT * pType)
|
---|
| 56 | {
|
---|
| 57 | *pType = PICTYPE_BITMAP;
|
---|
| 58 | return S_OK;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | // ----------------------------------------------------------------------
|
---|
| 62 | // IPictureBmp::get_Width
|
---|
| 63 | // ----------------------------------------------------------------------
|
---|
| 64 | HRESULT IPictureBmp::get_Width(OLE_XSIZE_HIMETRIC * pWidth)
|
---|
| 65 | {
|
---|
| 66 | SIZE size;
|
---|
| 67 |
|
---|
| 68 | if (GetBitmapDimensionEx( pPicture->u.bmp.hbitmap, &size) == 0)
|
---|
| 69 | {
|
---|
| 70 | *pWidth = 0;
|
---|
| 71 | return E_FAIL;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | *pWidth = size.cx;
|
---|
| 75 |
|
---|
| 76 | return S_OK;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | // ----------------------------------------------------------------------
|
---|
| 80 | // IPictureBmp::get_Height
|
---|
| 81 | // ----------------------------------------------------------------------
|
---|
| 82 | HRESULT IPictureBmp::get_Height(OLE_YSIZE_HIMETRIC * pHeight)
|
---|
| 83 | {
|
---|
| 84 | SIZE size;
|
---|
| 85 |
|
---|
| 86 | if (GetBitmapDimensionEx( pPicture->u.bmp.hbitmap, &size) == 0)
|
---|
| 87 | {
|
---|
| 88 | *pHeight = 0;
|
---|
| 89 | return E_FAIL;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | *pHeight = size.cy;
|
---|
| 93 |
|
---|
| 94 | return S_OK;
|
---|
| 95 | }
|
---|
| 96 |
|
---|
| 97 | // ----------------------------------------------------------------------
|
---|
| 98 | // IPictureBmp::Render
|
---|
| 99 | // ----------------------------------------------------------------------
|
---|
| 100 | HRESULT IPictureBmp::Render(HDC hdc, LONG x, LONG y, LONG cx, LONG cy,
|
---|
| 101 | OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
|
---|
| 102 | OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc,
|
---|
| 103 | LPCRECT pRcWBounds)
|
---|
| 104 | {
|
---|
| 105 | return E_FAIL;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | // ----------------------------------------------------------------------
|
---|
| 109 | // IPictureBmp::set_hPal
|
---|
| 110 | // ----------------------------------------------------------------------
|
---|
| 111 | HRESULT IPictureBmp::set_hPal(OLE_HANDLE hPal)
|
---|
| 112 | {
|
---|
| 113 | pPicture->u.bmp.hpal = hPal;
|
---|
| 114 | return S_OK;
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | // ----------------------------------------------------------------------
|
---|
| 118 | // IPictureBmp::SaveAsFile
|
---|
| 119 | // ----------------------------------------------------------------------
|
---|
| 120 | HRESULT IPictureBmp::SaveAsFile(LPSTREAM pStream, BOOL fSaveMemCopy, LONG * pCbSize)
|
---|
| 121 | {
|
---|
| 122 | return E_FAIL;
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | // ----------------------------------------------------------------------
|
---|
| 126 | // IPictureBmp::get_Attributes
|
---|
| 127 | // ----------------------------------------------------------------------
|
---|
| 128 | HRESULT IPictureBmp::get_Attributes(DWORD * pDwAttr)
|
---|
| 129 | {
|
---|
| 130 | // Although bitmaps may be scaled, it is really stretching.
|
---|
| 131 | *pDwAttr = 0;
|
---|
| 132 | return S_OK;
|
---|
| 133 | }
|
---|
| 134 |
|
---|