PatBlt or CopyImage help...please? 
Author Message
 PatBlt or CopyImage help...please?

PatBlt() I've never used, but here's a code snippet I have used to convert
a color picture to monochrome.  As written, it takes a colored image from
picture1 and blits a black and white copy to picture2 on form1.

  btmp = CreateBitmap(Form1.Picture1.ScaleWidth,
Form1.Picture1.ScaleHeight, 1, 1, 0&)
  chdc = CreateCompatibleDC(Form1.Picture1.hDC)
  x = SelectObject(chdc, btmp)
  l = BitBlt(chdc, 0, 0, Form1.Picture1.ScaleWidth,
Form1.Picture1.ScaleHeight, Form1.Picture1.hDC, 0, 0, SRCCOPY)
  l = BitBlt(Form1!Picture2.hDC, 0, 0, Form1.Picture1.ScaleWidth,
Form1.Picture1.ScaleHeight, chdc, 0, 0, SRCCOPY)
  Form1.Picture2.Refresh
  btmp = SelectObject(chdc, x)
  k = DeleteObject(btmp)
  retval = DeleteDC(chdc)

Jim Deutch



Quote:
> Help!

> I would like to take a picturebox and convert the image to a monochrome
> image on another picturebox.  I read that the CopyImage API may be able
to
> do this but I could not get it to work.  I would also like to take a
> picturebox image and overlay a pattern on it or invert the image.  I
think
> the PatBlt API will do it but I can't get this working either!

> If anyone has any examples please reply or email.

> Thanks in advance,
> Sam



Fri, 29 Oct 1999 03:00:00 GMT  
 PatBlt or CopyImage help...please?

Thanks I'll give it a try.



Quote:
> PatBlt() I've never used, but here's a code snippet I have used to
convert
> a color picture to monochrome.  As written, it takes a colored image from
> picture1 and blits a black and white copy to picture2 on form1.

>   btmp = CreateBitmap(Form1.Picture1.ScaleWidth,
> Form1.Picture1.ScaleHeight, 1, 1, 0&)
>   chdc = CreateCompatibleDC(Form1.Picture1.hDC)
>   x = SelectObject(chdc, btmp)
>   l = BitBlt(chdc, 0, 0, Form1.Picture1.ScaleWidth,
> Form1.Picture1.ScaleHeight, Form1.Picture1.hDC, 0, 0, SRCCOPY)
>   l = BitBlt(Form1!Picture2.hDC, 0, 0, Form1.Picture1.ScaleWidth,
> Form1.Picture1.ScaleHeight, chdc, 0, 0, SRCCOPY)
>   Form1.Picture2.Refresh
>   btmp = SelectObject(chdc, x)
>   k = DeleteObject(btmp)
>   retval = DeleteDC(chdc)

> Jim Deutch

Sam


Fri, 29 Oct 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

2. Can anyone HELP me PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE

3. PLEASE HELP PLEASE HELP PLEASE HELP

4. Constants of CopyImage?

5. Constants of CopyImage?

6. PatBlt problems

7. PatBlt with a memory DC?

8. How to use CopyImage function?

9. PatBlt and the Win95 ShutDown Mask

10. PatBlt or FillRrect not working!

11. PatBlt Problems

12. CopyImage& API

 

 
Powered by phpBB® Forum Software