Re: Why CreateCompatibleDC and CreateCompatibleBitmap?
"mmartinsson123" <[email protected]>
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], "hawkgao" <hawkgao@...> wrote: > > I've study windows programming 8 years ago. but, i even don't understand why windows need CreateCompatibleDC and CreateCompatibleBitmap, when drawing some thing on view. what is the "compatible" real meaning here? why windows cannot draw directly on device? > > Thanks, > -Hawk > Because Windows has support for multiple Device Descriptors. And the selection von the specific DC with properties is routed directly to the GDI-User mode driver and then to the Video Port Api to the specific Grafic Card Driver. Your question would be self answered, when you already have used Direct-Draw or DirectX. You always need to select the properly Pixel Descriptor which some kind of a Device Descriptor, just the higher abstraction of it. Short: GDI is just a thin wrapper/interface to the Video Port Api, which is the abstarction layer to the grafic card driver. Every Grafic Card Driver needs to know on Pixel Stride/Format you working on etc. for every operation you are doing. On Windows you Draw with 8 Bit Bmps, or 16 Bit or 32 Bit etc. Which is what a device context is all about: to hold information for the underlying Grafic-Sub System to work properly. With Device contexts you are able to convert between them, you can use many of them in parallel on the same hardware. That's nice. Cheers Martin ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wtl/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/wtl/join (Yahoo! ID required) <*> To change settings via email: mailto:[email protected] mailto:[email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/