我有二进制树格式的数据,我想将它表示为一个图像(*.jpeg)然后我需要在网页上显示该图像,所有数据将来@运行时,因此图像处理应该在@ runtime,这该怎么做 ?
这是我的思想解决方案,任何其他合适的解决方案也欢迎,
网站是在.NET,我想用java api生成图像然后通过WEB-SERVICE调用将其集成到.NET或任何其他解决方案也欢迎.
我有一个WIN32所有者绘制的静态控件,使用两个源图像(填充和未填充)绘制进度条.在初始抽奖中效果很好:
case WM_DRAWITEM:
{
DRAWITEMSTRUCT* draw = (DRAWITEMSTRUCT*)lparam;
// Manually draw the progress bar.
if( draw->hwndItem == hwndProgress )
{
// Progress bar is 526 pixels wide.
int left = progressPercent * 526 / 100;
// Paint sections of window with filled and unfilled bitmaps
// based on progress bar position.
HDC hdcMem = ::CreateCompatibleDC(draw->hDC);
::SelectObject(hdcMem, hBmpProgressFull);
::BitBlt(draw->hDC, 0, 0, left, 36, hdcMem, 0, 0, SRCCOPY);
::DeleteDC(hdcMem);
HDC hdcMem2 = ::CreateCompatibleDC(draw->hDC);
::SelectObject(hdcMem2, hBmpProgressEmpty);
::BitBlt(draw->hDC, left, 0, 526-left, 36, hdcMem2, left, …Run Code Online (Sandbox Code Playgroud) 无论如何在C#中声明和实例化一个椭圆?我可以用一个矩形来做,如下图所示:
private Rectangle rect = new Rectangle();
Run Code Online (Sandbox Code Playgroud)
有没有办法让我做以下(或类似的东西)?:
private Ellipse circ = new Ellipse();
Run Code Online (Sandbox Code Playgroud) 在我的代码中:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
mouseSwiped = YES;
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:drawImage];
UIGraphicsBeginImageContext(drawImage.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 10.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), r, g, b, a);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
lastPoint = currentPoint;
mouseMoved++;
if (mouseMoved == 10) {
mouseMoved = 0;
}
}
Run Code Online (Sandbox Code Playgroud)
我能够在drawImage中绘制一条线,但是如果我想绘制一条线来移除另一条线?作为取消其他画线的橡皮擦.可能吗?
我想知道如何实现水平(或垂直)捕捉鼠标光标到一条线.例如,在Facebook时间轴功能上,当您将鼠标悬停在中心线上时,它会将光标捕捉到中心.将鼠标靠近该线也会使其卡住.
我想将它包装在一个自定义控件中,而不是表单的控件.将有一条垂直或水平线,当它到达任何地方时它必须将鼠标光标捕捉到它.我将添加返回被点击的行的位置的事件.此控件还将具有与此行平行的垂直或水平滚动条,并且两个滚动条将永远不会同时显示.无论是垂直还是水平显示此行,都有一个主属性.
鼠标实际上不应该移动位置,但只是光标的显示应该以某种方式调整以在该行的中心显示它,而实际的X(或Y)位置永远不会改变.我不想移动光标,我想将光标显示在该行的中心,如果它到达任何地方.当光标处于此捕捉位置时,它将显示另一个自定义光标而不是标准(或默认)箭头.
我需要知道的是如何在这个控件中处理鼠标指针进入该行附近的事件,并将光标的显示调整到该行的中心.
我正在使用SetPixel(GetDC(0),x,y,color)在屏幕上书写但是当我这样做时,其他一些程序更新它的屏幕并覆盖我绘制的像素,因此屏幕上绘制的图像看起来闪闪发光.
如何避免这种情况并在屏幕上绘制一些内容而不必担心它会被覆盖?
我试图绘制一个源自X,Y值列表的图像,这些值代表一条线的起点和终点.它们以英寸为单位,因此它们目前被格式化为小数.
我遇到的问题是绘图.该MoveTo和LineTo命令需要一个整数双.如果我使用Round(float)数学运算,你会看到下面的输出.舍入产生相同的起点和终点,因此不绘制任何内容.
如何从十进制X,Y点列表中绘制我的形状?
调试输入值的代码(小数):
LineStartVal: -88.988857, 36.265838
LineEndVal: -89.094923, 36.371904
LineStartVal: -89.094923, 36.371904
LineEndVal: -95.000423, 36.371904
LineStartVal: -95.000423, 36.371904
LineEndVal: -95.000423, 32.828604
LineStartVal: -95.000423, 32.828604
LineEndVal: -99.134273, 32.828604
Run Code Online (Sandbox Code Playgroud)
舍入后输出点的调试代码:
MoveTo: -89, 36
LineTo: -89, 36
MoveTo: -89, 36
LineTo: -95, 36
MoveTo: -95, 36
LineTo: -95, 33
MoveTo: -95, 33
LineTo: -99, 33
Run Code Online (Sandbox Code Playgroud)
绘图代码片段:
//Function used to to get start and stop points
LSNLineObj.GetEndPoints(X1,Y1,X2,Y2);
//OutputMemo.Text := OutputMemo.Text + #13#10 + 'LineStartVal: ' + FloatToStrF(X1, …Run Code Online (Sandbox Code Playgroud) 我想通过图形框架类在屏幕上绘制1位数字.我希望'1'的填充方法类似于
所需的梯度http://qt-project.org/doc/qt-5.0/qtgui/images/qpainterpath-addtext.png
但是我画的'1'的画笔就像下面代码的黄色SolidBrush(丑陋的黄色'1').你能帮我解决它有什么问题吗?
QGraphicsSimpleTextItem digit_1 = new QGraphicsSimpleTextItem;
digit_1->setText(QString::number(1));
digit_1->setPen(QPen(QColor("black")));
QLinearGradient gradient(digit_1->boundingRect().topLeft(),
digit_1->boundingRect().bottomRight());
gradient.setColorAt(0, Qt::white);
gradient.setColorAt(1, Qt::yellow); // yellow is for example
QBrush brush(gradient);
brush.setStyle(Qt::BrushStyle::LinearGradientPattern);
digit_1->setBrush(brush);
digit_1->setFont(QFont("courier", 35, QFont::Black));
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我终于决定让我的记忆游戏中的实际游戏部分,并再次获得空指针异常错误.我之前已经在这里问了同样的问题,所以如果这被视为垃圾邮件我很抱歉,但我无法弄清问题是什么!
是的,我是编程的新手,所以对你为什么要做"在这里插入答案"做一点解释将是一个很大的帮助!
现在这里是我的Square类(这些是你必须记住的方块和游戏的起点):
package data.src;
import java.util.Random;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;
public class Square {
private StateBasedGame game;
boolean correct;
boolean clickable;
boolean clicked;
boolean started;
int squares;
int squareX;
int squareY;
public Image squareIncorrect;
public Image squareCorrect;
//For drawing these images from other classes
{
try {
squareIncorrect = new Image("res/squareIncorrect.png");
} catch (SlickException e1) {
e1.printStackTrace();
}
try {
squareCorrect = new Image("res/squareCorrect.png");
}
catch (SlickException e) {
e.printStackTrace();
} …Run Code Online (Sandbox Code Playgroud)