Skip to content

devGnode/JSgraphicalUserInterface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphicalUserInterface javascript 🇫🇷

going soon

i gotta clean up the code before

.greyScaleFilter | 2,4,8,16,32,64 ... 128 bits

2 bits grayscale ...

.colorFilter | 3, 6, 24 bits

.YCrCbFilter

.medianFilter

.nagaoFilter ( an other median filter by sort matrice )

.graphColorFilter : Canvas Graphic color

examples

1️⃣ JSgraphicalUserInterface prototype

  var opts;
  var guid = graphicalUserInterface( opts = {
    monitor: DOMHtml canvas,
    width: uint x,
    height: uint y,
    rgba: bool useRGBA
    });

Global :

uint screen_x

uint screen_y

methods :

.drawImage

parameters : DOMImage node
@return void

guid.drawImage( imgNode );

.resetScreen

parameters : int color || str color
@return void

  guid.resetScreen( 0 );

.resize

parameters : uint x, uint y
@return void

 guid.resize( 320, 400 );

.getRawPixel

parameters : uint offset
@return uint colorRGB

  guid.getRawPixel( 256 );

.setRawPixel

parameters : uint offset, uint color
@return void

  guid.setRawPixel( 255, 16777215 );

.getPixel

parameters : uint x, uint y
@return uint colorRGB

  guid.getPixel( 1, 0 );

.setPixel

parameters : uint x, uint y, uint color
@return void

  guid.setPixel( 1, 0, 16711680 ); // #ff0000 -> red -> 1671168

.getLine

parameters : uint y (, bool key )
@return Array ret[ addr1, addr2,... ] if key is false
@return Array ret[ 1,2,3,.... ] if key is true

  var line = guid.getLine( 1 );
      line[ y*screen_x ];
      line[ y*screen_x +1 ];
  var line = guid.getLine( 1, true );
      line[ 0 ];
      line[ 1 ];

.setLine

parameters : uint y ,[ Array [0,1,2], bool key=true || Array[ offset, offset ] || uintcolor ][, bool key ]
@return void

  guid.setLine( 1, 255 );
  guid.setLine( 2, [ scree_x*y => 16777215, screen_x*y+1 =>255 ,...] );
  guid.setLine( 2, [ 0 => 16777215, 1 =>255 ,...], true );

.refresh

parameters : void @return void

  guid.refresh( );

.snapshot

parameters : void
@return void

  guid.snapshot( ); // dataURL

.each

parameters : callback
@return void

  guid.each( function( addr, colorUint32, JSON rgb, uint32 x, uint32 y ){
    
    this == guid or buffer if opts.buffer is declared
  
  }); 

Bind Points ( Vertex )

.bind( int xa, int xb, int ya, int yb, int32 color, int8 opts )

gui.bind( 1, 1,  10, 1, 0x00ff00  )

.cerc( int xa, int xb, int rayon, int32 color )

gui.bind( 10, 50, 20, 0x00ff00  )

Rotation

 hprop = {
  __code: *Array* binaryImage
  angle: *int* angle,
  x: *int* to
  y: *int* to
  overflow: *int32* colorDisplay 
 }

.rot( JSON hprop, int xFrom, int yFrom )

gui.rot( hprop, 20, 50  )

2️⃣ .tiles

@return Object

.setTiles

.setTilesByOffset

JSON opts {
mod:0 or 1 or 2
offsetTilesX : uint32 x,
offsetTilesY : uint32 y,

mod:0,
center: 1 or 0 
// 
mod:1
palette: Array PaletteColor[...,...]


//
buffer: Array[]

}

parameters : callback
@return void

  var tile = [
  0, 0xfefefe, 0xfafafa, 0xffffff ... // color data 
  ...
  ];
  // mod 0
  // 8*8
var mtile= guid.tiles({ 
    mod:0,
    offsetTilesX: 8,
    offsetTileY: 8,
    
  }).setTiles( screen_x, screen_y, tile );

var mtile= guid.tiles({ 
    mod:0,
    offsetTilesX: 8,
    offsetTileY: 8,
    
    center: true,
    
  }).setTilesByOffset(  5, tile );

  // mod 1
  // 8*8
 var tile = [
  0,3,3,2
  0,2,2,1
  ...
  ];
guid.tiles({ 
    mod:1,
    offsetTilesX: 8,
    offsetTilesY:8
    palette:[
       0, 0xfefefe, 0xfafafa, 0xffffff ... // color data 
    ],
    
  })( screen_x, screen_y, tile )
  

  // mod 2
  // 9*8
 var tile = [
  0,0,0,0,0,0,0,0,
  0,0,0,1,1,0,0,0,
  0,0,0,1,1,0,0,0,
  0,0,0,1,1,0,0,0,
  0,1,1,1,1,1,1,0,
  0,0,1,1,1,1,0,0,
  0,0,0,1,1,0,0,0,
  0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,
  ...
  ];
guid.tiles({ 
    mod:1,
    offsetTilesX: 8,
    offsetTiesY:9,
    palette:[
       0, 0xfefefe, 0xfafafa, 0xffffff ... // color data 
    ],
    
  })( screen_x, screen_y, tile, 1 color font 0xfefefe , 0 background || null  )

HERE

###intToRgb

parameters : uint color
@return JSON { r: uint, g: uint g, b: uint b }

  var color = guid.rgb( 16777215 );
      color.r // 255
      color.g // 255
      color.b // 255

About

Use cavans with facility

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors