Board index » cppbuilder » Re: GDI+

Re: GDI+


2006-04-19 06:26:30 AM
cppbuilder35
Quote
Gdiplus::Image image(L"your_image.jpg");
Gdiplus::Graphics graphics(&image);
Looks like you declared the object 'graphics' with 'image' as the parameter
instead of a Windows handle such as 'Canvas->Handle'. How can you see the
image now?
 
 

Re:Re: GDI+

smartdude80 wrote:
Quote
Looks like you declared the object 'graphics' with 'image' as the parameter
instead of a Windows handle such as 'Canvas->Handle'.
Yes, I used one of the constructors of the Graphics object.
Quote
How can you see the
image now?
To show the image on the screen, you need a Graphic object and associate
it with the screen device context. That's what you do when passing a
Canvas->handle to the constructor. So in this case, you need two
Graphics object. One associated with the screen and othe other
associated with the image.
You asked how to do it without using a bitmap. I showed you one way but
usually the image is drawn on a bitmap and then the bitmap is drawn on
the screen.
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
www.leunen.com/
----------------------------------------
 

Re:Re: GDI+

Quote
To show the image on the screen, you need a Graphic object and associate
it with the screen device context. That's what you do when passing a
Canvas->handle to the constructor. So in this case, you need two Graphics
object. One associated with the screen and othe other associated with the
image.
You asked how to do it without using a bitmap. I showed you one way but
usually the image is drawn on a bitmap and then the bitmap is drawn on the
screen.

Michel
--
Im starting to get it now. I also found out that Bitmap and Image
objects are compatable so i can use Bitmap instead (that way you get to
access screen memory with lockbits(), unlockbits() which may be usefull down
the road)
Im reading a bcb journal article on GDI+. Its in
bcbjournal.org/bcbj_vol8_num6.pdf. its got good information but his
aproach is a little different. He's got some sort of error checking system
(and other things)but can't get any more information about it.
 

{smallsort}

Re:Re: GDI+

How can i make a RASTER opération like XOR in GDI+.
Because with GDI we can use Set_ROP2(..) function.
I would like to draw a {*word*221} band rectangle.
Thanks.
 

Re:Re: GDI+

hello all
i have added gdiplus.lib to my project, defined STRICT etc., the project
compiles. ok
then i include gdiplus.h in the project source and add initialization in the
winmain, the project compiles. ok
then i include gdiplus.h in any form unit, the project compiles. ok
now i add a new empty unit (not form), and in the header i add vcl.h
followed by gdiplus.h
result : tons of compile errors in the gdi+ headers, firsts being errors
E2075 on incorrect project options redefinitions
more and worst : removing this cpp unit from the project, so returning to
the last compilable state, it dont compile any more ! still same errors !
what's bad ? i m sure it s a stupid trick but i cant get it
s.py