Home COM GDI+ WebBrowser Data Access

IPicture Interface

 

IID_IPicture

{7BF80980-BF32-101A-8BBB-00AA00300CAB}

 

 

The IPicture interface manages a picture object and its properties. Picture objects provide a language-neutral abstraction for bitmaps, icons, and metafiles. As with the standard font object, the system provides a standard implementation of the picture object. Its primary interfaces are IPicture and IPictureDisp, the latter being derived from IDispatch to provide access to the picture's properties through Automation. A picture object is created with OleCreatePictureIndirect.

 

The picture object also supports the outgoing interface IPropertyNotifySink, so a client can determine when picture properties change. Since the picture object supports at least one outgoing interface, it also implements IConnectionPointContainer and its associated interfaces for this purpose.

 

The picture object also supports IPersistStream so it can save and load itself from an instance of IStream. An object that uses a picture object internally would normally save and load the picture as part of the object's own persistence handling. The function OleLoadPicture simplifies the creation of a picture object based on stream contents.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IPicture Methods

Description

get_Handle

Returns the Windows GDI handle of the picture managed within this picture object.

get_hPal

Returns a copy of the palette currently used by the picture object.

get_Type

Returns the current type of the picture.

get_Width

Returns the current width of the picture in the picture object.

get_Height

Returns the current height of the picture in the picture object.

Render

Draws the specified portion of the picture onto the specified device context, positioned at the specified location.

set_hPal

Sets the current palette of the picture.

get_CurDC

Returns the current device context into which this picture is selected.

SelectPicture

Selects a bitmap picture into a given device context, returning the device context in which the picture was previously selected as well as the picture's GDI handle.

get_KeepOriginalFormat

Returns the current value of the picture object's KeepOriginalFormat property.

put_KeepOriginalFormat

Sets the picture object's KeepOriginalFormat property.

PictureChanged

Notifies the picture object that its picture resource changed.

SaveAsFile

Saves the picture's data into a stream in the same format that it would save itself into a file.

get_Attributes

Returns the current set of the picture's bit attributes.

 

GetHandle

 

