Пример #1
0
void UIWidget::parseImageStyle(const OTMLNodePtr& styleNode)
{
    for(const OTMLNodePtr& node : styleNode->children()) {
        if(node->tag() == "image-source")
            setImageSource(stdext::resolve_path(node->value(), node->source()));
        else if(node->tag() == "image-offset-x")
            setImageOffsetX(node->value<int>());
        else if(node->tag() == "image-offset-y")
            setImageOffsetY(node->value<int>());
        else if(node->tag() == "image-offset")
            setImageOffset(node->value<Point>());
        else if(node->tag() == "image-width")
            setImageWidth(node->value<int>());
        else if(node->tag() == "image-height")
            setImageHeight(node->value<int>());
        else if(node->tag() == "image-size")
            setImageSize(node->value<Size>());
        else if(node->tag() == "image-rect")
            setImageRect(node->value<Rect>());
        else if(node->tag() == "image-clip")
            setImageClip(node->value<Rect>());
        else if(node->tag() == "image-fixed-ratio")
            setImageFixedRatio(node->value<bool>());
        else if(node->tag() == "image-repeated")
            setImageRepeated(node->value<bool>());
        else if(node->tag() == "image-smooth")
            setImageSmooth(node->value<bool>());
        else if(node->tag() == "image-color")
            setImageColor(node->value<Color>());
        else if(node->tag() == "image-border-top")
            setImageBorderTop(node->value<int>());
        else if(node->tag() == "image-border-right")
            setImageBorderRight(node->value<int>());
        else if(node->tag() == "image-border-bottom")
            setImageBorderBottom(node->value<int>());
        else if(node->tag() == "image-border-left")
            setImageBorderLeft(node->value<int>());
        else if(node->tag() == "image-border")
            setImageBorder(node->value<int>());
        else if(node->tag() == "image-auto-resize")
            setImageAutoResize(node->value<bool>());
    }
}
Пример #2
0
void renderScene(Scene* scene){
	Color final_color;
	HitRecord record = createHitRecord();
    Sample sample = createSample(scene->num_samples);

    Color black = {0, 0, 0};

    int xres = scene->image.width;
    int yres = scene->image.height;

	for(int i = 0; i < xres; i++){
		for(int j = 0; j < yres; j++){

            getSamples(&sample);
            applyFilter(&sample);

            final_color = black;

            int hit_count = 0;
            for(int k = 0; k < scene->num_samples; k++){
                double x = 2 * (i - xres/2. + sample.samples[k].x)/xres;
                double y = 2 * (j - yres/2. + sample.samples[k].y)/yres;

                Ray ray = cameraCreateRay(&scene->camera, x, -y);
                resetHitRecord(&record);
                Color result = hitScene(scene, &record, ray, 0);
                if(result.red != 0 || result.green != 0 || result.blue != 0){
                    final_color = addColors(final_color, result);
                    hit_count++;
                }
            }

            if(hit_count > 0){
                final_color = multiplyColorByNumber(final_color, 1.0 / (double)hit_count);
            }

			setImageColor(&scene->image, i, j, final_color);
		}
	}
}
Пример #3
0
void LLButton::setColor(const LLColor4& color)
{
	setImageColor(color);
}