1,075,590 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by Soubhik

I didnt know that. I thought windows would automatically convert the file

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I notice that this problem happens when I am using bmp (or I rename a bmp file to some other format). So if I draw the image and save it as png or something else, then this problem does not arise.

I guess then Image does not support bmp format.

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
import javax.swing.JPanel;
import javax.swing.ImageIcon;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.Graphics2D;

class View extends JPanel {
    Image icon1,icon2;
    public View(){
        ImageIcon i1=new ImageIcon(this.getClass().getResource("tile1.png"));//image I drew
        ImageIcon i2=new ImageIcon(this.getClass().getResource("tile2.png"));//image I downloaded
        icon1=i1.getImage();
        icon2=i2.getImage();
    }
    public void paint(Graphics g){
        super.paint(g);
        Graphics2D g2=(Graphics2D)g;

        g2.drawImage(icon1,10,10,null);//this image is not displayed
        g2.drawImage(icon2,200,200,null);//this image is displayed
        }
}

In the above code, I'm simply trying to load some images and display it in the window.

Now, I drew an image using MSPaint and saved it in bmp/png (icon1). And I downloaded another image off the internet in gif/png (icon2). The images are present in the same directory as the code.

BUT when I run the program to display the images, I see that only icon2 is being displayed. icon1 is not displayed.

Why is this so?

The drawImage() method returns a true value on success. However, for the icon1 it returns false and for icon2 it returns true.

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Thanks again.

Yes, I'll google them.

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Thanks guys. I'll see what I can learn from all this.

New questions!
a> What is static library? What is dynamic library?
b> What is the difference between c code, object code and exe file??
c> What is this linker? How does it work?
d> What does #ifndef HEADER_H statement mean? More specifically, what is HEADER_H?

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Hi

Say I want to write a header file as an exercise. It will contain a bunch of functions and some constants.

Q1. I noticed that the standard header files only contain the function prototypes.
a> Where are the actual functions?
b> How do I write a header file such that the actual functions are separately stored?
c> How are these two files connected?
d> What is the advantage of this?

Q2. How do I include this header file in my code? Just the normal #include<>?

Thanks.

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I have a question. In your question it states that t must be <1000 and N must be >=-1000 and <=1000.

Shouldn't the program check for violation of these conditions?

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Not that I wanna start off right now..! I'm learning as I go.

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Thanks myk45..

I've heard of OpenGL but always thought of it as way out of the reach of a beginner.

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

under which platform u are working ??

I'm using Code Blocks (but I also have Turbo C). I'm completely a novice when it comes to graphics. thanks for helping..

On MS-Windows use a modern compiler such as VC++ 2010 and win32 api graphics functions. c++ gives you many more options.

I'll have to learn how to use win32 api..thanks again.

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I'm interested in graphics programming. what library do I use for graphics programming in C if graphics.h is deprecated??

Soubhik
Newbie Poster
11 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
 
© 2013 DaniWeb® LLC
Page rendered in 0.0756 seconds using 2.52MB