FUNCTION IPicture_GetHandle ( _

  BYVAL pthis AS DWORD PTR _

, BYREF phandle AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[3] USING IPicture_GetHandle (pthis, phandle) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GethPal

 

FUNCTION IPicture_GethPal ( _

  BYVAL pthis AS DWORD PTR _

, BYREF phpal AS DWORD _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[4] USING IPicture_GethPal (pthis, phpal) TO HRESULT
  FUNCTION = HRESULT

 

END FUNCTION

 

 

GetType

 

FUNCTION IPicture_GetType ( _

  BYVAL pthis AS DWORD PTR _

, BYREF ptype AS INTEGER _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[5] USING IPicture_GetType (pthis, ptype) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetWidth

 

FUNCTION IPicture_GetWidth ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pwidth AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[6] USING IPicture_GetWidth (pthis, pwidth) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetHeight

 

FUNCTION IPicture_GetHeight ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pheight AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[7] USING IPicture_GetHeight (pthis, pheight) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Render

 

FUNCTION IPicture_Render ( _

  BYVAL pthis AS DWORD PTR, _

  BYVAL hdc AS LONG, _

  BYVAL x AS LONG, _

  BYVAL y AS LONG, _

  BYVAL cx AS LONG, _

  BYVAL cy AS LONG, _
  BYVAL xSrc AS LONG, _

  BYVAL ySrc AS LONG, _

  BYVAL cxSrc AS LONG, _

  BYVAL cySrc AS LONG, _

  BYREF prcWBounds AS RECT _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[8] USING IPicture_Render (pthis, hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, prcWBounds) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

SethPal

 

FUNCTION IPicture_SethPal ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL phpal AS DWORD _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[9] USING IPicture_SethPal (pthis, phpal) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetCurDC

 

FUNCTION IPicture_GetCurDC ( _

  BYVAL pthis AS DWORD PTR _

, BYREF phdcOut AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[10] USING IPicture_GetCurDC (pthis, phdcOut) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

SelectPicture

 

FUNCTION IPicture_SelectPicture ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL hdcIn AS LONG _

, BYREF phdcOut AS LONG _

, BYREF phbmpOut AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[11] USING IPicture_SelectPicture (pthis, hdcIn, phdcOut, phbmpOut) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetKeepOriginalPicture

 

FUNCTION IPicture_GetKeepOriginalFormat ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pfkeep AS INTEGER _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[12] USING IPicture_GetKeepOriginalFormat (pthis, pfkeep) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

SetKeepOriginalPicture

 

FUNCTION IPicture_SetKeepOriginalFormat ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pfkeep AS INTEGER _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[13] USING IPicture_SetKeepOriginalFormat (pthis, pfkeep) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

PictureChanged

 

FUNCTION IPicture_PictureChanged ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[14] USING IPicture_PictureChanged (pthis) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

SaveAsFile

 

FUNCTION IPicture_SaveAsFile ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pstm AS DWORD PTR _

, BYVAL fSaveMemCopy AS INTEGER _

, BYREF pcbSize AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[15] USING IPicture_SaveAsFile (pthis, pstm, fSaveMemCopy, pcbSize) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetAttributes

 

FUNCTION IPicture_GetAttributes ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pdwAttr AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[16] USING IPicture_GetAttributes (pthis, pdwAttr) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

IPictureDisp

 

The IPictureDisp interface exposes the picture object's properties through Automation. It provides a subset of the functionality available through IPicture methods.

 

The dispIDs for the various picture properties are the following:

 

DISPID_PICT_HANDLE = 0

DISPID_PICT_HPAL = 2

DISPID_PICT_TYPE = 3

DISPID_PICT_WIDTH = 4

DISPID_PICT_HEIGHT = 5

DISPID_PICT_RENDER = 6

 

Each property in the IPictureDisp interface includes a get_PropertyName method if the property supports read access and a put_PropertyName method if the property supports write access. Most of the properties support read access only with the exception of the hPal property.

 

Property

Type

Access Allowed

Description

Handle

Long

R

The Windows GDI handle of the picture

hPal

Long

RW

The Windows handle of the palette used by the picture

Type

Integer

R

The type of picture

Width

Long

R

The width of the picture

 

CreatePictureIndirect

 

FUNCTION IPicture_CreatePictureIndirect ( _

  BYVAL hPicHandle AS DWORD _

, BYVAL picType AS DWORD _

, BYVAL fOwn AS INTEGER _

, BYREF ppPicture AS DWORD _

  ) AS LONG

  LOCAL udtPictDesc AS PICTDESC
  LOCAL riid AS GUID

  ' Use IUnknown to create an IPicture object that can be

  ' manipulated using the IPicture interface

  riid = GUID$("{00000000-0000-0000-c000-000000000046}")

  ' Use IDispatch to create an IPictureDisp object

  ' that can be manipulated using Automation (Invoke)
'  riid = GUID$("{00020400-0000-0000-c000-000000000046}")
 

  IF ISFALSE hPicHandle THEN FUNCTION = %E_POINTER : EXIT FUNCTION

  SELECT CASE picType
     CASE %PICTYPE_BITMAP ' Bitmap
        udtPictDesc.pd.tbmp.hbitmap = hPicHandle
     CASE %PICTYPE_ICON ' Icon
        udtPictDesc.pd.hicon = hPicHandle
     CASE ELSE
        FUNCTION = %E_INVALIDARG
     EXIT FUNCTION
  END SELECT


  udtPictDesc.cbSizeOfStruct = SIZEOF(PICTDESC)
  udtPictDesc.picType = picType
  IF ISTRUE fOwn THEN fOwn = -1
  FUNCTION = OleCreatePictureIndirect (udtPictDesc, riid, fOwn, ppPicture)


END FUNCTION

 

 

Page last updated on Tuesday, 16 May 2006 02:11:47 +0200