尝试在worklight 6.1中调试适配器Java代码(Trying to debug adapter Java Code in worklight 6.1)
我正在尝试调试worklight 6.1适配器代码(java)。 我认为最合乎逻辑的方法是在调试模式下重启嵌入式自由服务器。 这失败了一条消息:
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options. Error occurred during initialization of VM agent library failed to init: jdwp
我在Workging Server上记录和调试Java时遵循了6.0中记录的过程,但我在那里遇到了同样的问题。
I'm trying to debug worklight 6.1 adapter code (java). I figured the most logical way would be to restart the imbedded liberty server in debug mode. That fails with a message:
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options. Error occurred during initialization of VM agent library failed to init: jdwp
I followed the process documented for 6.0 at Logging and debugging Java on Worklight Server but I get the same issue there.
原文:https://stackoverflow.com/questions/21191965
最满意答案
好的,我已经找到了解决方案。 基本上,createPattern()可以将image或canvas元素作为其第一个参数。 所以你需要做以下事情:
var pattern_canvas = document.createElement('canvas'); pattern_canvas.width = texture_width; pattern_canvas.height = texture_height; var pattern_context = pattern_canvas.getContext('2d'); pattern_context.drawImage(img , texture_sx , texture_sy , texture_width , texture_height); var final_pattern = canvas_context.createPattern(pattern_canvas , "repeat"); canvas_context.fillStyle = final_pattern; canvas_context.fillRect( 0 , 0 , canvas.width , canvas.height );
如果执行此操作,则canvas元素将重复绘制pattern_canvas以覆盖其尺寸。
Okay I've worked out the solution to this. Basically, createPattern() can take either an image or canvas element as its first argument. So you need to do the following:
var pattern_canvas = document.createElement('canvas'); pattern_canvas.width = texture_width; pattern_canvas.height = texture_height; var pattern_context = pattern_canvas.getContext('2d'); pattern_context.drawImage(img , texture_sx , texture_sy , texture_width , texture_height); var final_pattern = canvas_context.createPattern(pattern_canvas , "repeat"); canvas_context.fillStyle = final_pattern; canvas_context.fillRect( 0 , 0 , canvas.width , canvas.height );
If you do this then your canvas element will have pattern_canvas repeatedly drawn to cover its dimensions.
相关问答
更多-
好的,我已经找到了解决方案。 基本上,createPattern()可以将image或canvas元素作为其第一个参数。 所以你需要做以下事情: var pattern_canvas = document.createElement('canvas'); pattern_canvas.width = texture_width; pattern_canvas.height = texture_height; var pattern_context = pattern_canvas.getContext( ...
-
查看错误控制台,我看到它充满了SecurityError 。 这是因为当您绘制到画布时,您会使用跨原始图像污染它。 这将禁止您出于安全原因调用getImageData ,因此“质朴”的结果。 Viewing the error console, I see it full of SecurityErrors. This is because when you draw to the canvas, you are tainting it with a cross-origin image. This wil ...
-
这个怎么样? 唯一的缺点是你需要一个可写的图像版本来标记访问过的像素,否则洪水填充永远不会终止。 Process each* scan line in turn For each scanline, walk from left to right, until you find a non-transparent pixel P. If the location of P is already inside a known bounded box Continue to the ri ...
-
将上下文模式视为画布上的背景图像。 模式始终从画布原点[0,0]开始。 如果图案重复,则图案在向右和向下重复的图块中填充画布。 因此,如果在画布周围移动三角形,则三角形将始终显示图案的不同部分。 有三种方法可以使三角形始终显示图案图像的相同部分。 选项#1 - context.translate 将画布原点从其默认[0,0]位置移动到三角形位置[loc.x,loc.y]。 您可以使用画布转换执行此操作。 特别是,translate命令将移动原点。 移动原点也会移动图案的左上角起始位置,以使图案始终以相对于移 ...
-
你不能。 一个节点只能有一个父节点。 如果创建批处理节点并将其添加到一个图层,则无法将其添加到另一个图层。 如果您将引用传递给批处理节点,那么它会使图层变得毫无意义,因为精灵将是添加批处理节点的图层的子节点。 您可以使用单个批处理节点并通过向批处理节点添加带有空纹理rect的“图层精灵”,然后将实际精灵添加到图层精灵来对精灵进行分组。 要创建具有空纹理的sprite,请使用initWithTexture:rect:方法并使用CGRectZero。 或者,如果这不再起作用,你也可以使用一个非常小的矩形并将精灵 ...
-
任何在Canvas中拍摄图像的东西都可以使用Canvas元素。 下面是一个制作模式的绘图代码示例,以及一个自定义模式函数,以防您想要更细致的控制。 这里要注意的关键是创建的画布只有40x40像素,只是足够大以保持图案。 http://jsfiddle.net/UxDVR/7/ Anything that takes an image in Canvas can take a Canvas element too. Here is an example of your drawing code making ...
-
您将画布对象作为可重复图像传递给模式,您应该将其更改为您想要重复的图像(在这种情况下我假设是草)。 So I managed to solve this myself after a lot of head scratching, and it was much simpler than I thought. before drawing on the canvas that has been created on the HTML file, create another canvas inside th ...
-
在xcode 7中,您可以使用Images.xcassets创建精灵地图集。 单击Images.xcassets 单击左下角的加号底部 选择“新精灵地图集” 然后,您可以将所有图像拖放到地图集中 如果使用正确的后缀(@ 2x和@ 3x)拖动所有三种图像尺寸,它将自动为您填充图像。 然后在代码中使用这些资产只需写: let atlas = SKTextureAtlas(named: "Sprites") let texture = atlas.textureNamed("ball") let sprite = ...
-
Kivy Sprite Sheet(Kivy Sprite Sheet)[2021-01-12]
我想你想要将精灵表加载到Texture(kivy.graphics.Texture)中,然后在你的循环中使用你精灵的纹理坐标创建一系列TextureRegions。 然后,您可以通过Rectangle图形指令显示这些内容。 您还需要正确设置纹理的纹理插值,可能是“最近”。 I think you'd want to load the sprite sheet into a Texture (kivy.graphics.Texture), then in your loop create a series o ... -
JavaScript精灵表(JavaScript sprite sheet)[2022-07-02]
根据循环中的i值进行位置计算。 像这样的东西应该工作: for (var i =0; i < 26; i++) { var xModifier = i%3; var yModifier = Math.floor(i/3); ElemObjects[ElemObjects.length] = new Elem(380 * xModifier, 340 * yModifier); } 这将为您提供循环浏览列表时所需的正确值。 xModifier基于将当前i值除以3后剩余的余数,而yM ...