Direct access to CF image

E

Erik

Hi,

I'm new in CF.NET thus sorry in advance for my stupid question.

In .NET framework I used to work with the LockBits to get access to a
pointer of the first pixel but have found that this method does not
exist in CF space. How it can be?

By the way, I was trying to use SetPixels/GetPixels but found that this
method is really-really slow.

Any suggestions, thoughts, ideas to this topic?

Erik
 
S

Sergey Bogdanov

Hi,

First of all I recommend you to read Alex Feinman's article "Gaining
Access to the Graphic Object Internals in .NET Compact Framework" [1].

Once you got hMemoryDC/hBitmap variables of CF Bitmap (notice that CF
bitmap is Device Dependant Bitmap and may vary in different devices) you
can create Device-Independent Bitmap (DIB) with the same size. From DIB
bitmap you should get a pointer to bits section - use it for offscreen
drawing. At the end of drawing call BitBlt P/Invoke to copy a Bitmap
from offscreen to CF Bitmap Device Content (DC).

To summarize all these steps I have created for you a sample which
demonstrates how to rotate an image on 360-degree. [2]

PS:
The .NET Compact Framework version 2.0 provides support for the
LockBits method but Bitmap is still DDB.

[1]
http://www.opennetcf.org/PermaLink.aspx?guid=fd194f13-d816-463e-ac95-a467a6293f0b
[2]
http://www.sergeybogdanov.com/Samples/PictureRotating.zip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top