473,385 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DrawImage draws faded image

I'm using DrawImage() to copy one image onto another, larger one. I'm using
a DrawImage() overload to stretch the source image onto the destination.
The problem is that when it draws the stretched version, it fades off on the
right--it becomes transparent. While an interesting effect, it is not what
I want; I want a verbatim copy of the source image, just bigger.

One source of the problem may be that the source image is 2 pixels wide and
I am stretching it to 20 pixles. But I have tried pre-stretching it (making
a new Image with the larger dimensions), but that doesn't work either. I
don't have any transparent colors specified.

Any ideas? TIA!
Nov 16 '05 #1
5 3118
If it's just a 2x2 bitmap to begin with, couldn't you just draw the expanded
version?
I mean it has to be either a diagonal line, L shape, filled or blank!

"Frecklefoot" <Chris_nospam@nospam_nsageotech.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I'm using DrawImage() to copy one image onto another, larger one. I'm using a DrawImage() overload to stretch the source image onto the destination.
The problem is that when it draws the stretched version, it fades off on the right--it becomes transparent. While an interesting effect, it is not what I want; I want a verbatim copy of the source image, just bigger.

One source of the problem may be that the source image is 2 pixels wide and I am stretching it to 20 pixles. But I have tried pre-stretching it (making a new Image with the larger dimensions), but that doesn't work either. I
don't have any transparent colors specified.

Any ideas? TIA!

Nov 16 '05 #2
Another thing to look at (if you really do want to expand the icon) is the
InterpolationMode property of the Graphics instance. This dictates what
strategy will be used to expand the bitmap (resampling etc.).

"Frecklefoot" <Chris_nospam@nospam_nsageotech.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I'm using DrawImage() to copy one image onto another, larger one. I'm using a DrawImage() overload to stretch the source image onto the destination.
The problem is that when it draws the stretched version, it fades off on the right--it becomes transparent. While an interesting effect, it is not what I want; I want a verbatim copy of the source image, just bigger.

One source of the problem may be that the source image is 2 pixels wide and I am stretching it to 20 pixles. But I have tried pre-stretching it (making a new Image with the larger dimensions), but that doesn't work either. I
don't have any transparent colors specified.

Any ideas? TIA!

Nov 16 '05 #3
Hi Frecklefoot,
I'm using DrawImage() to copy one image onto another, larger one. I'm using
a DrawImage() overload to stretch the source image onto the destination.
The problem is that when it draws the stretched version, it fades off on the
right--it becomes transparent. While an interesting effect, it is not what
I want; I want a verbatim copy of the source image, just bigger.

One source of the problem may be that the source image is 2 pixels wide and
I am stretching it to 20 pixles. But I have tried pre-stretching it (making
a new Image with the larger dimensions), but that doesn't work either. I
don't have any transparent colors specified.

Any ideas? TIA!


Try setting: Graphics.InterpolationMode to "NearestNeighbor"
and set PixelOffsetMode to "None" (or "HighSpeed").

I know from my practise, that DrawImage is working with strange
offset. So, i had some trouble to guess right settings of:
public void DrawImage(
Image image,
int x,
int y,
int width,
int height
)
method. So i have to use version:
public void DrawImage(
Image image,
Rectangle destRect,
Rectangle srcRect,
GraphicsUnit srcUnit
);

HTH

Marcin
Nov 16 '05 #4
Hi,
Try setting: Graphics.InterpolationMode to "NearestNeighbor"
and set PixelOffsetMode to "None" (or "HighSpeed").
and CompositingMode to "SourceCopy"
I know from my practise, that DrawImage is working with strange
offset. So, i had some trouble to guess right settings of:
public void DrawImage(
Image image,
int x,
int y,
int width,
int height
)
method. So i have to use version:
public void DrawImage(
Image image,
Rectangle destRect,
Rectangle srcRect,
GraphicsUnit srcUnit
);


HTH

Marcin
Nov 16 '05 #5
Thanks, that helped. What I needed to do was set the CompositingMode to
SourceCopy. Your tip put me on the right track. BTW, the source image is 2
pixels _wide_, but several hundred high.

TA

"John Wood" <j@ro.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...
Another thing to look at (if you really do want to expand the icon) is the
InterpolationMode property of the Graphics instance. This dictates what
strategy will be used to expand the bitmap (resampling etc.).

"Frecklefoot" <Chris_nospam@nospam_nsageotech.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I'm using DrawImage() to copy one image onto another, larger one. I'm

using
a DrawImage() overload to stretch the source image onto the destination.
The problem is that when it draws the stretched version, it fades off on

the
right--it becomes transparent. While an interesting effect, it is not

what
I want; I want a verbatim copy of the source image, just bigger.

One source of the problem may be that the source image is 2 pixels wide

and
I am stretching it to 20 pixles. But I have tried pre-stretching it

(making
a new Image with the larger dimensions), but that doesn't work either. I don't have any transparent colors specified.

Any ideas? TIA!


Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: bbxrider | last post by:
there is some property that i think is mostly used for images used as backrounds that fades them, so you can get the idea of the image but not have it obscuring the text thats on it, its not...
3
by: Jeroen Ceuppens | last post by:
Hi, When i do this in my programma, in the contstructor of the form: g.DrawImage(i,new Rectangle(0,0,i.Width,i.Height),0,0,i.Width,i.Height,GraphicsUnit.Pixel); it doens't paint it ;( but if...
1
by: Ivan | last post by:
Hi there I'm trying to use BitBlt function instead od DrawImage beacuse I need speed in my app. I have one Bitmap (bmp) that is loaded from file and I use it in OnPaint for drawing. Currently I...
1
by: Ajay | last post by:
Hello Guys, Iam working on a zoom in and out tool and here is the code iam using for it //Method for zooming in Bitmap bmpSource=new Bitmap(ImgBox.Image); Bitmap bmpZoomed=new...
0
by: Lev Elbert | last post by:
Using DrawImage I draw (in OnPaint) a bitmap on a form protected override void OnPaint(PaintEventArgs e) { if (_album.Count 0) { // Paint the current image Photograph photo =...
6
by: Lev Elbert | last post by:
Using DrawImage I draw (in OnPaint) a bitmap on a form protected override void OnPaint(PaintEventArgs e) { if (_album.Count 0) { // Paint the current image Photograph photo =...
2
by: kirkage | last post by:
I am attempting to create a program in C# which part of it consists of one image fading to another. The best way I found this to work is from an example by Bob Powell on the thread...
2
by: blkcygnus | last post by:
im trying to learn simple image processing-but i cant even get the thing to draw onscreen! heres the code import java.awt.*; import java.awt.geom.*; import java.awt.image.*; import...
8
by: Phil | last post by:
Is it possible to find the size of the MDIClient area, excluding the space already used by docked controls? I have thought I could perhaps create a new control, set it's Dock property to Fill and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.