I'm here to discuss a topic about a C++ alternative to Java's AWT Canvas object.
In Java Canvas, one can obtain a Graphics2D object that draws BufferedImages to the screen from BufferStrategy. For each BufferedImages, one can edit/modify/rasterize the data buffers by modifying the data values, which when drawn to the screen by the Graphics2D object, it will show up the modified data values, or pixels. Each pixel contains many different data value types, depending on how the BufferedImage is created. For example, alpha values and RGB values can be modified altogether by rasterizing the BufferedImages.
In C++, the first thing I see is that in Win32 API, there's a function called SetPixel(). However, I can't seem to find where I can change/modify the alpha value of the pixels themselves. The COLORREF reference shows that the high order byte values must be zero, therefore one can only modify the RGB values, but not the alpha values, since they don't exist. However, there are other methods available. It's just not possible to do it at a much higher level of simplicity.
In Java, one can simply load a BufferedImage by using the core library's ImageIO static methods. This is really simple to use.
In each of the cases, Java's Canvas and Win32 API functions similarly, and they are both known to be slow.
So, you got any C++ alternatives for Java's Canvas?
Edited by tom_mai78101, 20 December 2013 - 08:37 PM.