Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  java2d drawImage confusion  (Read 724 times)
0 Members and 1 Guest are viewing this topic.
Offline zidsal

Senior Newbie





« Posted 2013-12-18 23:48:37 »

In my program I am drawing an image with

1  
g.drawImage(image, 32, 32,  96  , 96, 11, 0, 13, 2, null);


I would expect this to start drawing the part of the image specified at {11,0}, {13,2} in the location in my program at {32,32} and finish at {96,96} however it does not! the srcx and srcy results act normally and they do grab the image that they need to. However something is going wrong with the dcx and the dcy parameters

http://i.imgur.com/gw0qVAO.png

as we can clearly see for a start the image is 32 by 32 (I would expect a 64 by 64 square) and it is definitely not  being drawn from {32,32}  {96,96} can someone shed some light on whats going wrong?
Offline CodeHead

JGO Knight


Medals: 52


From rags to riches...to rags.


« Reply #1 - Posted 2013-12-19 02:05:52 »

as we can clearly see for a start the image is 32 by 32 (I would expect a 64 by 64 square) and it is definitely not  being drawn from {32,32}  {96,96} can someone shed some light on whats going wrong?

According to your posted code, your source area is only 3px x 3px {11,0}->{13,2}. Are you sure you're grabbing the entire area that you think you are? Other than that, the code seems like it's correct.

Arthur: Are all men from the future loud-mouthed braggarts?
Ash: Nope. Just me baby...Just me.
Pages: [1]
  ignore  |  Print  
 
 

 
hadezbladez (349 views)
2018-11-16 13:46:03

hadezbladez (181 views)
2018-11-16 13:41:33

hadezbladez (348 views)
2018-11-16 13:35:35

hadezbladez (84 views)
2018-11-16 13:32:03

EgonOlsen (2177 views)
2018-06-10 19:43:48

EgonOlsen (2206 views)
2018-06-10 19:43:44

EgonOlsen (1378 views)
2018-06-10 19:43:20

DesertCoockie (2011 views)
2018-05-13 18:23:11

nelsongames (1655 views)
2018-04-24 18:15:36

nelsongames (2300 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!