Re: Image display
"jlchappell" <[email protected]> Mon, 05 Aug 2002 13:37:53 -0000
| Newsgroups | gmane.comp.video.image-magick.windows |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the code, I can't wait to try it! Unfortunately, when I
put it into my code, I get a new set of problems:
(1) getConstPixels caused an exception, indicating that the
cache_info->type==Undefined Cache, with the message "Pixel cache is
not open". Any idea what this means, and how I can fix it? Am I
supposed to call OpenCache directly?
(2) It's strange that the ImageMagick exception class seems to get
corrupted. When it generates the exception, the message gets
corrupted at exception.cpp:192, and the 'message' variable contains
garbage. At line 191 it's fine. Any ideas?
Thanks!
Jerry
--- In imagemagick@y..., "Augusto_Roman" <Augusto_Roman@b...> wrote:
> --- In imagemagick@y..., "jlchappell" <jlchappell@y...> wrote:
> > I find that the example method of displaying an image in the NT
> > program that's supplied is rather slow. Does anyone have a fast
way
> > of displaying a changing image?
> >
> > Jerry
>
> I use the following, and it's reasonably fast:
> (fast enough for a document manipulation program, not games/video)
>
> if (m_Image_isValid) // I keep track of this myself
> {
> // Get the image dimensions and a pointer to the pixels
> const Geometry& imsz = m_Image.size();
> const PixelPacket* ppix = m_Image.getConstPixels( 0 , 0 ,
> imsz.width() , imsz.height() );
>
> // Construct a BITMAPINFO object that describes the
> // pointer to the pixels
> BITMAPINFO bmi;
> bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
> bmi.bmiHeader.biWidth = imsz.width();
> bmi.bmiHeader.biHeight = -imsz.height();
> bmi.bmiHeader.biPlanes = 1;
> bmi.bmiHeader.biBitCount = 32;
> bmi.bmiHeader.biCompression = BI_RGB;
> bmi.bmiHeader.biSizeImage = 0;
> bmi.bmiHeader.biXPelsPerMeter = 1;
> bmi.bmiHeader.biYPelsPerMeter = 1;
> bmi.bmiHeader.biClrUsed = 0;
> bmi.bmiHeader.biClrImportant = 0;
> // bmi.bmiColors is unused
>
> // Get the client window size
> // (because I want to fill the whole client area)
> CRect win;
> GetClientRect(win);
>
> // Set fast and color-friendly stretch mode
> ::SetStretchBltMode( *pDC, COLORONCOLOR );
> ::StretchDIBits( *pDC,
> 0,0,win.Width(),win.Height(), // target rect
> (x,y,w,h)
> 0,0,imsz.width(),imsz.height(), // rect within
> source image (x,y,w,h)
> ppix,&bmi,DIB_RGB_COLORS,SRCCOPY);
> }
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/