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! 5 3135
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!
"Frecklefoo t" <Chris_nospam@n ospam_nsageotec h.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.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!
Another thing to look at (if you really do want to expand the icon) is the
InterpolationMo de property of the Graphics instance. This dictates what
strategy will be used to expand the bitmap (resampling etc.).
"Frecklefoo t" <Chris_nospam@n ospam_nsageotec h.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.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!
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.Interp olationMode to "NearestNeighbo r"
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
Hi, Try setting: Graphics.Interp olationMode to "NearestNeighbo r" 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
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******** ******@TK2MSFTN GP12.phx.gbl... Another thing to look at (if you really do want to expand the icon) is the InterpolationMo de property of the Graphics instance. This dictates what strategy will be used to expand the bitmap (resampling etc.).
"Frecklefoo t" <Chris_nospam@n ospam_nsageotec h.com> wrote in message news:%2******** ********@TK2MSF TNGP12.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!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 trasparency
i have been going nuts trying to find it, i'm sure i've seen it
described somewhere on the w3c site but embarrassed to say can't find it...
|
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 I make a button with the same, after the click
it paints it, why the problem, i can't get out of it.........
|
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 use this code, but it does not work (it
draws only black). What am I missing ?!
public int LoadImage (string strFileName)
{
// load bitmap
|
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
Bitmap(bmpSource.Width*ZoomInFactor,bmpSource.Height*ZoomInFactor);
Graphics grZoom=Graphics.FromImage(bmpZoomed);
|
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 = _album.CurrentPhoto;
Graphics g = e.Graphics;
......
| |
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 = _album.CurrentPhoto;
Graphics g = e.Graphics;
......
|
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 http://www.thescripts.com/forum/thread106125.html.
The issue is the performance of this code. A simple program that fades two images at 1280x1024 takes ~100% CPU....
|
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 javax.swing.*;
public class imagemanip
|
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 see how big that is, but there must be a better way. I would
have to do this in the Resize event
TIA
Phil.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |