idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
4,100 | public static int cuTexRefSetFormat ( CUtexref hTexRef , int fmt , int NumPackedComponents ) { return checkResult ( cuTexRefSetFormatNative ( hTexRef , fmt , NumPackedComponents ) ) ; } | Sets the format for a texture reference . |
4,101 | public static int cuTexRefSetAddress2D ( CUtexref hTexRef , CUDA_ARRAY_DESCRIPTOR desc , CUdeviceptr dptr , long PitchInBytes ) { return checkResult ( cuTexRefSetAddress2DNative ( hTexRef , desc , dptr , PitchInBytes ) ) ; } | Binds an address as a 2D texture reference . |
4,102 | public static int cuTexRefSetAddressMode ( CUtexref hTexRef , int dim , int am ) { return checkResult ( cuTexRefSetAddressModeNative ( hTexRef , dim , am ) ) ; } | Sets the addressing mode for a texture reference . |
4,103 | public static int cuTexRefGetAddressMode ( int pam [ ] , CUtexref hTexRef , int dim ) { return checkResult ( cuTexRefGetAddressModeNative ( pam , hTexRef , dim ) ) ; } | Gets the addressing mode used by a texture reference . |
4,104 | public static int cuTexRefGetFormat ( int pFormat [ ] , int pNumChannels [ ] , CUtexref hTexRef ) { return checkResult ( cuTexRefGetFormatNative ( pFormat , pNumChannels , hTexRef ) ) ; } | Gets the format used by a texture reference . |
4,105 | public static int cuSurfRefSetArray ( CUsurfref hSurfRef , CUarray hArray , int Flags ) { return checkResult ( cuSurfRefSetArrayNative ( hSurfRef , hArray , Flags ) ) ; } | Sets the CUDA array for a surface reference . |
4,106 | public static int cuDeviceCanAccessPeer ( int canAccessPeer [ ] , CUdevice dev , CUdevice peerDev ) { return checkResult ( cuDeviceCanAccessPeerNative ( canAccessPeer , dev , peerDev ) ) ; } | Queries if a device may directly access a peer device s memory . |
4,107 | public static int cuParamSeti ( CUfunction hfunc , int offset , int value ) { return checkResult ( cuParamSetiNative ( hfunc , offset , value ) ) ; } | Adds an integer parameter to the function s argument list . |
4,108 | public static int cuParamSetf ( CUfunction hfunc , int offset , float value ) { return checkResult ( cuParamSetfNative ( hfunc , offset , value ) ) ; } | Adds a floating - point parameter to the function s argument list . |
4,109 | public static int cuParamSetv ( CUfunction hfunc , int offset , Pointer ptr , int numbytes ) { return checkResult ( cuParamSetvNative ( hfunc , offset , ptr , numbytes ) ) ; } | Adds arbitrary data to the function s argument list . |
4,110 | public static int cuParamSetTexRef ( CUfunction hfunc , int texunit , CUtexref hTexRef ) { return checkResult ( cuParamSetTexRefNative ( hfunc , texunit , hTexRef ) ) ; } | Adds a texture - reference to the function s argument list . |
4,111 | public static int cuEventElapsedTime ( float pMilliseconds [ ] , CUevent hStart , CUevent hEnd ) { return checkResult ( cuEventElapsedTimeNative ( pMilliseconds , hStart , hEnd ) ) ; } | Computes the elapsed time between two events . |
4,112 | public static int cuPointerGetAttribute ( Pointer data , int attribute , CUdeviceptr ptr ) { return checkResult ( cuPointerGetAttributeNative ( data , attribute , ptr ) ) ; } | Returns information about a pointer . |
4,113 | public static int cuStreamCreateWithPriority ( CUstream phStream , int flags , int priority ) { return checkResult ( cuStreamCreateWithPriorityNative ( phStream , flags , priority ) ) ; } | Create a stream with the given priority |
4,114 | public static int cuStreamAttachMemAsync ( CUstream hStream , CUdeviceptr dptr , long length , int flags ) { return checkResult ( cuStreamAttachMemAsyncNative ( hStream , dptr , length , flags ) ) ; } | Attach memory to a stream asynchronously . |
4,115 | public static int cuGLCtxCreate ( CUcontext pCtx , int Flags , CUdevice device ) { return checkResult ( cuGLCtxCreateNative ( pCtx , Flags , device ) ) ; } | Create a CUDA context for interoperability with OpenGL . |
4,116 | public static int cuGraphicsResourceGetMappedPointer ( CUdeviceptr pDevPtr , long pSize [ ] , CUgraphicsResource resource ) { return checkResult ( cuGraphicsResourceGetMappedPointerNative ( pDevPtr , pSize , resource ) ) ; } | Get a device pointer through which to access a mapped graphics resource . |
4,117 | public static int cuLaunchCooperativeKernel ( CUfunction f , int gridDimX , int gridDimY , int gridDimZ , int blockDimX , int blockDimY , int blockDimZ , int sharedMemBytes , CUstream hStream , Pointer kernelParams ) { return checkResult ( cuLaunchCooperativeKernelNative ( f , gridDimX , gridDimY , gridDimZ , blockDimX... | Launches a CUDA function where thread blocks can cooperate and synchronize as they execute . |
4,118 | public static int cuLaunchCooperativeKernelMultiDevice ( CUDA_LAUNCH_PARAMS launchParamsList [ ] , int numDevices , int flags ) { return checkResult ( cuLaunchCooperativeKernelMultiDeviceNative ( launchParamsList , numDevices , flags ) ) ; } | Launches CUDA functions on multiple devices where thread blocks can cooperate and synchronize as they execute . |
4,119 | public static int cuLaunchHostFunc ( CUstream hStream , CUhostFn fn , Object userData ) { return checkResult ( cuLaunchHostFuncNative ( hStream , fn , userData ) ) ; } | Enqueues a host function call in a stream . |
4,120 | public static int cuProfilerInitialize ( String configFile , String outputFile , int outputMode ) { return checkResult ( cuProfilerInitializeNative ( configFile , outputFile , outputMode ) ) ; } | Initialize the profiling . |
4,121 | private Dimension getLayoutDimension ( ) { Dimension dim ; if ( layoutDimension != null ) { dim = new Dimension ( layoutDimension ) ; if ( dim . width <= 0 ) dim . width = 10 ; if ( dim . height <= 0 ) dim . height = 10 ; } else dim = new Dimension ( 10 , 10 ) ; return dim ; } | Obtains the dimension that should be used for the layout . |
4,122 | private void checkLayout ( ) { Dimension dim = getLayoutDimension ( ) ; if ( currentDimension == null || ! currentDimension . equals ( dim ) ) { createLayout ( dim ) ; viewport . setContainingBlockBox ( owner ) ; if ( owner instanceof BlockBox ) viewport . clipByBlock ( ( BlockBox ) owner ) ; owner . removeAllSubBoxes ... | Checks whether the layout is computed and recomputes it when necessary . |
4,123 | private void organizeContent ( ) { table = new TableBox ( el , g , ctx ) ; table . adoptParent ( this ) ; table . setStyle ( style ) ; for ( Iterator < Box > it = nested . iterator ( ) ; it . hasNext ( ) ; ) { Box box = it . next ( ) ; if ( box instanceof TableCaptionBox ) { caption = ( TableCaptionBox ) box ; } else i... | Goes through the list of child boxes and organizes them into captions header footer etc . |
4,124 | private void initComponents ( URL baseurl ) { documentScroll = new javax . swing . JScrollPane ( ) ; browserCanvas = new BrowserCanvas ( docroot , decoder , new java . awt . Dimension ( 1000 , 600 ) , baseurl ) ; browserCanvas . addMouseListener ( new MouseListener ( ) { public void mouseClicked ( MouseEvent e ) { Syst... | Creates and initializes the GUI components |
4,125 | protected void loadAttributes ( ) { try { if ( ! HTMLNorm . getAttribute ( el , "colspan" ) . equals ( "" ) ) colspan = Integer . parseInt ( HTMLNorm . getAttribute ( el , "colspan" ) ) ; else colspan = 1 ; if ( ! HTMLNorm . getAttribute ( el , "rowspan" ) . equals ( "" ) ) rowspan = Integer . parseInt ( HTMLNorm . get... | Loads the important values from the element attributes . |
4,126 | public void copyValues ( ElementBox src ) { super . copyValues ( src ) ; nested . addAll ( src . nested ) ; textonly = src . textonly ; pseudoElements = new HashMap < > ( src . pseudoElements ) ; style = src . style ; pseudoStyle = new HashMap < > ( src . pseudoStyle ) ; startChild = src . startChild ; endChild = src .... | Copy the values from another element box . |
4,127 | protected void loadBorders ( CSSDecoder dec , int contw ) { border = new LengthSet ( ) ; if ( borderVisible ( "top" ) ) border . top = getBorderWidth ( dec , "border-top-width" ) ; else border . top = 0 ; if ( borderVisible ( "right" ) ) border . right = getBorderWidth ( dec , "border-right-width" ) ; else border . rig... | Loads the border sizes from the style . |
4,128 | protected void loadBackground ( ) { CSSProperty . BackgroundColor bg = style . getProperty ( "background-color" ) ; if ( bg == CSSProperty . BackgroundColor . color ) { TermColor bgc = style . getSpecifiedValue ( TermColor . class , "background-color" ) ; if ( bgc . isTransparent ( ) ) bgcolor = null ; else bgcolor = C... | Loads the background information from the style |
4,129 | protected void loadPosition ( ) { CSSDecoder dec = new CSSDecoder ( ctx ) ; int contw = getContainingBlock ( ) . width ; int conth = getContainingBlock ( ) . height ; CSSProperty . Top ptop = style . getProperty ( "top" ) ; CSSProperty . Right pright = style . getProperty ( "right" ) ; CSSProperty . Bottom pbottom = st... | Loads the top left bottom and right coordinates from the style |
4,130 | public TableColumn copyBox ( ) { TableColumn ret = new TableColumn ( el , g , ctx ) ; ret . copyValues ( this ) ; return ret ; } | Creates a copy of the column |
4,131 | public void setSpecifiedWidth ( String width ) { colwidth = width ; try { content = new Dimension ( 0 , 0 ) ; content . width = Integer . parseInt ( width ) ; bounds . width = content . width ; abswidth = content . width ; wset = true ; } catch ( NumberFormatException e ) { if ( ! width . equals ( "" ) ) log . warn ( "... | Set the width of the column form an attribute or CSS |
4,132 | public void setColumnWidth ( int width ) { content = new Dimension ( 0 , 0 ) ; content . width = width ; bounds . width = content . width ; } | Set the width of the column |
4,133 | public void addCell ( TableCellBox cell ) { if ( cells == null ) organizeContent ( ) ; cells . add ( cell ) ; cell . setOwnerRow ( this ) ; } | Add a new cell to the table row . |
4,134 | public int getMinimalColumnWidth ( int col ) { int ret = 0 ; int r = 0 ; while ( r < getRowCount ( ) ) { TableCellBox cell = cells [ col ] [ r ] ; if ( cell != null ) { int min = cell . getMinimalWidth ( ) / cell . getColspan ( ) ; if ( min > ret ) ret = min ; r += cell . getRowspan ( ) ; } else r ++ ; } return ret ; } | Determine the minimal width of the column |
4,135 | public int getMaximalColumnWidth ( int col ) { int ret = 0 ; int r = 0 ; while ( r < getRowCount ( ) ) { TableCellBox cell = cells [ col ] [ r ] ; if ( cell != null ) { int max = cell . getMaximalWidth ( ) / cell . getColspan ( ) ; if ( max > ret ) ret = max ; r += cell . getRowspan ( ) ; } else r ++ ; } return ret ; } | Determine the maximal width of the column |
4,136 | public void updateColumn ( int c , TableColumn col ) { int r = 0 ; while ( r < getRowCount ( ) ) { TableCellBox cell = cells [ c ] [ r ] ; if ( cell != null ) { cell . setOwnerColumn ( col ) ; int min = cell . getMinimalWidth ( ) / cell . getColspan ( ) ; if ( min > col . getMinimalWidth ( ) ) col . setMinimalWidth ( m... | Checks the maximal and minimal width of the column if the column has fixed width and if it is relative . Updates the appropriate information in the TableColumn structure . |
4,137 | public ElementBox createBox ( ElementBox parent , Element e , Viewport viewport , NodeData style ) { String name = e . getNodeName ( ) . toLowerCase ( ) ; if ( name . equals ( "object" ) ) return createSubtreeObject ( parent , e , viewport , style ) ; else if ( name . equals ( "img" ) ) return createSubtreeImg ( parent... | Creates the box according to the HTML element . |
4,138 | public void add ( BlockBox box ) { box . setOwnerFloatList ( this ) ; floats . add ( box ) ; if ( box . getBounds ( ) . y + box . getBounds ( ) . height > getMaxY ( ) ) bottomBox = box ; if ( box . getBounds ( ) . y > getLastY ( ) ) lastBox = box ; } | Adds a new floating box to the list |
4,139 | public int getWidth ( int y ) { int maxx = 0 ; for ( int i = 0 ; i < size ( ) ; i ++ ) { Box box = getBox ( i ) ; if ( box . getBounds ( ) . y <= y && box . getBounds ( ) . y + box . getBounds ( ) . height > y ) { int wx = box . getBounds ( ) . x + box . getBounds ( ) . width ; if ( wx > maxx ) maxx = wx ; } } return m... | Gets the total width of the floating boxes in some point . |
4,140 | public int getMaxYForOwner ( BlockBox owner , boolean requireVisible ) { int maxy = 0 ; for ( int i = 0 ; i < size ( ) ; i ++ ) { Box box = getBox ( i ) ; if ( ( ! requireVisible || box . isDeclaredVisible ( ) ) && box . getContainingBlockBox ( ) == owner ) { int ny = box . bounds . y + box . bounds . height ; if ( ny ... | Goes through all the boxes and computes the Y coordinate of the bottom edge of the lowest box . Only the boxes with the owner containing block are taken into account . |
4,141 | public static int getNextY ( FloatList fleft , FloatList fright , int y ) { int fy = y ; int nexty1 = fleft . getNextY ( fy ) ; int nexty2 = fright . getNextY ( fy ) ; if ( nexty1 != - 1 && nexty2 != - 1 ) fy = Math . min ( nexty1 , nexty2 ) ; else if ( nexty2 != - 1 ) fy = nexty2 ; else if ( nexty1 != - 1 ) fy = nexty... | Finds the nearest higher Y coordinate in two float lists where the float widths are different from the given starting coordinate . |
4,142 | public void copyValues ( Box src ) { rootelem = src . rootelem ; isblock = src . isblock ; order = src . order ; isempty = src . isempty ; sticky = src . sticky ; availwidth = src . availwidth ; viewport = src . viewport ; parent = src . parent ; cbox = src . cbox ; clipblock = src . clipblock ; bounds = new Rectangle ... | Copy all the values from another box |
4,143 | public void adoptParent ( ElementBox parent ) { if ( parent instanceof BlockBox ) setContainingBlockBox ( parent ) ; else setContainingBlockBox ( parent . getContainingBlockBox ( ) ) ; setParent ( parent ) ; setViewport ( parent . getViewport ( ) ) ; setClipBlock ( parent . getClipBlock ( ) ) ; } | Initializes a box in order to be a proper child box of the specified parent . Copies all the necessary information from the parent . |
4,144 | public void clipAbsoluteBounds ( Rectangle clip ) { Rectangle inter = absbounds . intersection ( clip ) ; if ( inter . width == 0 && inter . height == 0 ) displayed = false ; else absbounds = inter ; } | Adjusts the absolute bounds width and height in order to fit into the clip . If the box doesn t fit at all it is marked as invisible . |
4,145 | public Rectangle getContainingBlock ( ) { if ( cbox instanceof Viewport ) { Rectangle visible = ( ( Viewport ) cbox ) . getVisibleRect ( ) ; return new Rectangle ( 0 , 0 , visible . width , visible . height ) ; } else return cbox . getContentBounds ( ) ; } | Obtains the containing block bounds . |
4,146 | public Rectangle getAbsoluteContainingBlock ( ) { if ( cbox instanceof Viewport ) { Rectangle ab = cbox . getAbsoluteBounds ( ) ; Rectangle visible = ( ( Viewport ) cbox ) . getVisibleRect ( ) ; return new Rectangle ( ab . x , ab . y , visible . width , visible . height ) ; } else return cbox . getAbsoluteContentBounds... | Obtains the containing block absolute bounds . |
4,147 | protected Rectangle applyClip ( Shape current , Rectangle newclip ) { if ( current == null ) return newclip ; else { if ( current instanceof Rectangle ) return ( ( Rectangle ) current ) . intersection ( newclip ) ; else return current . getBounds ( ) . intersection ( newclip ) ; } } | Computes a new clipping region from the current one and the eventual clipping box |
4,148 | protected void initDefaultFonts ( ) { defaultFonts = new HashMap < String , String > ( 3 ) ; defaultFonts . put ( Font . SERIF , Font . SERIF ) ; defaultFonts . put ( Font . SANS_SERIF , Font . SANS_SERIF ) ; defaultFonts . put ( Font . MONOSPACED , Font . MONOSPACED ) ; } | Initializes the default fonts . Current implementation just defines the same physical names for basic AWT logical fonts . |
4,149 | public void redrawBoxes ( ) { Graphics2D ig = img . createGraphics ( ) ; clearCanvas ( ) ; viewport . draw ( new GraphicsRenderer ( ig ) ) ; revalidate ( ) ; } | Redraws all the rendered boxes . |
4,150 | public Viewport createViewportTree ( Element root , Graphics2D g , VisualContext ctx , int width , int height ) { Element vp = createAnonymousElement ( root . getOwnerDocument ( ) , "Xdiv" , "block" ) ; viewport = new Viewport ( vp , g , ctx , this , root , width , height ) ; viewport . setConfig ( config ) ; overflowP... | Create the viewport and the underlying box tree from a DOM tree . |
4,151 | public void createBoxTree ( BoxTreeCreationStatus stat ) { boolean generated = false ; do { if ( stat . parent . isDisplayed ( ) ) { if ( stat . parent . preadd != null ) { addToTree ( stat . parent . preadd , stat ) ; stat . parent . preadd = null ; } if ( stat . parent . previousTwin == null ) { Node n = createPseudo... | Creates the box subtrees for all the child nodes of the DOM node corresponding to the box creatin status . Recursively creates the child boxes from the child nodes . |
4,152 | private void createSubtree ( Node n , BoxTreeCreationStatus stat ) { stat . parent . curstat = new BoxTreeCreationStatus ( stat ) ; Box newbox ; boolean istext = false ; if ( n . getNodeType ( ) == Node . TEXT_NODE ) { newbox = createTextBox ( ( Text ) n , stat ) ; istext = true ; } else newbox = createElementBox ( ( E... | Creates a subtree of a parent box that corresponds to a single child DOM node of this box and adds the subtree to the complete tree . |
4,153 | private void addToTree ( Box newbox , BoxTreeCreationStatus stat ) { if ( newbox . isBlock ( ) ) { if ( ! ( ( BlockBox ) newbox ) . isPositioned ( ) ) { if ( stat . parent . mayContainBlocks ( ) ) { stat . parent . addSubBox ( newbox ) ; stat . lastinflow = newbox ; } else { ElementBox iparent = null ; ElementBox grand... | Adds a bew box to the tree according to its type and the tree creation status . |
4,154 | private ElementBox normalizeBox ( ElementBox root ) { if ( root . mayContainBlocks ( ) && ( ( BlockBox ) root ) . containsBlocks ( ) ) createAnonymousBlocks ( ( BlockBox ) root ) ; else if ( root . containsMixedContent ( ) ) createAnonymousInline ( root ) ; if ( root . getDisplay ( ) == ElementBox . DISPLAY_TABLE || ro... | Checks the newly created box and creates anonymous block boxes above the children if necessary . |
4,155 | private void createAnonymousBoxes ( ElementBox root , CSSProperty . Display type , CSSProperty . Display reqtype1 , CSSProperty . Display reqtype2 , CSSProperty . Display reqtype3 , String name , String display ) { if ( root . getDisplay ( ) != reqtype1 && root . getDisplay ( ) != reqtype2 && root . getDisplay ( ) != r... | Checks the child boxes of the specified root box wheter they require creating an anonymous parent box . |
4,156 | protected ElementBox createAnonymousBox ( ElementBox parent , Box child , boolean block ) { ElementBox anbox ; if ( block ) { Element anelem = createAnonymousElement ( child . getNode ( ) . getOwnerDocument ( ) , "Xdiv" , "block" ) ; anbox = new BlockBox ( anelem , ( Graphics2D ) child . getGraphics ( ) . create ( ) , ... | Creates an empty anonymous block or inline box that can be placed between an optional parent and its child . The corresponding properties of the box are taken from the child . The child is inserted NOT as the child box of the new box . The new box is NOT inserted as a subbox of the parent . |
4,157 | public ElementBox createBox ( ElementBox parent , Element n , String display ) { ElementBox root = null ; NodeData style = decoder . getElementStyleInherited ( n ) ; if ( style == null ) style = createAnonymousStyle ( display ) ; if ( config . getUseHTML ( ) && html . isTagSupported ( n ) ) { root = html . createBox ( ... | Creates a single new box from an element . |
4,158 | private Node createPseudoElement ( ElementBox box , PseudoElementType pseudo ) { Element n = box . getElement ( ) ; NodeData style = decoder . getElementStyleInherited ( n , pseudo ) ; if ( style != null ) { TermList cont = style . getValue ( TermList . class , "content" ) ; if ( cont != null && cont . size ( ) > 0 ) {... | Creates a new box for a pseudo - element . |
4,159 | public Element createAnonymousElement ( Document doc , String name , String display ) { Element div = doc . createElement ( name ) ; div . setAttribute ( "class" , "Xanonymous" ) ; div . setAttribute ( "style" , "display:" + display ) ; return div ; } | Creates a new DOM element that represents an anonymous box in a document . |
4,160 | private void computeInheritedStyle ( ElementBox dest , ElementBox parent ) { NodeData newstyle = dest . getStyle ( ) . inheritFrom ( parent . getStyle ( ) ) ; dest . setStyle ( newstyle ) ; } | Computes the style of a node based on its parent using the CSS inheritance . |
4,161 | public void considerBox ( Inline box ) { if ( ( ( Box ) box ) . isDisplayed ( ) && ! box . collapsedCompletely ( ) ) { int a = box . getBaselineOffset ( ) ; int b = box . getBelowBaseline ( ) ; if ( box instanceof InlineElement ) { VerticalAlign va = ( ( InlineElement ) box ) . getVerticalAlign ( ) ; if ( va != Vertica... | Updates the line box sizes according to a new inline box . |
4,162 | public void considerBoxProperties ( ElementBox box ) { VisualContext ctx = box . getVisualContext ( ) ; int a = ctx . getBaselineOffset ( ) ; int b = ctx . getFontHeight ( ) - ctx . getBaselineOffset ( ) ; above = Math . max ( above , a ) ; below = Math . max ( below , b ) ; maxAlignedHeight = Math . max ( maxAlignedHe... | Initializes the above and below offsets based on the font properties of the given box . |
4,163 | public int alignBox ( Inline box ) { if ( box instanceof InlineElement ) { VerticalAlign va = ( ( InlineElement ) box ) . getVerticalAlign ( ) ; if ( va == VerticalAlign . TOP || va == VerticalAlign . BOTTOM ) { return 0 ; } else { return above + computeBaselineDifference ( ( InlineElement ) box ) - box . getBaselineOf... | Aligns a new box and updates the line metrics . |
4,164 | private int computeBaselineDifference ( InlineElement box ) { int a = box . getBaselineOffset ( ) ; int b = box . getBelowBaseline ( ) ; CSSProperty . VerticalAlign va = box . getVerticalAlign ( ) ; int dif = 0 ; if ( va == CSSProperty . VerticalAlign . BASELINE ) dif = 0 ; else if ( va == CSSProperty . VerticalAlign .... | Computes the difference between the box baseline and our baseline according to the vertical alignment of the box . |
4,165 | public int getLength ( TermLengthOrPercent value , boolean auto , int defval , int autoval , int whole ) { if ( auto ) return autoval ; else if ( value == null ) return defval ; else return ( int ) context . pxLength ( value , whole ) ; } | Returns the length in pixels from a CSS definition |
4,166 | public void copy ( LengthSet src ) { top = src . top ; right = src . right ; bottom = src . bottom ; left = src . left ; } | Copies all the values from an existing set . |
4,167 | protected void writeSVG ( Viewport vp , Writer out ) throws IOException { int w = vp . getClippedContentBounds ( ) . width ; int h = vp . getClippedContentBounds ( ) . height ; SVGRenderer render = new SVGRenderer ( w , h , out ) ; vp . draw ( render ) ; render . close ( ) ; } | Renders the viewport using an SVGRenderer to the given output writer . |
4,168 | public int match ( FontSpec font ) { if ( this . family . equalsIgnoreCase ( font . family ) ) { int ret = 100 ; if ( this . weight == null ) ret ++ ; else if ( representsBold ( this . weight ) == representsBold ( font . weight ) ) ret += 10 ; if ( this . style == null ) ret ++ ; else if ( this . style == font . style ... | Check whether the specified font corresponds to this font specification . |
4,169 | public boolean affectsDisplay ( ) { boolean ret = containsFlow ( ) ; if ( border . top > 0 || border . bottom > 0 ) ret = true ; if ( padding . top > 0 || padding . bottom > 0 ) ret = true ; return ret ; } | Returns true if the element displays at least something |
4,170 | public void setContentWidth ( int width ) { int w = width ; if ( max_size . width != - 1 && w > max_size . width ) w = max_size . width ; if ( min_size . width != - 1 && w < min_size . width ) w = min_size . width ; content . width = w ; } | Sets the width of the content while considering the min - and max - width . |
4,171 | public void setContentHeight ( int height ) { int h = height ; if ( max_size . height != - 1 && h > max_size . height ) h = max_size . height ; if ( min_size . height != - 1 && h < min_size . height ) h = min_size . height ; content . height = h ; } | Sets the height of the content while considering the min - and max - height . |
4,172 | protected void moveFloatsDown ( int ofs ) { floatY += ofs ; for ( int i = startChild ; i < endChild ; i ++ ) { Box box = getSubBox ( i ) ; if ( box instanceof BlockBox ) { BlockBox block = ( BlockBox ) box ; if ( block . isInFlow ( ) ) block . moveFloatsDown ( ofs ) ; else if ( block . getFloating ( ) != BlockBox . FLO... | Moves down all the floating boxes contained in this box and its children . |
4,173 | private void alignLineHorizontally ( LineBox line , boolean isLast ) { final int dif = content . width - line . getLimits ( ) - line . getWidth ( ) ; if ( dif > 0 ) { if ( align == ALIGN_JUSTIFY ) { if ( ! isLast ) extendInlineChildWidths ( dif , line . getStart ( ) , line . getEnd ( ) , true , true ) ; } else if ( ali... | Aligns the subboxes in a line according to the selected alignment settings . |
4,174 | public void computeEfficientMargins ( ) { emargin . top = margin . top ; emargin . bottom = margin . bottom ; if ( containsBlocks ( ) && containsFlow ( ) ) { BlockBox firstseparated = null ; int mbottom = 0 ; for ( int i = 0 ; i < getSubBoxNumber ( ) ; i ++ ) { BlockBox subbox = ( BlockBox ) getSubBox ( i ) ; if ( subb... | Computes the efficient sizes of in - flow margins for collapsing |
4,175 | public boolean doLayout ( int availw , boolean force , boolean linestart ) { if ( ! displayed ) { content . setSize ( 0 , 0 ) ; bounds . setSize ( 0 , 0 ) ; return true ; } clearSplitted ( ) ; if ( ! hasFixedWidth ( ) ) { int min = Math . max ( getMinimalContentWidthLimit ( ) , getMinimalContentWidth ( ) ) ; int max = ... | Layout the sub - elements . |
4,176 | protected void layoutBlockFloating ( BlockBox subbox , int wlimit , BlockLayoutStatus stat ) { subbox . setFloats ( new FloatList ( subbox ) , new FloatList ( subbox ) , 0 , 0 , 0 ) ; subbox . doLayout ( wlimit , true , true ) ; FloatList f = ( subbox . getFloating ( ) == FLOAT_LEFT ) ? fleft : fright ; FloatList of = ... | Calculates the position for a floating box in the given context . |
4,177 | public void initFirstLine ( ElementBox box ) { if ( firstLine == null ) firstLine = new LineBox ( this , 0 , 0 ) ; firstLine . considerBoxProperties ( box ) ; for ( int i = startChild ; i < endChild ; i ++ ) { Box child = getSubBox ( i ) ; if ( child . isInFlow ( ) ) { if ( child . isBlock ( ) ) ( ( BlockBox ) child ) ... | Initializes the first line box with the box properties . This may be used for considering special content such as list item markers . |
4,178 | public void setLineBox ( LineBox linebox ) { this . linebox = linebox ; for ( int i = startChild ; i < endChild ; i ++ ) { Box sub = getSubBox ( i ) ; if ( sub instanceof InlineElement ) ( ( InlineElement ) sub ) . setLineBox ( linebox ) ; } } | Assigns the line box assigned to this inline box and all the inline sub - boxes . |
4,179 | public void copyValues ( TextBox src ) { super . copyValues ( src ) ; text = new String ( src . text ) ; ignoreinitialws = false ; collapsews = src . collapsews ; splitws = src . splitws ; linews = src . linews ; firstLineLength = src . firstLineLength ; lastLineLength = src . lastLineLength ; longestLineLength = src .... | Copy all the values from another text box . |
4,180 | public TextBox copyTextBox ( ) { TextBox ret = new TextBox ( textNode , g , ctx ) ; ret . copyValues ( this ) ; return ret ; } | Create a new box from the same DOM node in the same context |
4,181 | public void setWhiteSpace ( CSSProperty . WhiteSpace value ) { splitws = ( value == ElementBox . WHITESPACE_NORMAL || value == ElementBox . WHITESPACE_PRE_WRAP || value == ElementBox . WHITESPACE_PRE_LINE ) ; collapsews = ( value == ElementBox . WHITESPACE_NORMAL || value == ElementBox . WHITESPACE_NOWRAP || value == E... | Sets the whitespace processing for this box . The text content is then treated accordingly . The text start and text end indices are reset to their initial values . |
4,182 | private String collapseWhitespaces ( String src ) { StringBuffer ret = new StringBuffer ( ) ; boolean inws = false ; for ( int i = 0 ; i < src . length ( ) ; i ++ ) { char ch = src . charAt ( i ) ; if ( collapsews && isWhitespace ( ch ) ) { if ( ! inws ) { ret . append ( ' ' ) ; inws = true ; } } else if ( isLineBreak ... | Applies the whitespace removal rules used in HTML . |
4,183 | private String applyTransformations ( String src ) { switch ( transform ) { case LOWERCASE : return src . toLowerCase ( ) ; case UPPERCASE : return src . toUpperCase ( ) ; case CAPITALIZE : StringBuilder ret = new StringBuilder ( src . length ( ) ) ; boolean ws = true ; for ( int i = 0 ; i < src . length ( ) ; i ++ ) {... | Applies the text transformations to a string according to the current style . |
4,184 | public int getCharOffsetXElem ( int pos ) { if ( text != null ) { FontMetrics fm = g . getFontMetrics ( ) ; if ( pos <= textStart ) return 0 ; else if ( pos > textStart && pos < textEnd ) return stringWidth ( fm , text . substring ( textStart , pos ) ) ; else return stringWidth ( fm , text . substring ( textStart , tex... | Computes the X pixel offset of the given character of the box text . The character position is specified within the whole source text node . |
4,185 | protected void computeLineLengths ( ) { firstLineLength = - 1 ; lastLineLength = 0 ; longestLineLength = 0 ; String t = getText ( ) ; FontMetrics fm = g . getFontMetrics ( ) ; int s1 = 0 ; int s2 = t . indexOf ( '\r' ) ; int w = 0 ; do { if ( s2 == - 1 ) s2 = t . length ( ) ; else containsLineBreak = true ; w = stringW... | Computes the lengths of the first last and longest lines . |
4,186 | private int stringWidth ( FontMetrics fm , String text ) { int w = fm . stringWidth ( text ) ; if ( wordSpacing != null ) { float add = 0.0f ; for ( int i = 0 ; i < text . length ( ) ; i ++ ) { if ( text . charAt ( i ) == ' ' ) add += wordSpacing ; } w = Math . round ( w + add ) ; } return w ; } | Computes the final width of a string while considering word - spacing |
4,187 | private void drawAttributedString ( Graphics2D g , int x , int y , String text ) { if ( ! ctx . getTextDecoration ( ) . isEmpty ( ) ) { AttributedString as = new AttributedString ( text ) ; as . addAttribute ( TextAttribute . FONT , ctx . getFont ( ) ) ; if ( ctx . getTextDecoration ( ) . contains ( CSSProperty . TextD... | Draws a single string with eventual attributes based on the current visual context . |
4,188 | private boolean isWhitespace ( char ch ) { if ( linews ) return Character . isWhitespace ( ch ) ; else return ch != '\n' && ch != '\r' && Character . isWhitespace ( ch ) ; } | Checks if a character can be interpreted as whitespace according to current settings . |
4,189 | public String getTextDecorationString ( ) { if ( textDecoration . isEmpty ( ) ) return "none" ; else { StringBuilder ret = new StringBuilder ( ) ; for ( CSSProperty . TextDecoration dec : textDecoration ) { if ( ret . length ( ) > 0 ) ret . append ( ' ' ) ; ret . append ( dec . toString ( ) ) ; } return ret . toString ... | Returns the text decoration used for the box . |
4,190 | public void updateGraphics ( Graphics2D g ) { g . setFont ( font ) ; g . setColor ( color ) ; g . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_OFF ) ; g . setRenderingHint ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; } | Updates a Graphics according to this context |
4,191 | public void updateForGraphics ( NodeData style , Graphics2D g ) { if ( style != null ) update ( style ) ; updateGraphics ( g ) ; fm = g . getFontMetrics ( ) ; FontRenderContext frc = new FontRenderContext ( null , false , false ) ; TextLayout layout = new TextLayout ( "x" , font , frc ) ; ex = layout . getBounds ( ) . ... | Updates this context according to the given style . Moreover given Graphics is updated to this style and used for taking the font metrics . |
4,192 | public double ptLength ( TermLengthOrPercent spec , double whole ) { float nval = spec . getValue ( ) ; if ( spec . isPercentage ( ) ) { return ( whole * nval ) / 100 ; } else if ( spec instanceof TermCalc ) { final CalcArgs args = ( ( TermCalc ) spec ) . getArgs ( ) ; return args . evaluate ( getPtEval ( ) . setWhole ... | Converts a length from a CSS length or percentage to pt . |
4,193 | public double radAngle ( TermAngle spec ) { float nval = spec . getValue ( ) ; final TermLength . Unit unit = spec . getUnit ( ) ; if ( spec instanceof TermCalcAngleImpl ) { final CalcArgs args = ( ( TermCalc ) spec ) . getArgs ( ) ; return args . evaluate ( getRadEval ( ) ) ; } else { if ( unit == null ) return 0 ; sw... | Converts an angle from a CSS angle to rad . |
4,194 | private String getFontName ( TermList list , CSSProperty . FontWeight weight , CSSProperty . FontStyle style ) { for ( Term < ? > term : list ) { Object value = term . getValue ( ) ; if ( value instanceof CSSProperty . FontFamily ) return ( ( CSSProperty . FontFamily ) value ) . getAWTValue ( ) ; else { String name = l... | Scans a list of font definitions and chooses the first one that is available |
4,195 | private String lookupFont ( String family , CSSProperty . FontWeight weight , CSSProperty . FontStyle style ) { final String systemFontNames [ ] = GraphicsEnvironment . getLocalGraphicsEnvironment ( ) . getAvailableFontFamilyNames ( ) ; String nameFound = null ; FontSpec spec = new FontSpec ( family , weight , style ) ... | Check if the font family is available either among the CSS defined fonts or the system fonts . If found registers a system font with the given name . |
4,196 | private String fontAvailable ( String family , String [ ] avail ) { for ( int i = 0 ; i < avail . length ; i ++ ) if ( avail [ i ] . equalsIgnoreCase ( family ) ) return avail [ i ] ; return null ; } | Returns true if the font family is available . |
4,197 | public static double convertFontSize ( double parent , CSSProperty . FontSize value ) { double em = parent ; double ret = em ; if ( value == CSSProperty . FontSize . MEDIUM ) ret = medium_font ; else if ( value == CSSProperty . FontSize . SMALL ) ret = medium_font / font_step ; else if ( value == CSSProperty . FontSize... | Converts the font size given by an identifier to absolute length in pixels . |
4,198 | public static int convertBorderWidth ( CSSProperty . BorderWidth width ) { if ( width == CSSProperty . BorderWidth . THIN ) return THIN_BORDER ; else if ( width == CSSProperty . BorderWidth . MEDIUM ) return MEDIUM_BORDER ; else return THICK_BORDER ; } | Converts the border size given by an identifier to an absolute value . |
4,199 | public static java . awt . Color convertColor ( cz . vutbr . web . csskit . Color src ) { return new java . awt . Color ( src . getRGB ( ) , true ) ; } | Convetrs the CSS parser color representation to the AWT color used by CSSBox . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.