Switch from Magick 6 --> Magick 7 with problems
Posted: 2017-08-18T16:15:37-07:00
Hi All,
I would have a question on you.
I switched from Magick 6 to Magick 7 and I have a problem: when I try to display an image I see a broken image (random pixels) and I think that is something related to Quantum type - when I use PixelPacket everything is fine, but when I use Quantum I get that problem.
I use VC++ 2013, Win7, 32bit
This is the code:
This code works perfect when I use PixelPacket (and Magick 6), but it doesn't when I use Quantum (and Magick 7).
Some more details:
When I created the VC++ project, I had to use a configuration tool where I had to state the quantum depth. When I create a Q8 quantum depth project, the image contained a lot of random red pixels, also, when I created a Q16 quantum depth project I get a lot of random green pixels, and when I created a Q32 or Q64 quantum depth project, I get again a lot of random red pixels.
Do you have any idea what could be wrong?
Many thanks,
Mihail.
I would have a question on you.
I switched from Magick 6 to Magick 7 and I have a problem: when I try to display an image I see a broken image (random pixels) and I think that is something related to Quantum type - when I use PixelPacket everything is fine, but when I use Quantum I get that problem.
I use VC++ 2013, Win7, 32bit
This is the code:
Code: Select all
BITMAPINFOHEADER bmi;
bmi.biSize = sizeof(BITMAPINFOHEADER); // Size of structure
bmi.biWidth = pDoc->image.columns(); // Bitmaps width in pixels
bmi.biHeight = (-1)*pDoc->image.rows(); // Bitmaps height n pixels
bmi.biPlanes = 1; // Number of planes in the image
bmi.biBitCount = 32; // The number of bits per pixel
bmi.biCompression = BI_RGB; // The type of compression used
bmi.biSizeImage = 0; // The size of the image in bytes
bmi.biXPelsPerMeter = 0; // Horizontal resolution
bmi.biYPelsPerMeter = 0; // Veritical resolution
bmi.biClrUsed = 0; // Number of colors actually used
bmi.biClrImportant = 0; // Colors most important
InitializeMagick(NULL);
//PixelPacket *pPixels = pDoc->image.getPixels(0, 0, pDoc->image.columns(), pDoc->image.rows()); // From Magick 6
MagickCore::Quantum *pPixels = pDoc->image.getPixels(0, 0, pDoc->image.columns(), pDoc->image.rows());
StretchDIBits(pDC->m_hDC,
m_ptImagePos.x,
m_ptImagePos.y,
pDoc->image.columns(),
pDoc->image.rows(),
0,
0,
pDoc->image.columns(),
pDoc->image.rows(),
pPixels,
(BITMAPINFO *)&bmi,
DIB_RGB_COLORS,
SRCCOPY);
Some more details:
When I created the VC++ project, I had to use a configuration tool where I had to state the quantum depth. When I create a Q8 quantum depth project, the image contained a lot of random red pixels, also, when I created a Q16 quantum depth project I get a lot of random green pixels, and when I created a Q32 or Q64 quantum depth project, I get again a lot of random red pixels.
Do you have any idea what could be wrong?
Many thanks,
Mihail.