Is GDI able to write in compressed form?

Hi frineds,
I have written a mirror driver which is working fine but I am looking for
any option through which I can ask GDI to write into device surface in some
compressed form.

Any pointer/suggestions/links will help a lot here.

/sarbojit

Sarbojit Sarkar wrote:

Hi frineds,
I have written a mirror driver which is working fine but I am
looking for any option through which I can ask GDI to write into
device surface in some compressed form.

GDI only understands the standard DIB formats – straight RGB. If you
want compression, you have to do the compression. Also, a GDI surface
needs to be reversible – if I write something, I need to be able to
read it back exactly the same. That eliminates JPEG, for example.

What kind of compression were you hoping to find?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi Tim,
Actually I have seen at application level there is a flag
“BitmapInfo.bmiHeader.biCompression” in BitmapInfo structure for
compression(e.g. BI_RGB,BI_RLE8, BI_JPEG,…) but I could not find out
something similar in driver level. So I was asking.
BTW, any loss less compression will do for me. I was thinking if I can do it
at driver level rather doing it at application level. Please let me know if
it is not advisable or you could foresee any issue. My whole intension is to
minimize data size without much compromising with quality.

/sarbojit

On Thu, Oct 21, 2010 at 10:38 PM, Tim Roberts wrote:

> Sarbojit Sarkar wrote:
> > Hi frineds,
> > I have written a mirror driver which is working fine but I am
> > looking for any option through which I can ask GDI to write into
> > device surface in some compressed form.
>
> GDI only understands the standard DIB formats – straight RGB. If you
> want compression, you have to do the compression. Also, a GDI surface
> needs to be reversible – if I write something, I need to be able to
> read it back exactly the same. That eliminates JPEG, for example.
>
> What kind of compression were you hoping to find?
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Sarbojit Sarkar wrote:

Actually I have seen at application level there is a flag
“BitmapInfo.bmiHeader.biCompression” in BitmapInfo structure for
compression(e.g. BI_RGB,BI_RLE8, BI_JPEG,…) but I could not find
out something similar in driver level. So I was asking.

No. The GDI DIB routines are able to convert bewteen the RLE formats
and RGB, but that’s it. You can’t draw on an RLE bitmap.

BTW, any loss less compression will do for me. I was thinking if I can
do it at driver level rather doing it at application level. Please let
me know if it is not advisable or you could foresee any issue. My
whole intension is to minimize data size without much compromising
with quality.

This is a false optimization. Consider, for example, the difficult in
doing any drawing. You will have to uncompress the region to be read or
written, then do the drawing, then recompress it again. Unless you
choose an algorithm with a fixed compression ratio, you won’t know
whether the size of that region will change.

Compressed formats are like XML. They are great for exchanging data.
They suck as a way of STORING data.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.