Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Accessing of Canvas of DC as DIB
This is Madhu Sudhan Reddy. I am loading the bitmap using TImage into the memory. Let the bitmap size is 1000*1000 and TImage width and height are 500*500. while displaying the image (loaded bitmap) to the TImage some of the bitmap only can appear because of insufficient TImage width and height. Now I want the displayed area (500*500) of the TImage as a DIB. Is there any way to get the canvas pixels as DIB.
My main problem is that, on the image I want to draw some selections (as in photoshop) like rectangles, lines, lasso etc.,. Using the DIB of the image I am changing the image data later I am stretching image to the TIMage and forcing to repaint. Since I directly changed the image data for drawing selections, while "Zooming In" my selections also doubling along with Image, because image actual data only is used to "zoom in" the image.
For every zoom operation (+ or -), first TImage prepares the data to be stretched to the TImage display window from the actual image data. After preparing the data to be stretched and before stretching to the window, if I get this memory as a DIB I can modify this memory according to my selections data(rectangle, line, lasso, etc.). Here we are not changing the actual image memory and we are modifying the stretchable memory. By doing some correlate calculations I write my selections data to the stretchable memory so no doubling of my selections data.
Is there any way to access the stretchable memory as a DIB. And when we can know that the window is going to refresh.
Madhu Sudhan Reddy