drawableD2D on Pictures

I had this stored in my snip manager, I cannot find the original post so pasting it here bellow. So what is this about new drawableD2D type ? I cannot find anything about it in the Plugin SDK. Only the pictureWin32DIB and pictureWin32Bitmap. Or am I misunderstanding something ?

@Björn Eiríksson: So if I understand this correctly then I would access the Raw Data of the new pictures with alpha channel in same way as the old non Alpha channel pictures ? (I mean its same data type ?)

@William Yu 1: Exactly, we now actually populate the alpha byte for drawableWin32Bitmap and drawableWin32DIB when dealing with alpha channel pictures. However, if you’re concerned about speed and efficiency I would recommend using the new drawableD2D type. You get a raw pointer to the Premultiplied BGRA bytes in that case.

Sorry Björn we forgot to update the SDK for this. Thanks for the reminder, we’ll get this remedied. However, if you wanted to get started you could modify the enum in REALplugin.h

// picture types and description
enum {
	pictureNSImage,		// forgot to add
	pictureDrawableD2D	// forgot to add

No problem, thanks for adding those.

OK so if its pictureDrawableD2D, then its what structure exactly that I am getting ?

Googling DrawableD2D gives me nothing at all except our posts here on Xojo forums.


We’ll likely be adding two additional D2D types, but for that particular one it’ll be the raw pointer to the pre-multiplied BGRA bytes that you can manipulate directly.

So just char* ??

With row size same as the width of the Image * 4 ?


[quote]So just char* ??

With row size same as the width of the Image * 4 ?[/quote]

Yes to both questions.

Well, having the pictureDrawableD2D as just a byte pointer is okay and seems to work.
Of course having access to the underlaying object per platform is helpful, so we can retain it and keep a reference ourselves.

What are the other 2 enums and their meaning?

About forgotten stuff…

GDI+ description in http://developer.xojo.com/picture
GDI+ description also in http://developer.xojo.com/graphics

GDI+ also appears in the file: Xojo Documentation.pdf

Well, GDI+ is deprecated, so well, no longer of real interest.