Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (799)
Games in Android Showcase (237)
games submitted by our members
Games in WIP (865)
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  
  Solved Android Bitmap  (Read 1701 times)
0 Members and 1 Guest are viewing this topic.
Offline roseslayer

Senior Devvie


Medals: 12



« Posted 2014-10-21 18:54:54 »

I've a weird problem, which I don't know how to solve, as this website, doesn't give any information about it. So that is why I came here to ask you guys ^w^

Now my problem is that Bitmap is throwing an error in my face..

(Note: all the bmps are the same)
1  
bmpImage = Bitmap.createBitmap(bmp, 0, 0, 11, 11);

^This line works

1  
bmpImage = Bitmap.createBitmap(bmp, 0, 0, 22, 11);

^This line works

1  
bmpImage = Bitmap.createBitmap(bmp, 11, 0, 22, 11);

^This line throws an error:

1  
10-21 20:53:29.486: E/AndroidRuntime(27566): java.lang.IllegalArgumentException: x + width must be <= bitmap.width()


But the bitmap.getWidth() = 22 and the bitmap.getHeight() = 11 (as you can see from line 2, that is working..)
So basically I don't know what's really wrong about this line of code..

[Edit:] This topic should be in the android fora  Lips Sealed
Offline Grunnt

JGO Kernel


Medals: 143
Projects: 8
Exp: 5 years


Complex != complicated


« Reply #1 - Posted 2014-10-21 19:07:42 »

Never worked with Bitmap, but my guess would be that the width of bmp is less than 11 + 22 = 33 as would be needed in the last line.

Edit: because it makes a subselection starting at x=11, of width=22, so you would end up at x=33 for the right edge of the selection.

Offline roseslayer

Senior Devvie


Medals: 12



« Reply #2 - Posted 2014-10-21 19:10:49 »

Never worked with Bitmap, but my guess would be that the width of bmp is less than 11 + 22 = 33 as would be needed in the last line.

Edit: because it makes a subselection starting at x=11, of width=22, so you would end up at x=33 for the right edge of the selection.

Tyvm! I always did if it were positions on the bitmap itself, but they already do -start ._.''
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (207 views)
2019-09-04 15:33:17

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

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

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

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

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

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

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

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

nelsongames (4312 views)
2018-04-24 18:15:36
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

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
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!