Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I am trying to draw a large image(2048x2048) on a surface using Graphics.DrawImage.

The problem that I am having is that there is no image shown on the surface.

But if I reduce the image size to 1024x1024 the image is drawn.

 

can anyone help me find a solution for this without changing the image size?

 

Thanks

  • Leaders
Posted

Wait... you are drawing to DirectX surfaces with Graphics.DrawImage?

Or did you post in the wrong section?

 

What kind of surface are you drawing to? Have you tried drawing only part of it?

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Posted

hi,

sorry for the delay. I have created a single surface on which I have to keep on drawing images. So I am using the Graphics object to do so by obtaining the DC of the surface. Is there any other way to draw the image without creating a new surface for every new bitmap.

  • Leaders
Posted

Yes... you should be able to draw a background color over the whole surface and then draw your character.

But is this DirectX or not? If not, what is the 'surface' that you are talking about.

If so, why are you using GDI+ Graphics on the surface?

 

And why do you need to create a new surface for every new bitmap? Are those bitmaps loaded directly onto the surface from file or being drawn onto the surface?

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Posted

Hi,

 

I am trying to draw a new bitmap on a DirectDraw Surface every few seconds.

I could only find in the constructor of the Surface an option to change the bitmap. So instead of creating a new surface for every new bitmap I followed this code

 

IntPtr hDC = surface.GetDc();

Graphics g = Graphics.FromHdc(hDC);

g.DrawImage(bitmap, 0, 0);

g.Dispose();

surface.ReleaseDc(hDC);

 

Any other better way to do this?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...