Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Array problems

 
james falk
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I am having some trouble with an array. I am wondering how I initialize a 2d array with values? For instance, if I want to create a 2d array with values 1-10 in each of the arrays, how do i do that?

Here's what I tried:

But this gave me wonky results...

Any thoughts?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't just work on the values of the pixels directly - those contain the values of R, G, and B all in one pixel. You need to do the averaging separately for the R, G and B components of each pixel. Something like
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, did you just edit your post all out of context?
 
james falk
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, sorry about that. I figured out what I was doing wrong, had another question, and thought I could edit it before anyone responded. Sorry for the confusion. Thanks for the help btw.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic