scaling

Resizing a canvas image without blurring it

て烟熏妆下的殇ゞ 提交于 2019-12-04 10:39:26
问题 I have a small image, which I am rendering on a canvas, like this: ctx.drawImage(img, 0, 0, img.width*2, img.height*2); I would like this to show a sharp upsized image (4 identical pixels for each image pixel). However, this code (in Chrome 29 on Mac) makes a blurry image. In Photoshop terms, it looks like it's using "Bicubic" resampling, instead of "Nearest Neighbour". In a situation where it would be useful (eg. a retro game), Is it possible to produce a sharp upsized image, or do I need to

Android: How do you scale multiple views together?

江枫思渺然 提交于 2019-12-04 10:13:07
I'm trying to layer graphics one top of each other, like an icon over a background, with the second layer (icon) at a certain pixel offset from the top left corner of first layer (background). Since each layer will eventually have its own animation, I'm placing each in its own View. For my implementation I have two ImageViews, one for each layer, inside a RelativeLayout, which in turn is inside a ScrollView. ImageViews are positioned using layout_margin relative to the top left corner (0,0). The first ImageView is larger than the screen (background), while the second ImageView is smaller than

Limit on number of git branches

瘦欲@ 提交于 2019-12-04 10:03:07
问题 I am musing about building a big system on top of git for various reasons but mainly convenience. But as part of the implementation I would end up making millions of branches and branching and merging between them. Can git actually scale this way? I always hear "Branches are free" but I have to wonder if this is really true x1,000,000? Can git actually create a theoretical unlimited number of branches? 回答1: Yes, branches are free. Branching and merging is very easy. The scalability issues

Setting ImageView ScaleType to “center” is not working as I expect it

橙三吉。 提交于 2019-12-04 09:59:06
问题 I have the following layout for my ImageView : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:descendantFocusability="blocksDescendants"> <ImageView android:id="@+id/imageview_icon" android:layout_width="48dp" android:layout_height="48dp" android:scaleType="fitCenter" /> (...) </LinearLayout> Those 48dp equal to 36px,

scene2d button scaling with libgdx

孤街醉人 提交于 2019-12-04 09:56:31
I don't know if it is just me, but drawables confuse me. Are they intended to keep the size they are given, or is there a way to scale the image within them? I understand they can use ninepatch to fill certain areas by stretching an image, but I want to scale the image that it stretches. I am using a TextButton for my menu buttons, but they are way too big, and I would love to know how to scale them. I am retrieving the skin from an atlas, which has ninepatch images in it. Here is the settings screen: Here are the images in the pack I am using: Here is the initialization of the TextureAtlas,

iOS CAKeyFrameAnimation Scaling Flickers at animation end

≯℡__Kan透↙ 提交于 2019-12-04 09:38:15
问题 In another test of Key Frame animation I am combining moving a UIImageView (called theImage ) along a bezier path and scaling larger it as it moves, resulting in a 2x larger image at the end of the path. My initial code to do this has these elements in it to kick off the animation: UIImageView* theImage = .... float scaleFactor = 2.0; .... theImage.center = destination; theImage.transform = CGAffineTransformMakeScale(1.0,1.0); CABasicAnimation *resizeAnimation = [CABasicAnimation

Full size image in ImageView

◇◆丶佛笑我妖孽 提交于 2019-12-04 09:09:48
I'm trying to draw an image in an ImageView, but i want it to be unscaled, with scrollbars as necessary. How can I accomplish this? Right now I just have a drawable set as the android:src of the ImageView in the XML. This autoscales the image to fit the screen width. I read that this might be because of the compatibility mode (developing for 1.5, testing on 2.1), but then I added <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" /> to my manifest, and nothing changed. Any clues? -- Edit: I used android:scaleType="center" on the ImageView, and this displays the full image (can't

Scaling a matrix in OpenCV

隐身守侯 提交于 2019-12-04 07:14:23
问题 I have to process a matrix and then scale it as a gray scale image. In matlab I could achieve this using mat2gray function. How can I do the same in opencv? for(int i=0;i<c4.rows-1;i++) { for(int j=0;j<c4.cols-1;j++) { value=100*sin(2*pi*j*18.0/imgCols); c5.at<Vec2d>(i,j)=value; } } 回答1: #include <opencv2/imgproc/imgproc.hpp> cv::Mat greyMat, colorMat; cv::cvtColor(colorMat, greyMat, CV_BGR2GRAY); 回答2: If you have already single channel matrices and want to scale their values between 0 and 1

Scaling images with Java JAI

前提是你 提交于 2019-12-04 05:50:11
I have to scale an image with Java JAI. At the time now, I use the following code: private static RenderedOp scale(RenderedOp image, float scale) { ParameterBlock scaleParams = new ParameterBlock(); scaleParams.addSource(image); scaleParams.add(scale).add(scale).add(0.0f).add(0.0f); scaleParams.add(Interpolation.getInstance(Interpolation.INTERP_BICUBIC_2)); // Quality related hints when scaling the image RenderingHints scalingHints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); scalingHints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints

LibGDX - How to smooth out actor drawable when scaling a Scene2d stage?

偶尔善良 提交于 2019-12-04 04:05:56
This is my set-up: stage = new Stage(1280, 800, false); button = new Button(drawableUp, drawableDown); stage.add(button); this gets rendered as following: @Override public void render(float delta) { Gdx.gl.glClearColor(RED,GREEN,BLUE,ALPHA); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(delta); stage.draw(); } The issue is that when the stage is shown on 1280x800 the button looks like that: If the stage is rescaled to e.g. 1280x736, the button drawable is scaled in the following way: Is there a way to smooth out the edges somehow? Because right now it looks to me that the scaling is