Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

python - Drawing fast lines in pygame -


i'm trying draw fast lines using pygame aren't rendered directly screen. i've got python list large number of pixels desired resolution, , store integer values corresponding number of times pixel hit line algorithm. using this, 2d heat map built up, rather drawing flat pixel value, pixel values incremented based on number of times line runs through it, , "hot" pixels brighter colours.

the reason doing way don't know in advance how many of these lines going drawn, , maximum number of times given pixel going hit. since we'd scale output each rendering has correct maximum , minimum rgb values, can't draw screen.

is there better way draw these lines relatively naive bresenham's algorithm? here's critical part of drawline function:

  # before loop, save repeated multiplications   xm = []   in range(resolution[0]):     xm.append(i * resolution[0])    # inside of drawline, index f list, of size resolution[0] * resolution[1]   x in range(x0, x1 + 1):     if steep:       idx = y + xm[x]       f[idx] += 1     else:       idx = x + xm[y]       f[idx] += 1 

the end result scaled , drawn screen based on maximum value inside of f. example, if maximum value 1000, can assume rgb value of each of pixels (f[i] * 255) / 1000.

the profile information says runtime dominated index lookups f. i've used previous questions here prove these basic lists faster numpy arrays or arrays in python, drawing lines this, still seems there's room improve.

what's , fast method drawing unknown number of lines screen, knowing you'll scaling output in end render screen? there way rid of index overhead?

try cython or similar. (if do, interested in knowing if/how helped)

cython programming language simplify writing c , c++ extension modules cpython python runtime. strictly speaking, cython syntax superset of python syntax additionally supporting: direct calling of c functions, or c++ functions/methods, cython code. strong typing of cython variables, classes, , class attributes c types. cython compiles c or c++ code rather python, , result used python extension module or stand-alone application embedding cpython runtime. (http://en.wikipedia.org/wiki/cython)


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -