- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to read a bitmap file into memory and get the color of a pixel on the bitmap. I'm using Console application, and I tried all kinds of things to no avail.
Please help. It is not necessary that you see the bitmap on the screen, actually I prefer to do it all in the background.
Thanks in advance for your help.
I'm trying to read a bitmap file into memory and get the color of a pixel on the bitmap. I'm using Console application, and I tried all kinds of things to no avail.
Please help. It is not necessary that you see the bitmap on the screen, actually I prefer to do it all in the background.
Thanks in advance for your help.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Take a look at my XFTGDI module. Briefly, you should:
- XCreateBitmap to load a bitmap from file;
- XMemoryDC to create a DC (canvas in memory) for it;
- XPlaceBitmap to place the bitmap onto the DC;
- XGetPixel to retrieve the pixel(s)
After that you can possibly call XSetPixel to change pixels, XGetBitmap to take the modified bitmap back and XSaveBitmap to save it. Don't forget to XDeleteDC when done.
Currently I didn't provide possibility to convert entire bitmap into a matrix of integers (which is far more efficient method); it's in plans.
- XCreateBitmap to load a bitmap from file;
- XMemoryDC to create a DC (canvas in memory) for it;
- XPlaceBitmap to place the bitmap onto the DC;
- XGetPixel to retrieve the pixel(s)
After that you can possibly call XSetPixel to change pixels, XGetBitmap to take the modified bitmap back and XSaveBitmap to save it. Don't forget to XDeleteDC when done.
Currently I didn't provide possibility to convert entire bitmap into a matrix of integers (which is far more efficient method); it's in plans.
![](/skins/images/06022F5BB6D2F28C8F102671A0F06E85/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page